summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-09-24 18:53:05 +0200
committerChristian Poessinger <christian@poessinger.com>2019-09-24 21:53:25 +0200
commit48e5ad611bc63575eb1150024939d04eb62cf400 (patch)
tree2102bb376e06206c08b21a1d23610ded52224b16
parent3cedc3358c6aeb9e6caad4251958fa1a05723ea3 (diff)
downloadvyos-1x-48e5ad611bc63575eb1150024939d04eb62cf400.tar.gz
vyos-1x-48e5ad611bc63575eb1150024939d04eb62cf400.zip
Python/ifconfig: T1557: refactor Interface 'proxy_arp_pvlan' property to set_proxy_arp_pvlan()
-rw-r--r--python/vyos/ifconfig.py36
-rwxr-xr-xsrc/conf_mode/interface-bonding.py2
-rwxr-xr-xsrc/conf_mode/interface-ethernet.py2
3 files changed, 4 insertions, 36 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py
index 86a080602..d32b54199 100644
--- a/python/vyos/ifconfig.py
+++ b/python/vyos/ifconfig.py
@@ -328,8 +328,7 @@ class Interface:
else:
raise ValueError("Value out of range")
- @property
- def proxy_arp_pvlan(self):
+ def set_proxy_arp_pvlan(self, enable):
"""
Private VLAN proxy arp.
Basically allow proxy arp replies back to the same interface
@@ -351,38 +350,7 @@ class Interface:
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'
+ >>> Interface('eth0').set_proxy_arp_pvlan(1)
"""
if int(enable) >= 0 and int(enable) <= 1:
return self._write_sysfs('/proc/sys/net/ipv4/conf/{}/proxy_arp_pvlan'
diff --git a/src/conf_mode/interface-bonding.py b/src/conf_mode/interface-bonding.py
index 2058a3342..0b6ac14a6 100755
--- a/src/conf_mode/interface-bonding.py
+++ b/src/conf_mode/interface-bonding.py
@@ -384,7 +384,7 @@ def apply(bond):
# Enable proxy-arp on this interface
b.set_proxy_arp(bond['ip_proxy_arp'])
# Enable private VLAN proxy ARP on this interface
- b.proxy_arp_pvlan = bond['ip_proxy_arp_pvlan']
+ b.set_proxy_arp_pvlan(bond['ip_proxy_arp_pvlan'])
# Change interface MAC address
if bond['mac']:
diff --git a/src/conf_mode/interface-ethernet.py b/src/conf_mode/interface-ethernet.py
index e15e89232..02a45408f 100755
--- a/src/conf_mode/interface-ethernet.py
+++ b/src/conf_mode/interface-ethernet.py
@@ -286,7 +286,7 @@ def apply(eth):
# Enable proxy-arp on this interface
e.set_proxy_arp(eth['ip_proxy_arp'])
# Enable private VLAN proxy ARP on this interface
- e.proxy_arp_pvlan = eth['ip_proxy_arp_pvlan']
+ e.set_proxy_arp_pvlan(eth['ip_proxy_arp_pvlan'])
# Change interface MAC address - re-set to real hardware address (hw-id)
# if custom mac is removed