From 0b6eb4f601dd9717b478ff38e8d4ab4fcd878b15 Mon Sep 17 00:00:00 2001 From: Jernej Jakob Date: Wed, 22 Apr 2020 17:08:44 +0200 Subject: interfaces: T2362: split set_ipv6_eui64_address into add and del functions --- src/conf_mode/interfaces-vxlan.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/conf_mode/interfaces-vxlan.py') diff --git a/src/conf_mode/interfaces-vxlan.py b/src/conf_mode/interfaces-vxlan.py index d238ddb57..5ed19ddf2 100755 --- a/src/conf_mode/interfaces-vxlan.py +++ b/src/conf_mode/interfaces-vxlan.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2019 VyOS maintainers and contributors +# Copyright (C) 2019-2020 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as @@ -39,7 +39,7 @@ default_config_data = { 'ip_enable_arp_ignore': 0, 'ip_proxy_arp': 0, 'ipv6_autoconf': 0, - 'ipv6_eui64_prefix': '', + 'ipv6_eui64_prefix': [], 'ipv6_forwarding': 1, 'ipv6_dup_addr_detect': 1, 'is_bridge_member': False, @@ -118,7 +118,7 @@ def get_config(): # Get prefix for IPv6 addressing based on MAC address (EUI-64) if conf.exists('ipv6 address eui64'): - vxlan['ipv6_eui64_prefix'] = conf.return_value('ipv6 address eui64') + vxlan['ipv6_eui64_prefix'].append(conf.return_value('ipv6 address eui64')) # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): @@ -238,8 +238,6 @@ def apply(vxlan): v.set_proxy_arp(vxlan['ip_proxy_arp']) # IPv6 address autoconfiguration v.set_ipv6_autoconf(vxlan['ipv6_autoconf']) - # IPv6 EUI-based address - v.set_ipv6_eui64_address(vxlan['ipv6_eui64_prefix']) # IPv6 forwarding v.set_ipv6_forwarding(vxlan['ipv6_forwarding']) # IPv6 Duplicate Address Detection (DAD) tries @@ -251,6 +249,10 @@ def apply(vxlan): for addr in vxlan['address']: v.add_addr(addr) + # IPv6 EUI-based addresses + for addr in vxlan['ipv6_eui64_prefix']: + v.add_ipv6_eui64_address(addr) + # As the VXLAN interface is always disabled first when changing # parameters we will only re-enable the interface if it is not # administratively disabled -- cgit v1.2.3 From 76feb7d154a452ba5475b9b6ee720a7a8f5491d5 Mon Sep 17 00:00:00 2001 From: Jernej Jakob Date: Wed, 22 Apr 2020 17:11:14 +0200 Subject: interfaces: T2362: add default IPv6 link-local address to make IPv6 work --- python/vyos/configdict.py | 3 +++ src/conf_mode/interfaces-bonding.py | 3 +++ src/conf_mode/interfaces-bridge.py | 3 +++ src/conf_mode/interfaces-ethernet.py | 3 +++ src/conf_mode/interfaces-l2tpv3.py | 3 +++ src/conf_mode/interfaces-openvpn.py | 3 +++ src/conf_mode/interfaces-pseudo-ethernet.py | 3 +++ src/conf_mode/interfaces-vxlan.py | 3 +++ src/conf_mode/interfaces-wireless.py | 3 +++ 9 files changed, 27 insertions(+) (limited to 'src/conf_mode/interfaces-vxlan.py') diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py index 0d315f146..611f7dd6e 100644 --- a/python/vyos/configdict.py +++ b/python/vyos/configdict.py @@ -211,6 +211,9 @@ def vlan_to_dict(conf): if eff_addr and eff_addr not in vlan['ipv6_eui64_prefix']: vlan['ipv6_eui64_prefix_remove'].append(eff_addr) + # add the link-local by default to make IPv6 work + vlan['ipv6_eui64_prefix'].append('fe80::/64') + # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): vlan['ipv6_forwarding'] = 0 diff --git a/src/conf_mode/interfaces-bonding.py b/src/conf_mode/interfaces-bonding.py index 267a78870..0ce376a16 100755 --- a/src/conf_mode/interfaces-bonding.py +++ b/src/conf_mode/interfaces-bonding.py @@ -213,6 +213,9 @@ def get_config(): if eff_addr and eff_addr not in bond['ipv6_eui64_prefix']: bond['ipv6_eui64_prefix_remove'].append(eff_addr) + # add the link-local by default to make IPv6 work + bond['ipv6_eui64_prefix'].append('fe80::/64') + # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): bond['ipv6_forwarding'] = 0 diff --git a/src/conf_mode/interfaces-bridge.py b/src/conf_mode/interfaces-bridge.py index 8826c6996..ba459f871 100755 --- a/src/conf_mode/interfaces-bridge.py +++ b/src/conf_mode/interfaces-bridge.py @@ -171,6 +171,9 @@ def get_config(): if eff_addr and eff_addr not in bridge['ipv6_eui64_prefix']: bridge['ipv6_eui64_prefix_remove'].append(eff_addr) + # add the link-local by default to make IPv6 work + bridge['ipv6_eui64_prefix'].append('fe80::/64') + # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): bridge['ipv6_forwarding'] = 0 diff --git a/src/conf_mode/interfaces-ethernet.py b/src/conf_mode/interfaces-ethernet.py index 7f4762e84..01a805e8b 100755 --- a/src/conf_mode/interfaces-ethernet.py +++ b/src/conf_mode/interfaces-ethernet.py @@ -186,6 +186,9 @@ def get_config(): if eff_addr and eff_addr not in eth['ipv6_eui64_prefix']: eth['ipv6_eui64_prefix_remove'].append(eff_addr) + # add the link-local by default to make IPv6 work + eth['ipv6_eui64_prefix'].append('fe80::/64') + # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): eth['ipv6_forwarding'] = 0 diff --git a/src/conf_mode/interfaces-l2tpv3.py b/src/conf_mode/interfaces-l2tpv3.py index 3698f3e12..45b618148 100755 --- a/src/conf_mode/interfaces-l2tpv3.py +++ b/src/conf_mode/interfaces-l2tpv3.py @@ -117,6 +117,9 @@ def get_config(): if conf.exists('ipv6 address eui64'): l2tpv3['ipv6_eui64_prefix'].append(conf.return_value('ipv6 address eui64')) + # add the link-local by default to make IPv6 work + l2tpv3['ipv6_eui64_prefix'].append('fe80::/64') + # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): l2tpv3['ipv6_forwarding'] = 0 diff --git a/src/conf_mode/interfaces-openvpn.py b/src/conf_mode/interfaces-openvpn.py index 99eb8d6ca..469793910 100755 --- a/src/conf_mode/interfaces-openvpn.py +++ b/src/conf_mode/interfaces-openvpn.py @@ -325,6 +325,9 @@ def get_config(): if eff_addr and eff_addr not in openvpn['ipv6_eui64_prefix']: openvpn['ipv6_eui64_prefix_remove'].append(eff_addr) + # add the link-local by default to make IPv6 work + openvpn['ipv6_eui64_prefix'].append('fe80::/64') + # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): openvpn['ipv6_forwarding'] = 0 diff --git a/src/conf_mode/interfaces-pseudo-ethernet.py b/src/conf_mode/interfaces-pseudo-ethernet.py index 6f194f814..d7863512e 100755 --- a/src/conf_mode/interfaces-pseudo-ethernet.py +++ b/src/conf_mode/interfaces-pseudo-ethernet.py @@ -168,6 +168,9 @@ def get_config(): if eff_addr and eff_addr not in peth['ipv6_eui64_prefix']: peth['ipv6_eui64_prefix_remove'].append(eff_addr) + # add the link-local by default to make IPv6 work + peth['ipv6_eui64_prefix'].append('fe80::/64') + # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): peth['ipv6_forwarding'] = 0 diff --git a/src/conf_mode/interfaces-vxlan.py b/src/conf_mode/interfaces-vxlan.py index 5ed19ddf2..69dbe32d8 100755 --- a/src/conf_mode/interfaces-vxlan.py +++ b/src/conf_mode/interfaces-vxlan.py @@ -120,6 +120,9 @@ def get_config(): if conf.exists('ipv6 address eui64'): vxlan['ipv6_eui64_prefix'].append(conf.return_value('ipv6 address eui64')) + # add the link-local by default to make IPv6 work + vxlan['ipv6_eui64_prefix'].append('fe80::/64') + # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): vxlan['ipv6_forwarding'] = 0 diff --git a/src/conf_mode/interfaces-wireless.py b/src/conf_mode/interfaces-wireless.py index 8f893fa8a..e7c14e3fb 100755 --- a/src/conf_mode/interfaces-wireless.py +++ b/src/conf_mode/interfaces-wireless.py @@ -379,6 +379,9 @@ def get_config(): if eff_addr and eff_addr not in wifi['ipv6_eui64_prefix']: wifi['ipv6_eui64_prefix_remove'].append(eff_addr) + # add the link-local by default to make IPv6 work + wifi['ipv6_eui64_prefix'].append('fe80::/64') + # ARP enable ignore if conf.exists('ip enable-arp-ignore'): wifi['ip_enable_arp_ignore'] = 1 -- cgit v1.2.3 From 4940bea4f7b8574d30876fd3d0456e75f6f29877 Mon Sep 17 00:00:00 2001 From: Jernej Jakob Date: Wed, 22 Apr 2020 12:39:22 +0200 Subject: interfaces: T2362: allow setting multiple 'ipv6 address eui64' --- interface-definitions/include/ipv6-address.xml.i | 5 +++-- python/vyos/configdict.py | 11 +++++------ src/conf_mode/interfaces-bonding.py | 11 +++++------ src/conf_mode/interfaces-bridge.py | 11 +++++------ src/conf_mode/interfaces-ethernet.py | 11 +++++------ src/conf_mode/interfaces-l2tpv3.py | 4 ++-- src/conf_mode/interfaces-openvpn.py | 12 ++++++------ src/conf_mode/interfaces-pseudo-ethernet.py | 11 +++++------ src/conf_mode/interfaces-vxlan.py | 4 ++-- src/conf_mode/interfaces-wireless.py | 11 +++++------ 10 files changed, 43 insertions(+), 48 deletions(-) (limited to 'src/conf_mode/interfaces-vxlan.py') diff --git a/interface-definitions/include/ipv6-address.xml.i b/interface-definitions/include/ipv6-address.xml.i index 507d5dcc1..ffc6ef933 100644 --- a/interface-definitions/include/ipv6-address.xml.i +++ b/interface-definitions/include/ipv6-address.xml.i @@ -8,14 +8,15 @@ - ssign IPv6 address using EUI-64 based on MAC address + Prefix for IPv6 address with MAC-based EUI-64 ipv6net - IPv6 address and prefix length + IPv6 network and prefix length + diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py index 71c85b36d..9ea89194f 100644 --- a/python/vyos/configdict.py +++ b/python/vyos/configdict.py @@ -201,15 +201,14 @@ def vlan_to_dict(conf): if conf.exists('ipv6 address autoconf'): vlan['ipv6_autoconf'] = 1 - # Get prefix for IPv6 addressing based on MAC address (EUI-64) + # Get prefixes for IPv6 addressing based on MAC address (EUI-64) if conf.exists('ipv6 address eui64'): - vlan['ipv6_eui64_prefix'].append(conf.return_value('ipv6 address eui64')) + vlan['ipv6_eui64_prefix'] = conf.return_values('ipv6 address eui64') - # Determine currently effective EUI64 address - to determine which + # Determine currently effective EUI64 addresses - to determine which # address is no longer valid and needs to be removed - eff_addr = conf.return_effective_value('ipv6 address eui64') - if eff_addr and eff_addr not in vlan['ipv6_eui64_prefix']: - vlan['ipv6_eui64_prefix_remove'].append(eff_addr) + eff_addr = conf.return_effective_values('ipv6 address eui64') + vlan['ipv6_eui64_prefix_remove'] = list_diff(eff_addr, vlan['ipv6_eui64_prefix']) # add the link-local by default to make IPv6 work vlan['ipv6_eui64_prefix'].append('fe80::/64') diff --git a/src/conf_mode/interfaces-bonding.py b/src/conf_mode/interfaces-bonding.py index 001da081c..6693f3a13 100755 --- a/src/conf_mode/interfaces-bonding.py +++ b/src/conf_mode/interfaces-bonding.py @@ -203,15 +203,14 @@ def get_config(): if conf.exists('ipv6 address autoconf'): bond['ipv6_autoconf'] = 1 - # Get prefix for IPv6 addressing based on MAC address (EUI-64) + # Get prefixes for IPv6 addressing based on MAC address (EUI-64) if conf.exists('ipv6 address eui64'): - bond['ipv6_eui64_prefix'].append(conf.return_value('ipv6 address eui64')) + bond['ipv6_eui64_prefix'] = conf.return_values('ipv6 address eui64') - # Determine currently effective EUI64 address - to determine which + # Determine currently effective EUI64 addresses - to determine which # address is no longer valid and needs to be removed - eff_addr = conf.return_effective_value('ipv6 address eui64') - if eff_addr and eff_addr not in bond['ipv6_eui64_prefix']: - bond['ipv6_eui64_prefix_remove'].append(eff_addr) + eff_addr = conf.return_effective_values('ipv6 address eui64') + bond['ipv6_eui64_prefix_remove'] = list_diff(eff_addr, bond['ipv6_eui64_prefix']) # add the link-local by default to make IPv6 work bond['ipv6_eui64_prefix'].append('fe80::/64') diff --git a/src/conf_mode/interfaces-bridge.py b/src/conf_mode/interfaces-bridge.py index 2ad5ecf2b..d4470ef26 100755 --- a/src/conf_mode/interfaces-bridge.py +++ b/src/conf_mode/interfaces-bridge.py @@ -161,15 +161,14 @@ def get_config(): if conf.exists('ipv6 address autoconf'): bridge['ipv6_autoconf'] = 1 - # Get prefix for IPv6 addressing based on MAC address (EUI-64) + # Get prefixes for IPv6 addressing based on MAC address (EUI-64) if conf.exists('ipv6 address eui64'): - bridge['ipv6_eui64_prefix'].append(conf.return_value('ipv6 address eui64')) + bridge['ipv6_eui64_prefix'] = conf.return_values('ipv6 address eui64') - # Determine currently effective EUI64 address - to determine which + # Determine currently effective EUI64 addresses - to determine which # address is no longer valid and needs to be removed - eff_addr = conf.return_effective_value('ipv6 address eui64') - if eff_addr and eff_addr not in bridge['ipv6_eui64_prefix']: - bridge['ipv6_eui64_prefix_remove'].append(eff_addr) + eff_addr = conf.return_effective_values('ipv6 address eui64') + bridge['ipv6_eui64_prefix_remove'] = list_diff(eff_addr, bridge['ipv6_eui64_prefix']) # add the link-local by default to make IPv6 work bridge['ipv6_eui64_prefix'].append('fe80::/64') diff --git a/src/conf_mode/interfaces-ethernet.py b/src/conf_mode/interfaces-ethernet.py index f620cc6ab..db8e2cd3c 100755 --- a/src/conf_mode/interfaces-ethernet.py +++ b/src/conf_mode/interfaces-ethernet.py @@ -176,15 +176,14 @@ def get_config(): if conf.exists('ipv6 address autoconf'): eth['ipv6_autoconf'] = 1 - # Get prefix for IPv6 addressing based on MAC address (EUI-64) + # Get prefixes for IPv6 addressing based on MAC address (EUI-64) if conf.exists('ipv6 address eui64'): - eth['ipv6_eui64_prefix'].append(conf.return_value('ipv6 address eui64')) + eth['ipv6_eui64_prefix'] = conf.return_values('ipv6 address eui64') - # Determine currently effective EUI64 address - to determine which + # Determine currently effective EUI64 addresses - to determine which # address is no longer valid and needs to be removed - eff_addr = conf.return_effective_value('ipv6 address eui64') - if eff_addr and eff_addr not in eth['ipv6_eui64_prefix']: - eth['ipv6_eui64_prefix_remove'].append(eff_addr) + eff_addr = conf.return_effective_values('ipv6 address eui64') + eth['ipv6_eui64_prefix_remove'] = list_diff(eff_addr, eth['ipv6_eui64_prefix']) # add the link-local by default to make IPv6 work eth['ipv6_eui64_prefix'].append('fe80::/64') diff --git a/src/conf_mode/interfaces-l2tpv3.py b/src/conf_mode/interfaces-l2tpv3.py index 45b618148..a18cc6161 100755 --- a/src/conf_mode/interfaces-l2tpv3.py +++ b/src/conf_mode/interfaces-l2tpv3.py @@ -113,9 +113,9 @@ def get_config(): if conf.exists('ipv6 address autoconf'): l2tpv3['ipv6_autoconf'] = 1 - # Get prefix for IPv6 addressing based on MAC address (EUI-64) + # Get prefixes for IPv6 addressing based on MAC address (EUI-64) if conf.exists('ipv6 address eui64'): - l2tpv3['ipv6_eui64_prefix'].append(conf.return_value('ipv6 address eui64')) + l2tpv3['ipv6_eui64_prefix'] = conf.return_values('ipv6 address eui64') # add the link-local by default to make IPv6 work l2tpv3['ipv6_eui64_prefix'].append('fe80::/64') diff --git a/src/conf_mode/interfaces-openvpn.py b/src/conf_mode/interfaces-openvpn.py index 469793910..668dcabb4 100755 --- a/src/conf_mode/interfaces-openvpn.py +++ b/src/conf_mode/interfaces-openvpn.py @@ -25,6 +25,7 @@ from time import sleep from shutil import rmtree from vyos.config import Config +from vyos.configdict import list_diff from vyos.ifconfig import VTunIf from vyos.template import render from vyos.util import call, chown, chmod_600, chmod_755 @@ -315,15 +316,14 @@ def get_config(): if conf.exists('ipv6 address autoconf'): openvpn['ipv6_autoconf'] = 1 - # Get prefix for IPv6 addressing based on MAC address (EUI-64) + # Get prefixes for IPv6 addressing based on MAC address (EUI-64) if conf.exists('ipv6 address eui64'): - openvpn['ipv6_eui64_prefix'].append(conf.return_value('ipv6 address eui64')) + openvpn['ipv6_eui64_prefix'] = conf.return_values('ipv6 address eui64') - # Determine currently effective EUI64 address - to determine which + # Determine currently effective EUI64 addresses - to determine which # address is no longer valid and needs to be removed - eff_addr = conf.return_effective_value('ipv6 address eui64') - if eff_addr and eff_addr not in openvpn['ipv6_eui64_prefix']: - openvpn['ipv6_eui64_prefix_remove'].append(eff_addr) + eff_addr = conf.return_effective_values('ipv6 address eui64') + openvpn['ipv6_eui64_prefix_remove'] = list_diff(eff_addr, openvpn['ipv6_eui64_prefix']) # add the link-local by default to make IPv6 work openvpn['ipv6_eui64_prefix'].append('fe80::/64') diff --git a/src/conf_mode/interfaces-pseudo-ethernet.py b/src/conf_mode/interfaces-pseudo-ethernet.py index bf19e46b9..2f86a3bea 100755 --- a/src/conf_mode/interfaces-pseudo-ethernet.py +++ b/src/conf_mode/interfaces-pseudo-ethernet.py @@ -158,15 +158,14 @@ def get_config(): if conf.exists('ipv6 address autoconf'): peth['ipv6_autoconf'] = 1 - # Get prefix for IPv6 addressing based on MAC address (EUI-64) + # Get prefixes for IPv6 addressing based on MAC address (EUI-64) if conf.exists('ipv6 address eui64'): - peth['ipv6_eui64_prefix'].append(conf.return_value('ipv6 address eui64')) + peth['ipv6_eui64_prefix'] = conf.return_values('ipv6 address eui64') - # Determine currently effective EUI64 address - to determine which + # Determine currently effective EUI64 addresses - to determine which # address is no longer valid and needs to be removed - eff_addr = conf.return_effective_value('ipv6 address eui64') - if eff_addr and eff_addr not in peth['ipv6_eui64_prefix']: - peth['ipv6_eui64_prefix_remove'].append(eff_addr) + eff_addr = conf.return_effective_values('ipv6 address eui64') + peth['ipv6_eui64_prefix_remove'] = list_diff(eff_addr, peth['ipv6_eui64_prefix']) # add the link-local by default to make IPv6 work peth['ipv6_eui64_prefix'].append('fe80::/64') diff --git a/src/conf_mode/interfaces-vxlan.py b/src/conf_mode/interfaces-vxlan.py index 69dbe32d8..3ff051eed 100755 --- a/src/conf_mode/interfaces-vxlan.py +++ b/src/conf_mode/interfaces-vxlan.py @@ -116,9 +116,9 @@ def get_config(): if conf.exists('ipv6 address autoconf'): vxlan['ipv6_autoconf'] = 1 - # Get prefix for IPv6 addressing based on MAC address (EUI-64) + # Get prefixes for IPv6 addressing based on MAC address (EUI-64) if conf.exists('ipv6 address eui64'): - vxlan['ipv6_eui64_prefix'].append(conf.return_value('ipv6 address eui64')) + vxlan['ipv6_eui64_prefix'] = conf.return_values('ipv6 address eui64') # add the link-local by default to make IPv6 work vxlan['ipv6_eui64_prefix'].append('fe80::/64') diff --git a/src/conf_mode/interfaces-wireless.py b/src/conf_mode/interfaces-wireless.py index 82a5a892a..b25a094e2 100755 --- a/src/conf_mode/interfaces-wireless.py +++ b/src/conf_mode/interfaces-wireless.py @@ -369,15 +369,14 @@ def get_config(): if conf.exists('ipv6 address autoconf'): wifi['ipv6_autoconf'] = 1 - # Get prefix for IPv6 addressing based on MAC address (EUI-64) + # Get prefixes for IPv6 addressing based on MAC address (EUI-64) if conf.exists('ipv6 address eui64'): - wifi['ipv6_eui64_prefix'].append(conf.return_value('ipv6 address eui64')) + wifi['ipv6_eui64_prefix'] = conf.return_values('ipv6 address eui64') - # Determine currently effective EUI64 address - to determine which + # Determine currently effective EUI64 addresses - to determine which # address is no longer valid and needs to be removed - eff_addr = conf.return_effective_value('ipv6 address eui64') - if eff_addr and eff_addr not in wifi['ipv6_eui64_prefix']: - wifi['ipv6_eui64_prefix_remove'].append(eff_addr) + eff_addr = conf.return_effective_values('ipv6 address eui64') + wifi['ipv6_eui64_prefix_remove'] = list_diff(eff_addr, wifi['ipv6_eui64_prefix']) # add the link-local by default to make IPv6 work wifi['ipv6_eui64_prefix'].append('fe80::/64') -- cgit v1.2.3 From c87a5a1e1f52cddf113f427ea902f45a2e2a8445 Mon Sep 17 00:00:00 2001 From: Jernej Jakob Date: Wed, 22 Apr 2020 12:41:07 +0200 Subject: interfaces: T2362: add node to delete the default IPv6 link-local address --- interface-definitions/include/ipv6-address.xml.i | 6 ++++++ python/vyos/configdict.py | 8 ++++++-- src/conf_mode/interfaces-bonding.py | 8 ++++++-- src/conf_mode/interfaces-bridge.py | 8 ++++++-- src/conf_mode/interfaces-ethernet.py | 8 ++++++-- src/conf_mode/interfaces-l2tpv3.py | 6 ++++-- src/conf_mode/interfaces-openvpn.py | 8 ++++++-- src/conf_mode/interfaces-pseudo-ethernet.py | 8 ++++++-- src/conf_mode/interfaces-vxlan.py | 6 ++++-- src/conf_mode/interfaces-wireless.py | 8 ++++++-- 10 files changed, 56 insertions(+), 18 deletions(-) (limited to 'src/conf_mode/interfaces-vxlan.py') diff --git a/interface-definitions/include/ipv6-address.xml.i b/interface-definitions/include/ipv6-address.xml.i index ffc6ef933..34f54e4c1 100644 --- a/interface-definitions/include/ipv6-address.xml.i +++ b/interface-definitions/include/ipv6-address.xml.i @@ -19,5 +19,11 @@ + + + Remove the default link-local address from the interface + + + diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py index 9ea89194f..2ce8a795f 100644 --- a/python/vyos/configdict.py +++ b/python/vyos/configdict.py @@ -210,8 +210,12 @@ def vlan_to_dict(conf): eff_addr = conf.return_effective_values('ipv6 address eui64') vlan['ipv6_eui64_prefix_remove'] = list_diff(eff_addr, vlan['ipv6_eui64_prefix']) - # add the link-local by default to make IPv6 work - vlan['ipv6_eui64_prefix'].append('fe80::/64') + # Remove the default link-local address if set. + if conf.exists('ipv6 address no-default-link-local'): + vlan['ipv6_eui64_prefix_remove'].append('fe80::/64') + else: + # add the link-local by default to make IPv6 work + vlan['ipv6_eui64_prefix'].append('fe80::/64') # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): diff --git a/src/conf_mode/interfaces-bonding.py b/src/conf_mode/interfaces-bonding.py index 6693f3a13..4aef486b4 100755 --- a/src/conf_mode/interfaces-bonding.py +++ b/src/conf_mode/interfaces-bonding.py @@ -212,8 +212,12 @@ def get_config(): eff_addr = conf.return_effective_values('ipv6 address eui64') bond['ipv6_eui64_prefix_remove'] = list_diff(eff_addr, bond['ipv6_eui64_prefix']) - # add the link-local by default to make IPv6 work - bond['ipv6_eui64_prefix'].append('fe80::/64') + # Remove the default link-local address if set. + if conf.exists('ipv6 address no-default-link-local'): + bond['ipv6_eui64_prefix_remove'].append('fe80::/64') + else: + # add the link-local by default to make IPv6 work + bond['ipv6_eui64_prefix'].append('fe80::/64') # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): diff --git a/src/conf_mode/interfaces-bridge.py b/src/conf_mode/interfaces-bridge.py index d4470ef26..da49415f7 100755 --- a/src/conf_mode/interfaces-bridge.py +++ b/src/conf_mode/interfaces-bridge.py @@ -170,8 +170,12 @@ def get_config(): eff_addr = conf.return_effective_values('ipv6 address eui64') bridge['ipv6_eui64_prefix_remove'] = list_diff(eff_addr, bridge['ipv6_eui64_prefix']) - # add the link-local by default to make IPv6 work - bridge['ipv6_eui64_prefix'].append('fe80::/64') + # Remove the default link-local address if set. + if conf.exists('ipv6 address no-default-link-local'): + bridge['ipv6_eui64_prefix_remove'].append('fe80::/64') + else: + # add the link-local by default to make IPv6 work + bridge['ipv6_eui64_prefix'].append('fe80::/64') # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): diff --git a/src/conf_mode/interfaces-ethernet.py b/src/conf_mode/interfaces-ethernet.py index db8e2cd3c..43d97916d 100755 --- a/src/conf_mode/interfaces-ethernet.py +++ b/src/conf_mode/interfaces-ethernet.py @@ -185,8 +185,12 @@ def get_config(): eff_addr = conf.return_effective_values('ipv6 address eui64') eth['ipv6_eui64_prefix_remove'] = list_diff(eff_addr, eth['ipv6_eui64_prefix']) - # add the link-local by default to make IPv6 work - eth['ipv6_eui64_prefix'].append('fe80::/64') + # Remove the default link-local address if set. + if conf.exists('ipv6 address no-default-link-local'): + eth['ipv6_eui64_prefix_remove'].append('fe80::/64') + else: + # add the link-local by default to make IPv6 work + eth['ipv6_eui64_prefix'].append('fe80::/64') # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): diff --git a/src/conf_mode/interfaces-l2tpv3.py b/src/conf_mode/interfaces-l2tpv3.py index a18cc6161..8c3a8279e 100755 --- a/src/conf_mode/interfaces-l2tpv3.py +++ b/src/conf_mode/interfaces-l2tpv3.py @@ -117,8 +117,10 @@ def get_config(): if conf.exists('ipv6 address eui64'): l2tpv3['ipv6_eui64_prefix'] = conf.return_values('ipv6 address eui64') - # add the link-local by default to make IPv6 work - l2tpv3['ipv6_eui64_prefix'].append('fe80::/64') + # Remove the default link-local address if set. + if not conf.exists('ipv6 address no-default-link-local'): + # add the link-local by default to make IPv6 work + l2tpv3['ipv6_eui64_prefix'].append('fe80::/64') # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): diff --git a/src/conf_mode/interfaces-openvpn.py b/src/conf_mode/interfaces-openvpn.py index 668dcabb4..029bc1d69 100755 --- a/src/conf_mode/interfaces-openvpn.py +++ b/src/conf_mode/interfaces-openvpn.py @@ -325,8 +325,12 @@ def get_config(): eff_addr = conf.return_effective_values('ipv6 address eui64') openvpn['ipv6_eui64_prefix_remove'] = list_diff(eff_addr, openvpn['ipv6_eui64_prefix']) - # add the link-local by default to make IPv6 work - openvpn['ipv6_eui64_prefix'].append('fe80::/64') + # Remove the default link-local address if set. + if conf.exists('ipv6 address no-default-link-local'): + openvpn['ipv6_eui64_prefix_remove'].append('fe80::/64') + else: + # add the link-local by default to make IPv6 work + openvpn['ipv6_eui64_prefix'].append('fe80::/64') # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): diff --git a/src/conf_mode/interfaces-pseudo-ethernet.py b/src/conf_mode/interfaces-pseudo-ethernet.py index 2f86a3bea..57b282291 100755 --- a/src/conf_mode/interfaces-pseudo-ethernet.py +++ b/src/conf_mode/interfaces-pseudo-ethernet.py @@ -167,8 +167,12 @@ def get_config(): eff_addr = conf.return_effective_values('ipv6 address eui64') peth['ipv6_eui64_prefix_remove'] = list_diff(eff_addr, peth['ipv6_eui64_prefix']) - # add the link-local by default to make IPv6 work - peth['ipv6_eui64_prefix'].append('fe80::/64') + # Remove the default link-local address if set. + if conf.exists('ipv6 address no-default-link-local'): + peth['ipv6_eui64_prefix_remove'].append('fe80::/64') + else: + # add the link-local by default to make IPv6 work + peth['ipv6_eui64_prefix'].append('fe80::/64') # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): diff --git a/src/conf_mode/interfaces-vxlan.py b/src/conf_mode/interfaces-vxlan.py index 3ff051eed..74eae4281 100755 --- a/src/conf_mode/interfaces-vxlan.py +++ b/src/conf_mode/interfaces-vxlan.py @@ -120,8 +120,10 @@ def get_config(): if conf.exists('ipv6 address eui64'): vxlan['ipv6_eui64_prefix'] = conf.return_values('ipv6 address eui64') - # add the link-local by default to make IPv6 work - vxlan['ipv6_eui64_prefix'].append('fe80::/64') + # Remove the default link-local address if set. + if not conf.exists('ipv6 address no-default-link-local'): + # add the link-local by default to make IPv6 work + vxlan['ipv6_eui64_prefix'].append('fe80::/64') # Disable IPv6 forwarding on this interface if conf.exists('ipv6 disable-forwarding'): diff --git a/src/conf_mode/interfaces-wireless.py b/src/conf_mode/interfaces-wireless.py index b25a094e2..148a7f6e0 100755 --- a/src/conf_mode/interfaces-wireless.py +++ b/src/conf_mode/interfaces-wireless.py @@ -378,8 +378,12 @@ def get_config(): eff_addr = conf.return_effective_values('ipv6 address eui64') wifi['ipv6_eui64_prefix_remove'] = list_diff(eff_addr, wifi['ipv6_eui64_prefix']) - # add the link-local by default to make IPv6 work - wifi['ipv6_eui64_prefix'].append('fe80::/64') + # Remove the default link-local address if set. + if conf.exists('ipv6 address no-default-link-local'): + wifi['ipv6_eui64_prefix_remove'].append('fe80::/64') + else: + # add the link-local by default to make IPv6 work + wifi['ipv6_eui64_prefix'].append('fe80::/64') # ARP enable ignore if conf.exists('ip enable-arp-ignore'): -- cgit v1.2.3