diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-03-25 19:41:54 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-03-28 11:28:55 +0100 |
commit | adc09e4ecaf91bc93b3994eac4f2f2ac2786a1c7 (patch) | |
tree | 4830099c3d06c695f9e81bb86762433544a7df95 | |
parent | 7f9ce3017ff4bc99c66e4d5ddfd6a9904ca8542c (diff) | |
download | vyos-1x-adc09e4ecaf91bc93b3994eac4f2f2ac2786a1c7.tar.gz vyos-1x-adc09e4ecaf91bc93b3994eac4f2f2ac2786a1c7.zip |
ipv6: T1831: use integers over bool in interface configuration
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | python/vyos/configdict.py | 8 | ||||
-rw-r--r-- | python/vyos/ifconfig/interface.py | 6 | ||||
-rw-r--r-- | python/vyos/ifconfig_vlan.py | 4 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-bonding.py | 8 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-bridge.py | 8 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-ethernet.py | 8 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-l2tpv3.py | 8 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-openvpn.py | 8 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-pseudo-ethernet.py | 8 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-vxlan.py | 8 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-wireless.py | 12 |
12 files changed, 46 insertions, 43 deletions
@@ -51,6 +51,8 @@ interface_definitions: $(BUILD_DIR) $(obj) rm -f $(TMPL_DIR)/interfaces/ethernet/node.tag/vif-s/node.tag/ipv6/node.def rm -f $(TMPL_DIR)/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/ip/node.def rm -f $(TMPL_DIR)/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/ipv6/node.def + rm -f $(TMPL_DIR)/interfaces/l2tpv3/node.tag/ipv6/node.def + rm -f $(TMPL_DIR)/interfaces/openvpn/node.tag/ipv6/node.def rm -f $(TMPL_DIR)/interfaces/pppoe/node.tag/ip/node.def rm -f $(TMPL_DIR)/interfaces/pppoe/node.tag/ipv6/node.def rm -f $(TMPL_DIR)/interfaces/pseudo-ethernet/node.tag/ip/node.def @@ -61,6 +63,7 @@ interface_definitions: $(BUILD_DIR) $(obj) rm -f $(TMPL_DIR)/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/ipv6/node.def rm -f $(TMPL_DIR)/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/ip/node.def rm -f $(TMPL_DIR)/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/ipv6/node.def + rm -f $(TMPL_DIR)/interfaces/tunnel/node.tag/ipv6/node.def rm -f $(TMPL_DIR)/interfaces/vxlan/node.tag/ip/node.def rm -f $(TMPL_DIR)/interfaces/vxlan/node.tag/ipv6/node.def rm -f $(TMPL_DIR)/interfaces/wireless/node.tag/ip/node.def diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py index 705fecd9b..b0214ded4 100644 --- a/python/vyos/configdict.py +++ b/python/vyos/configdict.py @@ -123,8 +123,8 @@ def vlan_to_dict(conf): 'ip_enable_arp_accept': 0, 'ip_enable_arp_announce': 0, 'ip_enable_arp_ignore': 0, - 'ipv6_forwarding': True, - 'ipv6_dup_addr_detect': '1', + 'ipv6_forwarding': 1, + 'ipv6_dup_addr_detect': 1, 'ingress_qos': '', 'ingress_qos_changed': False, 'mac': '', @@ -191,11 +191,11 @@ def vlan_to_dict(conf): # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): - vlan['ipv6_forwarding'] = False + vlan['ipv6_forwarding'] = 0 # IPv6 Duplicate Address Detection (DAD) tries if conf.exists('ipv6 dup-addr-detect-transmits'): - vlan['ipv6_dup_addr_detect'] = conf.return_value('dup-addr-detect-transmits') + vlan['ipv6_dup_addr_detect'] = int(conf.return_value('ipv6 dup-addr-detect-transmits')) # Media Access Control (MAC) address if conf.exists('mac'): diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py index ae0b652b0..da6b54e69 100644 --- a/python/vyos/ifconfig/interface.py +++ b/python/vyos/ifconfig/interface.py @@ -116,11 +116,11 @@ class Interface(DHCP): 'location': '/proc/sys/net/ipv4/conf/{ifname}/arp_ignore', }, 'ipv6_forwarding': { - 'validate': assert_boolean, + 'validate': lambda fwd: assert_range(fwd,0,2), 'location': '/proc/sys/net/ipv6/conf/{ifname}/forwarding', }, 'ipv6_dad_transmits': { - 'validate': assert_boolean, + 'validate': assert_positive, 'location': '/proc/sys/net/ipv6/conf/{ifname}/dad_transmits', }, 'proxy_arp': { @@ -409,7 +409,7 @@ class Interface(DHCP): """ return self.set_interface('ipv6_forwarding', forwarding) - def set_dad_messages(self, dad): + def set_ipv6_dad_messages(self, dad): """ The amount of Duplicate Address Detection probes to send. Default: 1 diff --git a/python/vyos/ifconfig_vlan.py b/python/vyos/ifconfig_vlan.py index 11143f0bf..b3c5f3b76 100644 --- a/python/vyos/ifconfig_vlan.py +++ b/python/vyos/ifconfig_vlan.py @@ -65,9 +65,9 @@ def apply_vlan_config(vlan, config): # configure ARP ignore vlan.set_arp_ignore(config['ip_enable_arp_ignore']) # Disable IPv6 forwarding on this interface - vlan.ipv6_forwarding(bond['ipv6_forwarding']) + vlan.set_ipv6_forwarding(config['ipv6_forwarding']) # IPv6 Duplicate Address Detection (DAD) tries - vlan.ipv6_dad_messages(bond['ipv6_dup_addr_detect']) + vlan.set_ipv6_dad_messages(config['ipv6_dup_addr_detect']) # Maximum Transmission Unit (MTU) vlan.set_mtu(config['mtu']) diff --git a/src/conf_mode/interfaces-bonding.py b/src/conf_mode/interfaces-bonding.py index 9349241bd..a570371ab 100755 --- a/src/conf_mode/interfaces-bonding.py +++ b/src/conf_mode/interfaces-bonding.py @@ -48,8 +48,8 @@ default_config_data = { 'ip_enable_arp_ignore': 0, 'ip_proxy_arp': 0, 'ip_proxy_arp_pvlan': 0, - 'ipv6_forwarding': True, - 'ipv6_dup_addr_detect': '1', + 'ipv6_forwarding': 1, + 'ipv6_dup_addr_detect': 1, 'intf': '', 'mac': '', 'mode': '802.3ad', @@ -193,11 +193,11 @@ def get_config(): # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): - bond['ipv6_forwarding'] = False + bond['ipv6_forwarding'] = 0 # IPv6 Duplicate Address Detection (DAD) tries if conf.exists('ipv6 dup-addr-detect-transmits'): - bond['ipv6_dup_addr_detect'] = conf.return_value('dup-addr-detect-transmits') + bond['ipv6_dup_addr_detect'] = int(conf.return_value('ipv6 dup-addr-detect-transmits')) # Media Access Control (MAC) address if conf.exists('mac'): diff --git a/src/conf_mode/interfaces-bridge.py b/src/conf_mode/interfaces-bridge.py index 79b5e85e7..af669bc0e 100755 --- a/src/conf_mode/interfaces-bridge.py +++ b/src/conf_mode/interfaces-bridge.py @@ -46,8 +46,8 @@ default_config_data = { 'ip_enable_arp_accept': 0, 'ip_enable_arp_announce': 0, 'ip_enable_arp_ignore': 0, - 'ipv6_forwarding': True, - 'ipv6_dup_addr_detect': '1', + 'ipv6_forwarding': 1, + 'ipv6_dup_addr_detect': 1, 'igmp_querier': 0, 'intf': '', 'mac' : '', @@ -156,11 +156,11 @@ def get_config(): # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): - bridge['ipv6_forwarding'] = False + bridge['ipv6_forwarding'] = 0 # IPv6 Duplicate Address Detection (DAD) tries if conf.exists('ipv6 dup-addr-detect-transmits'): - bridge['ipv6_dup_addr_detect'] = conf.return_value('dup-addr-detect-transmits') + bridge['ipv6_dup_addr_detect'] = int(conf.return_value('ipv6 dup-addr-detect-transmits')) # Media Access Control (MAC) address if conf.exists('mac'): diff --git a/src/conf_mode/interfaces-ethernet.py b/src/conf_mode/interfaces-ethernet.py index 84e7d1c44..e2017173a 100755 --- a/src/conf_mode/interfaces-ethernet.py +++ b/src/conf_mode/interfaces-ethernet.py @@ -48,8 +48,8 @@ default_config_data = { 'ip_enable_arp_ignore': 0, 'ip_proxy_arp': 0, 'ip_proxy_arp_pvlan': 0, - 'ipv6_forwarding': True, - 'ipv6_dup_addr_detect': '1', + 'ipv6_forwarding': 1, + 'ipv6_dup_addr_detect': 1, 'intf': '', 'mac': '', 'mtu': 1500, @@ -171,11 +171,11 @@ def get_config(): # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): - eth['ipv6_forwarding'] = False + eth['ipv6_forwarding'] = 0 # IPv6 Duplicate Address Detection (DAD) tries if conf.exists('ipv6 dup-addr-detect-transmits'): - eth['ipv6_dup_addr_detect'] = conf.return_value('dup-addr-detect-transmits') + eth['ipv6_dup_addr_detect'] = int(conf.return_value('ipv6 dup-addr-detect-transmits')) # Media Access Control (MAC) address if conf.exists('mac'): diff --git a/src/conf_mode/interfaces-l2tpv3.py b/src/conf_mode/interfaces-l2tpv3.py index 5334472d3..d0c610625 100755 --- a/src/conf_mode/interfaces-l2tpv3.py +++ b/src/conf_mode/interfaces-l2tpv3.py @@ -33,8 +33,8 @@ default_config_data = { 'local_address': '', 'local_port': 5000, 'intf': '', - 'ipv6_forwarding': True, - 'ipv6_dup_addr_detect': '1', + 'ipv6_forwarding': 1, + 'ipv6_dup_addr_detect': 1, 'mtu': 1488, 'peer_session_id': '', 'peer_tunnel_id': '', @@ -105,11 +105,11 @@ def get_config(): # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): - l2tpv3['ipv6_forwarding'] = False + l2tpv3['ipv6_forwarding'] = 0 # IPv6 Duplicate Address Detection (DAD) tries if conf.exists('ipv6 dup-addr-detect-transmits'): - l2tpv3['ipv6_dup_addr_detect'] = conf.return_value('dup-addr-detect-transmits') + l2tpv3['ipv6_dup_addr_detect'] = int(conf.return_value('ipv6 dup-addr-detect-transmits')) # Maximum Transmission Unit (MTU) if conf.exists('mtu'): diff --git a/src/conf_mode/interfaces-openvpn.py b/src/conf_mode/interfaces-openvpn.py index 84de67e46..143bf9ae9 100755 --- a/src/conf_mode/interfaces-openvpn.py +++ b/src/conf_mode/interfaces-openvpn.py @@ -294,8 +294,8 @@ default_config_data = { 'encryption': '', 'hash': '', 'intf': '', - 'ipv6_forwarding': True, - 'ipv6_dup_addr_detect': '1', + 'ipv6_forwarding': 1, + 'ipv6_dup_addr_detect': 1, 'ping_restart': '60', 'ping_interval': '10', 'local_address': '', @@ -494,11 +494,11 @@ def get_config(): # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): - openvpn['ipv6_forwarding'] = False + openvpn['ipv6_forwarding'] = 0 # IPv6 Duplicate Address Detection (DAD) tries if conf.exists('ipv6 dup-addr-detect-transmits'): - openvpn['ipv6_dup_addr_detect'] = conf.return_value('dup-addr-detect-transmits') + openvpn['ipv6_dup_addr_detect'] = int(conf.return_value('ipv6 dup-addr-detect-transmits')) # OpenVPN operation mode if conf.exists('mode'): diff --git a/src/conf_mode/interfaces-pseudo-ethernet.py b/src/conf_mode/interfaces-pseudo-ethernet.py index 19c8bbedc..14b868b0a 100755 --- a/src/conf_mode/interfaces-pseudo-ethernet.py +++ b/src/conf_mode/interfaces-pseudo-ethernet.py @@ -45,8 +45,8 @@ default_config_data = { 'ip_enable_arp_ignore': 0, 'ip_proxy_arp': 0, 'ip_proxy_arp_pvlan': 0, - 'ipv6_forwarding': True, - 'ipv6_dup_addr_detect': '1', + 'ipv6_forwarding': 1, + 'ipv6_dup_addr_detect': 1, 'intf': '', 'link': '', 'link_changed': False, @@ -149,11 +149,11 @@ def get_config(): # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): - peth['ipv6_forwarding'] = False + peth['ipv6_forwarding'] = 0 # IPv6 Duplicate Address Detection (DAD) tries if conf.exists('ipv6 dup-addr-detect-transmits'): - peth['ipv6_dup_addr_detect'] = conf.return_value('dup-addr-detect-transmits') + peth['ipv6_dup_addr_detect'] = int(conf.return_value('ipv6 dup-addr-detect-transmits')) # Lower link device if conf.exists(['link']): diff --git a/src/conf_mode/interfaces-vxlan.py b/src/conf_mode/interfaces-vxlan.py index 48271ff65..e1d31369e 100755 --- a/src/conf_mode/interfaces-vxlan.py +++ b/src/conf_mode/interfaces-vxlan.py @@ -37,8 +37,8 @@ default_config_data = { 'ip_enable_arp_announce': 0, 'ip_enable_arp_ignore': 0, 'ip_proxy_arp': 0, - 'ipv6_forwarding': True, - 'ipv6_dup_addr_detect': '1', + 'ipv6_forwarding': 1, + 'ipv6_dup_addr_detect': 1, 'link': '', 'mtu': 1450, 'remote': '', @@ -107,11 +107,11 @@ def get_config(): # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): - vxlan['ipv6_forwarding'] = False + vxlan['ipv6_forwarding'] = 0 # IPv6 Duplicate Address Detection (DAD) tries if conf.exists('ipv6 dup-addr-detect-transmits'): - vxlan['ipv6_dup_addr_detect'] = conf.return_value('dup-addr-detect-transmits') + vxlan['ipv6_dup_addr_detect'] = int(conf.return_value('ipv6 dup-addr-detect-transmits')) # VXLAN underlay interface if conf.exists('link'): diff --git a/src/conf_mode/interfaces-wireless.py b/src/conf_mode/interfaces-wireless.py index 29257141d..2d0b2ade7 100755 --- a/src/conf_mode/interfaces-wireless.py +++ b/src/conf_mode/interfaces-wireless.py @@ -827,8 +827,8 @@ default_config_data = { 'ip_enable_arp_accept': 0, 'ip_enable_arp_announce': 0, 'ip_enable_arp_ignore': 0, - 'ipv6_forwarding': True, - 'ipv6_dup_addr_detect': '1', + 'ipv6_forwarding': 1, + 'ipv6_dup_addr_detect': 1, 'mac' : '', 'max_stations' : '', 'mgmt_frame_protection' : 'disabled', @@ -1144,11 +1144,11 @@ def get_config(): # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): - wifi['ipv6_forwarding'] = False + wifi['ipv6_forwarding'] = 0 # IPv6 Duplicate Address Detection (DAD) tries if conf.exists('ipv6 dup-addr-detect-transmits'): - wifi['ipv6_dup_addr_detect'] = conf.return_value('dup-addr-detect-transmits') + wifi['ipv6_dup_addr_detect'] = int(conf.return_value('ipv6 dup-addr-detect-transmits')) # Wireless physical device if conf.exists('physical-device'): @@ -1498,9 +1498,9 @@ def apply(wifi): # configure ARP ignore w.set_arp_ignore(wifi['ip_enable_arp_ignore']) # Disable IPv6 forwarding on this interface - w.set_ipv6_forwarding(bond['ipv6_forwarding']) + w.set_ipv6_forwarding(wifi['ipv6_forwarding']) # IPv6 Duplicate Address Detection (DAD) tries - w.set_ipv6_dad_messages(bond['ipv6_dup_addr_detect']) + w.set_ipv6_dad_messages(wifi['ipv6_dup_addr_detect']) # Configure interface address(es) # - not longer required addresses get removed first |