diff options
author | Christian Breunig <christian@breunig.cc> | 2024-06-25 18:11:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-25 18:11:40 +0200 |
commit | 2b5565bc5f3469dc34b47ee400173fb95fc5f6fd (patch) | |
tree | 03cba18f666168663d87511559f47c0e6a146d3c | |
parent | 1916a8cfcf21437219ff624a08bbf8408a4eaa80 (diff) | |
parent | 067afc29ae43a59df15a33025ff4d112d02a4607 (diff) | |
download | vyos-1x-2b5565bc5f3469dc34b47ee400173fb95fc5f6fd.tar.gz vyos-1x-2b5565bc5f3469dc34b47ee400173fb95fc5f6fd.zip |
Merge pull request #3707 from vyos/mergify/bp/circinus/pr-3679
T3202: Enable wireguard debug messages (backport #3679)
-rw-r--r-- | interface-definitions/system_option.xml.in | 13 | ||||
-rwxr-xr-x | src/conf_mode/system_option.py | 13 |
2 files changed, 26 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..ad4c0deae 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 @@ -36,6 +39,7 @@ curlrc_config = r'/etc/curlrc' ssh_config = r'/etc/ssh/ssh_config.d/91-vyos-ssh-client-options.conf' systemd_action_file = '/lib/systemd/system/ctrl-alt-del.target' usb_autosuspend = r'/etc/udev/rules.d/40-usb-autosuspend.rules' +kernel_dynamic_debug = r'/sys/kernel/debug/dynamic_debug/control' time_format_to_locale = { '12-hour': 'en_US.UTF-8', '24-hour': 'en_GB.UTF-8' @@ -159,6 +163,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(kernel_dynamic_debug, f'module {module} +p') + else: + write_file(kernel_dynamic_debug, f'module {module} -p') if __name__ == '__main__': try: |