summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/vyos/ifconfig.py')
-rw-r--r--python/vyos/ifconfig.py105
1 files changed, 101 insertions, 4 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py
index cdbebed49..71d608511 100644
--- a/python/vyos/ifconfig.py
+++ b/python/vyos/ifconfig.py
@@ -284,7 +284,8 @@ class Interface:
>>> Interface('eth0').link_detect = '1'
"""
if link_filter >= 0 and link_filter <= 2:
- return self._write_sysfs('/proc/sys/net/ipv4/conf/{0}/link_filter'.format(self._ifname), link_filter)
+ return self._write_sysfs('/proc/sys/net/ipv4/conf/{0}/link_filter'
+ .format(self._ifname), link_filter)
else:
raise ValueError()
@@ -300,7 +301,8 @@ class Interface:
>>> Interface('eth0').ifalias
''
"""
- return self._read_sysfs('/sys/class/net/{0}/ifalias'.format(self._ifname))
+ return self._read_sysfs('/sys/class/net/{0}/ifalias'
+ .format(self._ifname))
@ifalias.setter
@@ -324,7 +326,8 @@ class Interface:
# clear interface alias
ifalias = '\0'
- self._write_sysfs('/sys/class/net/{0}/ifalias'.format(self._ifname), ifalias)
+ self._write_sysfs('/sys/class/net/{0}/ifalias'
+ .format(self._ifname), ifalias)
@property
@@ -337,7 +340,8 @@ class Interface:
>>> Interface('eth0').state
'up'
"""
- return self._read_sysfs('/sys/class/net/{0}/operstate'.format(self._ifname))
+ return self._read_sysfs('/sys/class/net/{0}/operstate'
+ .format(self._ifname))
@state.setter
@@ -359,6 +363,99 @@ class Interface:
cmd = 'ip link set dev "{}" "{}"'.format(self._ifname, state)
self._cmd(cmd)
+ @property
+ def proxy_arp(self):
+ """
+ Get current proxy ARP configuration from sysfs. Default: 0
+
+ Example:
+ >>> from vyos.ifconfig import Interface
+ >>> Interface('eth0').proxy_arp
+ '0'
+ """
+ return self._read_sysfs('/proc/sys/net/ipv4/conf/{}/proxy_arp'
+ .format(self._ifname))
+
+ @proxy_arp.setter
+ def proxy_arp(self, enable):
+ """
+ Set per interface proxy ARP configuration
+
+ Example:
+ >>> from vyos.ifconfig import Interface
+ >>> Interface('eth0').proxy_arp = 1
+ >>> Interface('eth0').proxy_arp
+ '1'
+ """
+ if int(enable) >= 0 and int(enable) <= 1:
+ return self._write_sysfs('/proc/sys/net/ipv4/conf/{}/proxy_arp'
+ .format(self._ifname), enable)
+ else:
+ raise ValueError("Value out of range")
+
+
+ @property
+ def proxy_arp_pvlan(self):
+ """
+ Private VLAN proxy arp.
+ Basically allow proxy arp replies back to the same interface
+ (from which the ARP request/solicitation was received).
+
+ This is done to support (ethernet) switch features, like RFC
+ 3069, where the individual ports are NOT allowed to
+ communicate with each other, but they are allowed to talk to
+ the upstream router. As described in RFC 3069, it is possible
+ to allow these hosts to communicate through the upstream
+ router by proxy_arp'ing. Don't need to be used together with
+ proxy_arp.
+
+ This technology is known by different names:
+ In RFC 3069 it is called VLAN Aggregation.
+ Cisco and Allied Telesyn call it Private VLAN.
+ Hewlett-Packard call it Source-Port filtering or port-isolation.
+ Ericsson call it MAC-Forced Forwarding (RFC Draft).
+
+ Example:
+ >>> from vyos.ifconfig import Interface
+ >>> Interface('eth0').proxy_arp_pvlan
+ '0'
+ """
+ return self._read_sysfs('/proc/sys/net/ipv4/conf/{}/proxy_arp_pvlan'
+ .format(self._ifname))
+
+ @proxy_arp_pvlan.setter
+ def proxy_arp_pvlan(self, enable):
+ """
+ Private VLAN proxy arp.
+ Basically allow proxy arp replies back to the same interface
+ (from which the ARP request/solicitation was received).
+
+ This is done to support (ethernet) switch features, like RFC
+ 3069, where the individual ports are NOT allowed to
+ communicate with each other, but they are allowed to talk to
+ the upstream router. As described in RFC 3069, it is possible
+ to allow these hosts to communicate through the upstream
+ router by proxy_arp'ing. Don't need to be used together with
+ proxy_arp.
+
+ This technology is known by different names:
+ In RFC 3069 it is called VLAN Aggregation.
+ Cisco and Allied Telesyn call it Private VLAN.
+ Hewlett-Packard call it Source-Port filtering or port-isolation.
+ Ericsson call it MAC-Forced Forwarding (RFC Draft).
+
+ Example:
+ >>> from vyos.ifconfig import Interface
+ >>> Interface('eth0').proxy_arp_pvlan = 1
+ >>> Interface('eth0').proxy_arp_pvlan
+ '1'
+ """
+ if int(enable) >= 0 and int(enable) <= 1:
+ return self._write_sysfs('/proc/sys/net/ipv4/conf/{}/proxy_arp_pvlan'
+ .format(self._ifname), enable)
+ else:
+ raise ValueError("Value out of range")
+
def get_addr(self):
"""