summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-01-03 16:26:42 +0100
committerChristian Poessinger <christian@poessinger.com>2020-01-03 16:26:44 +0100
commit410ac0dac8400aae1523a51184726ff7606dc5fd (patch)
tree97d8c2c8cf612033e8d10dd256d72d58e4843e4f /src/conf_mode
parent7bb193ce644ea73e4acaa345c84326cb5e0ef78e (diff)
downloadvyos-1x-410ac0dac8400aae1523a51184726ff7606dc5fd.tar.gz
vyos-1x-410ac0dac8400aae1523a51184726ff7606dc5fd.zip
ifconfig: T1939: provide abstraction for interface "ip" option
Provide an XML/Python abstraction to * ip disable-arp-filter * ip enable-arp-accept * ip enable-arp-announce * ip enable-arp-ignore The old implementation can co-exist until the last interfaces have been migrated.
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/interfaces-bonding.py28
-rwxr-xr-xsrc/conf_mode/interfaces-bridge.py28
-rwxr-xr-xsrc/conf_mode/interfaces-ethernet.py28
-rwxr-xr-xsrc/conf_mode/interfaces-vxlan.py28
-rwxr-xr-xsrc/conf_mode/interfaces-wireless.py29
5 files changed, 141 insertions, 0 deletions
diff --git a/src/conf_mode/interfaces-bonding.py b/src/conf_mode/interfaces-bonding.py
index 6c5362956..c798fd44e 100755
--- a/src/conf_mode/interfaces-bonding.py
+++ b/src/conf_mode/interfaces-bonding.py
@@ -42,6 +42,10 @@ default_config_data = {
'disable_link_detect': 1,
'hash_policy': 'layer2',
'ip_arp_cache_tmo': 30,
+ 'ip_disable_arp_filter': 1,
+ 'ip_enable_arp_accept': 0,
+ 'ip_enable_arp_announce': 0,
+ 'ip_enable_arp_ignore': 0,
'ip_proxy_arp': 0,
'ip_proxy_arp_pvlan': 0,
'intf': '',
@@ -159,6 +163,22 @@ def get_config():
if conf.exists('ip arp-cache-timeout'):
bond['ip_arp_cache_tmo'] = int(conf.return_value('ip arp-cache-timeout'))
+ # ARP filter configuration
+ if conf.exists('ip disable-arp-filter'):
+ bond['ip_disable_arp_filter'] = 0
+
+ # ARP enable accept
+ if conf.exists('ip enable-arp-accept'):
+ bond['ip_enable_arp_accept'] = 1
+
+ # ARP enable announce
+ if conf.exists('ip enable-arp-announce'):
+ bond['ip_enable_arp_announce'] = 1
+
+ # ARP enable ignore
+ if conf.exists('ip enable-arp-ignore'):
+ bond['ip_enable_arp_ignore'] = 1
+
# Enable proxy-arp on this interface
if conf.exists('ip enable-proxy-arp'):
bond['ip_proxy_arp'] = 1
@@ -387,6 +407,14 @@ def apply(bond):
b.set_hash_policy(bond['hash_policy'])
# configure ARP cache timeout in milliseconds
b.set_arp_cache_tmo(bond['ip_arp_cache_tmo'])
+ # configure ARP filter configuration
+ b.set_arp_filter(bond['ip_disable_arp_filter'])
+ # configure ARP accept
+ b.set_arp_accept(bond['ip_enable_arp_accept'])
+ # configure ARP announce
+ b.set_arp_announce(bond['ip_enable_arp_announce'])
+ # configure ARP ignore
+ b.set_arp_ignore(bond['ip_enable_arp_ignore'])
# Enable proxy-arp on this interface
b.set_proxy_arp(bond['ip_proxy_arp'])
# Enable private VLAN proxy ARP on this interface
diff --git a/src/conf_mode/interfaces-bridge.py b/src/conf_mode/interfaces-bridge.py
index d152384f7..a3213f309 100755
--- a/src/conf_mode/interfaces-bridge.py
+++ b/src/conf_mode/interfaces-bridge.py
@@ -41,6 +41,10 @@ default_config_data = {
'disable_link_detect': 1,
'forwarding_delay': 14,
'hello_time': 2,
+ 'ip_disable_arp_filter': 1,
+ 'ip_enable_arp_accept': 0,
+ 'ip_enable_arp_announce': 0,
+ 'ip_enable_arp_ignore': 0,
'igmp_querier': 0,
'intf': '',
'mac' : '',
@@ -130,6 +134,22 @@ def get_config():
if conf.exists('ip arp-cache-timeout'):
bridge['arp_cache_tmo'] = int(conf.return_value('ip arp-cache-timeout'))
+ # ARP filter configuration
+ if conf.exists('ip disable-arp-filter'):
+ bridge['ip_disable_arp_filter'] = 0
+
+ # ARP enable accept
+ if conf.exists('ip enable-arp-accept'):
+ bridge['ip_enable_arp_accept'] = 1
+
+ # ARP enable announce
+ if conf.exists('ip enable-arp-announce'):
+ bridge['ip_enable_arp_announce'] = 1
+
+ # ARP enable ignore
+ if conf.exists('ip enable-arp-ignore'):
+ bridge['ip_enable_arp_ignore'] = 1
+
# Media Access Control (MAC) address
if conf.exists('mac'):
bridge['mac'] = conf.return_value('mac')
@@ -220,6 +240,14 @@ def apply(bridge):
br.set_forward_delay(bridge['forwarding_delay'])
# set hello time
br.set_hello_time(bridge['hello_time'])
+ # configure ARP filter configuration
+ br.set_arp_filter(bridge['ip_disable_arp_filter'])
+ # configure ARP accept
+ br.set_arp_accept(bridge['ip_enable_arp_accept'])
+ # configure ARP announce
+ br.set_arp_announce(bridge['ip_enable_arp_announce'])
+ # configure ARP ignore
+ br.set_arp_ignore(bridge['ip_enable_arp_ignore'])
# set max message age
br.set_max_age(bridge['max_age'])
# set bridge priority
diff --git a/src/conf_mode/interfaces-ethernet.py b/src/conf_mode/interfaces-ethernet.py
index cd75e1257..e4f6e5ff2 100755
--- a/src/conf_mode/interfaces-ethernet.py
+++ b/src/conf_mode/interfaces-ethernet.py
@@ -41,6 +41,10 @@ default_config_data = {
'flow_control': 'on',
'hw_id': '',
'ip_arp_cache_tmo': 30,
+ 'ip_disable_arp_filter': 1,
+ 'ip_enable_arp_accept': 0,
+ 'ip_enable_arp_announce': 0,
+ 'ip_enable_arp_ignore': 0,
'ip_proxy_arp': 0,
'ip_proxy_arp_pvlan': 0,
'intf': '',
@@ -137,6 +141,22 @@ def get_config():
if conf.exists('ip arp-cache-timeout'):
eth['ip_arp_cache_tmo'] = int(conf.return_value('ip arp-cache-timeout'))
+ # ARP filter configuration
+ if conf.exists('ip disable-arp-filter'):
+ eth['ip_disable_arp_filter'] = 0
+
+ # ARP enable accept
+ if conf.exists('ip enable-arp-accept'):
+ eth['ip_enable_arp_accept'] = 1
+
+ # ARP enable announce
+ if conf.exists('ip enable-arp-announce'):
+ eth['ip_enable_arp_announce'] = 1
+
+ # ARP enable ignore
+ if conf.exists('ip enable-arp-ignore'):
+ eth['ip_enable_arp_ignore'] = 1
+
# Enable proxy-arp on this interface
if conf.exists('ip enable-proxy-arp'):
eth['ip_proxy_arp'] = 1
@@ -292,6 +312,14 @@ def apply(eth):
e.set_flow_control(eth['flow_control'])
# configure ARP cache timeout in milliseconds
e.set_arp_cache_tmo(eth['ip_arp_cache_tmo'])
+ # configure ARP filter configuration
+ e.set_arp_filter(eth['ip_disable_arp_filter'])
+ # configure ARP accept
+ e.set_arp_accept(eth['ip_enable_arp_accept'])
+ # configure ARP announce
+ e.set_arp_announce(eth['ip_enable_arp_announce'])
+ # configure ARP ignore
+ e.set_arp_ignore(eth['ip_enable_arp_ignore'])
# Enable proxy-arp on this interface
e.set_proxy_arp(eth['ip_proxy_arp'])
# Enable private VLAN proxy ARP on this interface
diff --git a/src/conf_mode/interfaces-vxlan.py b/src/conf_mode/interfaces-vxlan.py
index c1fedc824..7f1ac6c31 100755
--- a/src/conf_mode/interfaces-vxlan.py
+++ b/src/conf_mode/interfaces-vxlan.py
@@ -32,6 +32,10 @@ default_config_data = {
'group': '',
'intf': '',
'ip_arp_cache_tmo': 30,
+ 'ip_disable_arp_filter': 1,
+ 'ip_enable_arp_accept': 0,
+ 'ip_enable_arp_announce': 0,
+ 'ip_enable_arp_ignore': 0,
'ip_proxy_arp': 0,
'link': '',
'mtu': 1450,
@@ -79,6 +83,22 @@ def get_config():
if conf.exists('ip arp-cache-timeout'):
vxlan['ip_arp_cache_tmo'] = int(conf.return_value('ip arp-cache-timeout'))
+ # ARP filter configuration
+ if conf.exists('ip disable-arp-filter'):
+ vxlan['ip_disable_arp_filter'] = 0
+
+ # ARP enable accept
+ if conf.exists('ip enable-arp-accept'):
+ vxlan['ip_enable_arp_accept'] = 1
+
+ # ARP enable announce
+ if conf.exists('ip enable-arp-announce'):
+ vxlan['ip_enable_arp_announce'] = 1
+
+ # ARP enable ignore
+ if conf.exists('ip enable-arp-ignore'):
+ vxlan['ip_enable_arp_ignore'] = 1
+
# Enable proxy-arp on this interface
if conf.exists('ip enable-proxy-arp'):
vxlan['ip_proxy_arp'] = 1
@@ -168,6 +188,14 @@ def apply(vxlan):
# configure ARP cache timeout in milliseconds
v.set_arp_cache_tmo(vxlan['ip_arp_cache_tmo'])
+ # configure ARP filter configuration
+ v.set_arp_filter(bond['ip_disable_arp_filter'])
+ # configure ARP accept
+ v.set_arp_accept(bond['ip_enable_arp_accept'])
+ # configure ARP announce
+ v.set_arp_announce(bond['ip_enable_arp_announce'])
+ # configure ARP ignore
+ v.set_arp_ignore(bond['ip_enable_arp_ignore'])
# Enable proxy-arp on this interface
v.set_proxy_arp(vxlan['ip_proxy_arp'])
diff --git a/src/conf_mode/interfaces-wireless.py b/src/conf_mode/interfaces-wireless.py
index 0df0b3ba4..162aaf463 100755
--- a/src/conf_mode/interfaces-wireless.py
+++ b/src/conf_mode/interfaces-wireless.py
@@ -816,6 +816,10 @@ default_config_data = {
'hw_id' : '',
'intf': '',
'isolate_stations' : False,
+ 'ip_disable_arp_filter': 1,
+ 'ip_enable_arp_accept': 0,
+ 'ip_enable_arp_announce': 0,
+ 'ip_enable_arp_ignore': 0,
'mac' : '',
'max_stations' : '',
'mgmt_frame_protection' : 'disabled',
@@ -1112,6 +1116,22 @@ def get_config():
if conf.exists('isolate-stations'):
wifi['isolate_stations'] = True
+ # ARP filter configuration
+ if conf.exists('ip disable-arp-filter'):
+ wifi['ip_disable_arp_filter'] = 0
+
+ # ARP enable accept
+ if conf.exists('ip enable-arp-accept'):
+ wifi['ip_enable_arp_accept'] = 1
+
+ # ARP enable announce
+ if conf.exists('ip enable-arp-announce'):
+ wifi['ip_enable_arp_announce'] = 1
+
+ # ARP enable ignore
+ if conf.exists('ip enable-arp-ignore'):
+ wifi['ip_enable_arp_ignore'] = 1
+
# Media Access Control (MAC) address
if conf.exists('mac'):
wifi['mac'] = conf.return_value('mac')
@@ -1373,6 +1393,15 @@ def apply(wifi):
else:
w.set_mac(wifi['hw_id'])
+ # configure ARP filter configuration
+ w.set_arp_filter(wifi['ip_disable_arp_filter'])
+ # configure ARP accept
+ w.set_arp_accept(wifi['ip_enable_arp_accept'])
+ # configure ARP announce
+ w.set_arp_announce(wifi['ip_enable_arp_announce'])
+ # configure ARP ignore
+ w.set_arp_ignore(wifi['ip_enable_arp_ignore'])
+
# enable interface
if not wifi['disable']:
w.set_state('up')