Skip to content

Commit

Permalink
T3202: Enable wireguard debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
natali-rs1985 authored and c-po committed Jun 20, 2024
1 parent 109e094 commit d818788
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions interface-definitions/system_option.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
12 changes: 12 additions & 0 deletions src/conf_mode/system_option.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit d818788

Please sign in to comment.