summaryrefslogtreecommitdiff
path: root/src/conf_mode/system_ip.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-04-19 22:45:50 +0200
committerChristian Breunig <christian@breunig.cc>2026-04-21 06:13:21 +0200
commit754635c257b1860ce393cdc342c1b7ca7e65da1f (patch)
tree0fbb50cbf62c7ceb09a1a5f4568318ff0314f5c4 /src/conf_mode/system_ip.py
parent1d81dd0c6190d9fd36d01014f3b0a2d4bb91a919 (diff)
downloadvyos-1x-754635c257b1860ce393cdc342c1b7ca7e65da1f.tar.gz
vyos-1x-754635c257b1860ce393cdc342c1b7ca7e65da1f.zip
T8534: refactor sysctl_(read|write) to accept key parts
Interface names can contain dots (e.g. VLAN subinterfaces like eth0.10), which conflicts with sysctl's dot-separated key syntax. Change sysctl_read() and sysctl_write() to take key components as a list and normalize each component by replacing . with / before invoking sysctl. This fixes sysctl lookups/updates for VLAN subinterfaces. Extend the SR-TE smoketest to cover a VLAN subinterface. Previous error raising this issue: vyos-configd: sysctl: cannot stat /proc/sys/net/ipv6/conf/eth0/10/seg6_enabled: No such file or directory vyos-configd: sysctl: cannot stat /proc/sys/net/ipv6/conf/eth0/201/seg6_enabled: No such file or directory
Diffstat (limited to 'src/conf_mode/system_ip.py')
-rwxr-xr-xsrc/conf_mode/system_ip.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/conf_mode/system_ip.py b/src/conf_mode/system_ip.py
index 13471eb3b..6aff982d7 100755
--- a/src/conf_mode/system_ip.py
+++ b/src/conf_mode/system_ip.py
@@ -75,20 +75,20 @@ def apply(config_dict):
# 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_write('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_write('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_write('net.ipv4.neigh.default.gc_thresh1', size // 8)
+ sysctl_write(['net', 'ipv4', 'neigh', 'default', 'gc_thresh1'], size // 8)
# configure multipath
tmp = dict_search('multipath.ignore_unreachable_nexthops', opt)
value = '1' if (tmp != None) else '0'
- sysctl_write('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_write('net.ipv4.fib_multipath_hash_policy', value)
+ sysctl_write(['net', 'ipv4', 'fib_multipath_hash_policy'], value)
# configure TCP options (defaults as of Linux 6.4)
tmp = dict_search('tcp.mss.probing', opt)
@@ -101,15 +101,15 @@ def apply(config_dict):
else:
# Shouldn't happen
raise ValueError("TCP MSS probing is neither 'on-icmp-black-hole' nor 'force'!")
- sysctl_write('net.ipv4.tcp_mtu_probing', value)
+ sysctl_write(['net', 'ipv4', 'tcp_mtu_probing'], value)
tmp = dict_search('tcp.mss.base', opt)
value = '1024' if (tmp is None) else tmp
- sysctl_write('net.ipv4.tcp_base_mss', value)
+ sysctl_write(['net', 'ipv4', 'tcp_base_mss'], value)
tmp = dict_search('tcp.mss.floor', opt)
value = '48' if (tmp is None) else tmp
- sysctl_write('net.ipv4.tcp_mtu_probe_floor', value)
+ sysctl_write(['net', 'ipv4', 'tcp_mtu_probe_floor'], value)
# During startup of vyos-router that brings up FRR, the service is not yet
# running when this script is called first. Skip this part and wait for initial