From e1c686f33e945ddeb2c45abec636fee398269838 Mon Sep 17 00:00:00 2001 From: Nataliia Solomko Date: Wed, 19 Jun 2024 10:40:02 +0300 Subject: T3202: Enable wireguard debug messages (cherry picked from commit d818788932e3c57d020cca9236df7275da452fce) --- interface-definitions/system_option.xml.in | 13 +++++++++++++ src/conf_mode/system_option.py | 12 ++++++++++++ 2 files changed, 25 insertions(+) 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 @@ + + + Dynamic debugging for kernel module + + + + + Dynamic debugging for Wireguard module + + + + + 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: -- cgit v1.2.3 From 067afc29ae43a59df15a33025ff4d112d02a4607 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Thu, 20 Jun 2024 19:20:54 +0200 Subject: T3202: add single variable for Kernel dynamic debug settings (cherry picked from commit 9495f904fcc157521ca001ee21cf31be28a6b3a0) --- src/conf_mode/system_option.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/conf_mode/system_option.py b/src/conf_mode/system_option.py index 56d608569..ad4c0deae 100755 --- a/src/conf_mode/system_option.py +++ b/src/conf_mode/system_option.py @@ -39,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' @@ -168,9 +169,9 @@ def apply(options): for module in modules: if module in modules_enabled: check_kmod(module) - write_file('/sys/kernel/debug/dynamic_debug/control', f'module {module} +p') + write_file(kernel_dynamic_debug, f'module {module} +p') else: - write_file('/sys/kernel/debug/dynamic_debug/control', f'module {module} -p') + write_file(kernel_dynamic_debug, f'module {module} -p') if __name__ == '__main__': try: -- cgit v1.2.3