summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNataliia Solomko <natalirs1985@gmail.com>2024-06-19 10:40:02 +0300
committerChristian Breunig <christian@breunig.cc>2024-06-24 08:13:53 +0200
commite1c686f33e945ddeb2c45abec636fee398269838 (patch)
treed7d49ed0817b73ebbfd24e088440517e7bd2727a
parent264388062ff64228474372462e5f4b29d6e060f9 (diff)
downloadvyos-1x-e1c686f33e945ddeb2c45abec636fee398269838.tar.gz
vyos-1x-e1c686f33e945ddeb2c45abec636fee398269838.zip
T3202: Enable wireguard debug messages
(cherry picked from commit d818788932e3c57d020cca9236df7275da452fce)
-rw-r--r--interface-definitions/system_option.xml.in13
-rwxr-xr-xsrc/conf_mode/system_option.py12
2 files changed, 25 insertions, 0 deletions
diff --git a/interface-definitions/system_option.xml.in b/interface-definitions/system_option.xml.in
index ad423d9d1..e78a53552 100644
--- a/interface-definitions/system_option.xml.in
+++ b/interface-definitions/system_option.xml.in
@@ -49,6 +49,19 @@
<valueless/>
</properties>
</leafNode>
+ <node name="debug">
+ <properties>
+ <help>Dynamic debugging for kernel module</help>
+ </properties>
+ <children>
+ <leafNode name="wireguard">
+ <properties>
+ <help>Dynamic debugging for Wireguard module</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
</children>
</node>
<leafNode name="keyboard-layout">
diff --git a/src/conf_mode/system_option.py b/src/conf_mode/system_option.py
index 2c31703e9..56d608569 100755
--- a/src/conf_mode/system_option.py
+++ b/src/conf_mode/system_option.py
@@ -24,6 +24,9 @@ from vyos.configverify import verify_source_interface
from vyos.configverify import verify_interface_exists
from vyos.system import grub_util
from vyos.template import render
+from vyos.utils.dict import dict_search
+from vyos.utils.file import write_file
+from vyos.utils.kernel import check_kmod
from vyos.utils.process import cmd
from vyos.utils.process import is_systemd_service_running
from vyos.utils.network import is_addr_assigned
@@ -159,6 +162,15 @@ def apply(options):
cmd('udevadm control --reload-rules')
+ # Enable/disable dynamic debugging for kernel modules
+ modules = ['wireguard']
+ modules_enabled = dict_search('kernel.debug', options) or []
+ for module in modules:
+ if module in modules_enabled:
+ check_kmod(module)
+ write_file('/sys/kernel/debug/dynamic_debug/control', f'module {module} +p')
+ else:
+ write_file('/sys/kernel/debug/dynamic_debug/control', f'module {module} -p')
if __name__ == '__main__':
try: