summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorsever-sever <v.gletenko@vyos.io>2020-10-17 09:58:53 +0000
committersever-sever <v.gletenko@vyos.io>2020-10-17 12:52:09 +0000
commit2e436854d91e3adb7ac1bb24c64ec7189eb21bee (patch)
tree63b6552bbb66d61f117eaf47530e9b040ad4cfd2 /python
parentaa844567456504c5026a9c49d5c4cf590c7cf08b (diff)
downloadvyos-1x-2e436854d91e3adb7ac1bb24c64ec7189eb21bee.tar.gz
vyos-1x-2e436854d91e3adb7ac1bb24c64ec7189eb21bee.zip
sysctl-forwarding: T752: Add disable forwarding for ipv4
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/interface.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index d200fc7a8..47ec94bd3 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -147,6 +147,10 @@ class Interface(Control):
'validate': assert_boolean,
'location': '/proc/sys/net/ipv4/conf/{ifname}/arp_ignore',
},
+ 'ipv4_forwarding': {
+ 'validate': assert_boolean,
+ 'location': '/proc/sys/net/ipv4/conf/{ifname}/forwarding',
+ },
'ipv6_accept_ra': {
'validate': lambda ara: assert_range(ara,0,3),
'location': '/proc/sys/net/ipv6/conf/{ifname}/accept_ra',
@@ -461,6 +465,12 @@ class Interface(Control):
"""
return self.set_interface('arp_ignore', arp_ignore)
+ def set_ipv4_forwarding(self, forwarding):
+ """
+ Configure IPv4 forwarding.
+ """
+ return self.set_interface('ipv4_forwarding', forwarding)
+
def set_ipv6_accept_ra(self, accept_ra):
"""
Accept Router Advertisements; autoconfigure using them.
@@ -974,6 +984,11 @@ class Interface(Control):
value = '1' if (tmp != None) else '0'
self.set_proxy_arp_pvlan(value)
+ # IPv4 forwarding
+ tmp = vyos_dict_search('ip.disable_forwarding', config)
+ value = '0' if (tmp != None) else '1'
+ self.set_ipv4_forwarding(value)
+
# IPv6 forwarding
tmp = vyos_dict_search('ipv6.disable_forwarding', config)
value = '0' if (tmp != None) else '1'