summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-03-25 19:00:36 +0100
committerChristian Poessinger <christian@poessinger.com>2022-03-25 19:18:19 +0100
commit4187f010263646442dc2e70564d27787908a5fb1 (patch)
tree09f4e9e7f4899edb449c39a85dbfbd3a2ca9c3bf
parentb12b4d512bd0f0cf98b717631be28a6fb5e65aa2 (diff)
downloadvyos-1x-4187f010263646442dc2e70564d27787908a5fb1.tar.gz
vyos-1x-4187f010263646442dc2e70564d27787908a5fb1.zip
vyos.util: T4319: rename sysctl() -> sysctl_write()
(cherry picked from commit 364009e4317fb5c6732635726b511613aa2ed519)
-rw-r--r--python/vyos/util.py2
-rwxr-xr-xsrc/conf_mode/system-ip.py12
-rwxr-xr-xsrc/conf_mode/system-ipv6.py12
-rwxr-xr-xsrc/conf_mode/vrf.py6
4 files changed, 16 insertions, 16 deletions
diff --git a/python/vyos/util.py b/python/vyos/util.py
index 5dff70b94..b5d81fba5 100644
--- a/python/vyos/util.py
+++ b/python/vyos/util.py
@@ -819,7 +819,7 @@ def sysctl_read(name):
tmp = cmd(f'sysctl {name}')
return tmp.split()[-1]
-def sysctl(name, value):
+def sysctl_write(name, value):
""" Change value via sysctl() - return True if changed, False otherwise """
tmp = cmd(f'sysctl {name}')
# last list index contains the actual value - only write if value differs
diff --git a/src/conf_mode/system-ip.py b/src/conf_mode/system-ip.py
index 8b97725ac..05fc3a97a 100755
--- a/src/conf_mode/system-ip.py
+++ b/src/conf_mode/system-ip.py
@@ -20,7 +20,7 @@ from vyos.config import Config
from vyos.configdict import dict_merge
from vyos.util import call
from vyos.util import dict_search
-from vyos.util import sysctl
+from vyos.util import sysctl_write
from vyos.util import write_file
from vyos.xml import defaults
from vyos import ConfigError
@@ -53,11 +53,11 @@ def apply(opt):
# table_size has a default value - thus the key always exists
size = int(dict_search('arp.table_size', opt))
# Amount upon reaching which the records begin to be cleared immediately
- sysctl('net.ipv4.neigh.default.gc_thresh3', size)
+ sysctl_write('net.ipv4.neigh.default.gc_thresh3', size)
# Amount after which the records begin to be cleaned after 5 seconds
- sysctl('net.ipv4.neigh.default.gc_thresh2', size // 2)
+ sysctl_write('net.ipv4.neigh.default.gc_thresh2', size // 2)
# Minimum number of stored records is indicated which is not cleared
- sysctl('net.ipv4.neigh.default.gc_thresh1', size // 8)
+ sysctl_write('net.ipv4.neigh.default.gc_thresh1', size // 8)
# enable/disable IPv4 forwarding
tmp = dict_search('disable_forwarding', opt)
@@ -67,11 +67,11 @@ def apply(opt):
# configure multipath
tmp = dict_search('multipath.ignore_unreachable_nexthops', opt)
value = '1' if (tmp != None) else '0'
- sysctl('net.ipv4.fib_multipath_use_neigh', value)
+ sysctl_write('net.ipv4.fib_multipath_use_neigh', value)
tmp = dict_search('multipath.layer4_hashing', opt)
value = '1' if (tmp != None) else '0'
- sysctl('net.ipv4.fib_multipath_hash_policy', value)
+ sysctl_write('net.ipv4.fib_multipath_hash_policy', value)
if __name__ == '__main__':
try:
diff --git a/src/conf_mode/system-ipv6.py b/src/conf_mode/system-ipv6.py
index 8195beaa6..7fb2dd1cf 100755
--- a/src/conf_mode/system-ipv6.py
+++ b/src/conf_mode/system-ipv6.py
@@ -22,7 +22,7 @@ from vyos.configdict import dict_merge
from vyos.configdict import leaf_node_changed
from vyos.util import call
from vyos.util import dict_search
-from vyos.util import sysctl
+from vyos.util import sysctl_write
from vyos.util import write_file
from vyos.xml import defaults
from vyos import ConfigError
@@ -58,7 +58,7 @@ def apply(opt):
# disable IPv6 globally
tmp = dict_search('disable', opt)
value = '1' if (tmp != None) else '0'
- sysctl('net.ipv6.conf.all.disable_ipv6', value)
+ sysctl_write('net.ipv6.conf.all.disable_ipv6', value)
if 'reboot_required' in opt:
print('Changing IPv6 disable parameter will only take affect\n' \
@@ -67,17 +67,17 @@ def apply(opt):
# configure multipath
tmp = dict_search('multipath.layer4_hashing', opt)
value = '1' if (tmp != None) else '0'
- sysctl('net.ipv6.fib_multipath_hash_policy', value)
+ sysctl_write('net.ipv6.fib_multipath_hash_policy', value)
# Apply ND threshold values
# table_size has a default value - thus the key always exists
size = int(dict_search('neighbor.table_size', opt))
# Amount upon reaching which the records begin to be cleared immediately
- sysctl('net.ipv6.neigh.default.gc_thresh3', size)
+ sysctl_write('net.ipv6.neigh.default.gc_thresh3', size)
# Amount after which the records begin to be cleaned after 5 seconds
- sysctl('net.ipv6.neigh.default.gc_thresh2', size // 2)
+ sysctl_write('net.ipv6.neigh.default.gc_thresh2', size // 2)
# Minimum number of stored records is indicated which is not cleared
- sysctl('net.ipv6.neigh.default.gc_thresh1', size // 8)
+ sysctl_write('net.ipv6.neigh.default.gc_thresh1', size // 8)
# enable/disable IPv6 forwarding
tmp = dict_search('disable_forwarding', opt)
diff --git a/src/conf_mode/vrf.py b/src/conf_mode/vrf.py
index e64f35ab5..dd1739087 100755
--- a/src/conf_mode/vrf.py
+++ b/src/conf_mode/vrf.py
@@ -26,7 +26,7 @@ from vyos.template import render
from vyos.util import call
from vyos.util import cmd
from vyos.util import dict_search
-from vyos.util import sysctl
+from vyos.util import sysctl_write
from vyos import ConfigError
from vyos import airbag
airbag.enable()
@@ -144,8 +144,8 @@ def apply(vrf):
bind_all = '0'
if 'bind-to-all' in vrf:
bind_all = '1'
- sysctl('net.ipv4.tcp_l3mdev_accept', bind_all)
- sysctl('net.ipv4.udp_l3mdev_accept', bind_all)
+ sysctl_write('net.ipv4.tcp_l3mdev_accept', bind_all)
+ sysctl_write('net.ipv4.udp_l3mdev_accept', bind_all)
for tmp in (dict_search('vrf_remove', vrf) or []):
if os.path.isdir(f'/sys/class/net/{tmp}'):