summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-04 22:00:43 +0200
committerChristian Poessinger <christian@poessinger.com>2020-04-04 22:00:43 +0200
commit0d5be614de4e5211f3e615fcce68d02071ef8688 (patch)
treec61c70f018e1b6fa14dbfd299869f06d185c73bd /src
parent195e1da6a518ee3a2cbc0e1d454317e3c05e3e6e (diff)
downloadvyos-1x-0d5be614de4e5211f3e615fcce68d02071ef8688.tar.gz
vyos-1x-0d5be614de4e5211f3e615fcce68d02071ef8688.zip
vrf: T2221: only set l3mdev when changed
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/vrf.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/conf_mode/vrf.py b/src/conf_mode/vrf.py
index a74b79317..39f9ca978 100755
--- a/src/conf_mode/vrf.py
+++ b/src/conf_mode/vrf.py
@@ -25,6 +25,7 @@ from subprocess import check_output, CalledProcessError
from vyos.config import Config
from vyos.configdict import list_diff
from vyos.ifconfig import Interface
+from vyos.util import read_file
from vyos import ConfigError
config_file = r'/etc/iproute2/rt_tables.d/vyos-vrf.conf'
@@ -43,7 +44,7 @@ config_tmpl = """
"""
default_config_data = {
- 'bind_to_all': 0,
+ 'bind_to_all': '0',
'deleted': False,
'vrf_add': [],
'vrf_existing': [],
@@ -103,7 +104,7 @@ def get_config():
# Should services be allowed to bind to all VRFs?
if conf.exists(['bind-to-all']):
- vrf_config['bind_to_all'] = 1
+ vrf_config['bind_to_all'] = '1'
# Determine vrf interfaces (currently effective) - to determine which
# vrf interface is no longer present and needs to be removed
@@ -210,8 +211,9 @@ def apply(vrf_config):
# set the default VRF global behaviour
bind_all = vrf_config['bind_to_all']
- _cmd(f'sysctl -wq net.ipv4.tcp_l3mdev_accept={bind_all}')
- _cmd(f'sysctl -wq net.ipv4.udp_l3mdev_accept={bind_all}')
+ if read_file('/proc/sys/net/ipv4/tcp_l3mdev_accept') != bind_all:
+ _cmd(f'sysctl -wq net.ipv4.tcp_l3mdev_accept={bind_all}')
+ _cmd(f'sysctl -wq net.ipv4.udp_l3mdev_accept={bind_all}')
for vrf in vrf_config['vrf_remove']:
name = vrf['name']