summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-06-22 17:30:55 +0200
committerGitHub <noreply@github.com>2024-06-22 17:30:55 +0200
commit757dae26d3a00c42f48706c406fd3178b77324c3 (patch)
treee0a83ea8256b36fb5e50bbd229fd717f118dbe41 /src/conf_mode
parent0c37a06e9d3d51ba1d4d6d42eec2b4cbb98a3a1c (diff)
parent9495f904fcc157521ca001ee21cf31be28a6b3a0 (diff)
downloadvyos-1x-757dae26d3a00c42f48706c406fd3178b77324c3.tar.gz
vyos-1x-757dae26d3a00c42f48706c406fd3178b77324c3.zip
Merge pull request #3679 from natali-rs1985/T3202-current
T3202: Enable wireguard debug messages
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/system_option.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/conf_mode/system_option.py b/src/conf_mode/system_option.py
index 2c31703e9..571ce55ec 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'
@@ -157,8 +161,18 @@ def apply(options):
time_format = time_format_to_locale.get(options['time_format'])
cmd(f'localectl set-locale LC_TIME={time_format}')
+ # Reload UDEV, required for USB auto suspend
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: