summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-08-05 17:09:07 +0200
committerChristian Breunig <christian@breunig.cc>2024-08-24 21:54:48 +0200
commit092c922cfbec7ee82878fa5d22c5c016af01b60d (patch)
tree4040e61f35af5b7562b86c8694e93b09e5325d16
parent6f4bbbac4eaa16327b174e6231993000f33a121f (diff)
downloadvyos-1x-092c922cfbec7ee82878fa5d22c5c016af01b60d.tar.gz
vyos-1x-092c922cfbec7ee82878fa5d22c5c016af01b60d.zip
sysctl: T3204: restore sysctl setttings overwritten by tuned
(cherry picked from commit 8500e8658ff10f52739143fd7814cf60c9195f16)
-rw-r--r--data/config-mode-dependencies/vyos-1x.json10
-rwxr-xr-xsmoketest/scripts/cli/test_system_option.py3
-rwxr-xr-xsrc/conf_mode/system_ip.py10
-rwxr-xr-xsrc/conf_mode/system_ipv6.py9
-rwxr-xr-xsrc/conf_mode/system_option.py15
5 files changed, 35 insertions, 12 deletions
diff --git a/data/config-mode-dependencies/vyos-1x.json b/data/config-mode-dependencies/vyos-1x.json
index a38635cbe..ba7e6ccd3 100644
--- a/data/config-mode-dependencies/vyos-1x.json
+++ b/data/config-mode-dependencies/vyos-1x.json
@@ -60,9 +60,15 @@
"wireless": ["interfaces_wireless"],
"wwan": ["interfaces_wwan"]
},
+ "system_ip": {
+ "sysctl": ["system_sysctl"]
+ },
+ "system_ipv6": {
+ "sysctl": ["system_sysctl"]
+ },
"system_option": {
- "ip": ["system_ip"],
- "ipv6": ["system_ipv6"]
+ "ip_ipv6": ["system_ip", "system_ipv6"],
+ "sysctl": ["system_sysctl"]
},
"system_wireless": {
"wireless": ["interfaces_wireless"]
diff --git a/smoketest/scripts/cli/test_system_option.py b/smoketest/scripts/cli/test_system_option.py
index ffb1d76ae..5e2827724 100755
--- a/smoketest/scripts/cli/test_system_option.py
+++ b/smoketest/scripts/cli/test_system_option.py
@@ -94,6 +94,5 @@ class TestSystemOption(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
self.assertFalse(os.path.exists(ssh_client_opt_file))
-
if __name__ == '__main__':
- unittest.main(verbosity=2, failfast=True)
+ unittest.main(verbosity=2)
diff --git a/src/conf_mode/system_ip.py b/src/conf_mode/system_ip.py
index 2a0bda91a..c8a91fd2f 100755
--- a/src/conf_mode/system_ip.py
+++ b/src/conf_mode/system_ip.py
@@ -24,7 +24,8 @@ from vyos.utils.dict import dict_search
from vyos.utils.file import write_file
from vyos.utils.process import is_systemd_service_active
from vyos.utils.system import sysctl_write
-
+from vyos.configdep import set_dependents
+from vyos.configdep import call_dependents
from vyos import ConfigError
from vyos import frr
from vyos import airbag
@@ -52,6 +53,11 @@ def get_config(config=None):
get_first_key=True)}}
# Merge policy dict into "regular" config dict
opt = dict_merge(tmp, opt)
+
+ # If IPv4 ARP table size is set here and also manually in sysctl, the more
+ # fine grained value from sysctl must win
+ set_dependents('sysctl', conf)
+
return opt
def verify(opt):
@@ -127,6 +133,8 @@ def apply(opt):
frr_cfg.add_before(frr.default_add_before, opt['frr_zebra_config'])
frr_cfg.commit_configuration(zebra_daemon)
+ call_dependents()
+
if __name__ == '__main__':
try:
c = get_config()
diff --git a/src/conf_mode/system_ipv6.py b/src/conf_mode/system_ipv6.py
index 00d440e35..a2442d009 100755
--- a/src/conf_mode/system_ipv6.py
+++ b/src/conf_mode/system_ipv6.py
@@ -25,6 +25,8 @@ from vyos.utils.dict import dict_search
from vyos.utils.file import write_file
from vyos.utils.process import is_systemd_service_active
from vyos.utils.system import sysctl_write
+from vyos.configdep import set_dependents
+from vyos.configdep import call_dependents
from vyos import ConfigError
from vyos import frr
from vyos import airbag
@@ -52,6 +54,11 @@ def get_config(config=None):
get_first_key=True)}}
# Merge policy dict into "regular" config dict
opt = dict_merge(tmp, opt)
+
+ # If IPv6 neighbor table size is set here and also manually in sysctl, the more
+ # fine grained value from sysctl must win
+ set_dependents('sysctl', conf)
+
return opt
def verify(opt):
@@ -110,6 +117,8 @@ def apply(opt):
frr_cfg.add_before(frr.default_add_before, opt['frr_zebra_config'])
frr_cfg.commit_configuration(zebra_daemon)
+ call_dependents()
+
if __name__ == '__main__':
try:
c = get_config()
diff --git a/src/conf_mode/system_option.py b/src/conf_mode/system_option.py
index 5b593335e..6aaf3d107 100755
--- a/src/conf_mode/system_option.py
+++ b/src/conf_mode/system_option.py
@@ -31,7 +31,8 @@ from vyos.utils.process import cmd
from vyos.utils.process import is_systemd_service_running
from vyos.utils.network import is_addr_assigned
from vyos.utils.network import is_intf_addr_assigned
-from vyos.configdep import set_dependents, call_dependents
+from vyos.configdep import set_dependents
+from vyos.configdep import call_dependents
from vyos import ConfigError
from vyos import airbag
airbag.enable()
@@ -57,10 +58,9 @@ def get_config(config=None):
with_recursive_defaults=True)
if 'performance' in options:
- # Update IPv4 and IPv6 options after TuneD reapplies
- # sysctl from config files
- for protocol in ['ip', 'ipv6']:
- set_dependents(protocol, conf)
+ # Update IPv4/IPv6 and sysctl options after tuned applied it's settings
+ set_dependents('ip_ipv6', conf)
+ set_dependents('sysctl', conf)
return options
@@ -113,10 +113,11 @@ def generate(options):
def apply(options):
# System bootup beep
+ beep_service = 'vyos-beep.service'
if 'startup_beep' in options:
- cmd('systemctl enable vyos-beep.service')
+ cmd(f'systemctl enable {beep_service}')
else:
- cmd('systemctl disable vyos-beep.service')
+ cmd(f'systemctl disable {beep_service}')
# Ctrl-Alt-Delete action
if os.path.exists(systemd_action_file):