From: Julien Fortin Date: Tue, 30 Jul 2019 14:43:27 +0000 (+0200) Subject: addons: vrf: enable_ipv6: rename method and add sysfs check for brport X-Git-Tag: 2.0.1-1~9 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=97fc046b41630ae290f70e9d260658a8fecda956;p=mirror_ifupdown2.git addons: vrf: enable_ipv6: rename method and add sysfs check for brport Signed-off-by: Julien Fortin --- diff --git a/ifupdown2/addons/vrf.py b/ifupdown2/addons/vrf.py index 22365d6..5d7f562 100644 --- a/ifupdown2/addons/vrf.py +++ b/ifupdown2/addons/vrf.py @@ -440,17 +440,17 @@ class vrf(moduleBase): raise break self._handle_existing_connections(ifaceobj, vrfname) + self.enable_ipv6_if_prev_brport(ifacename) self.ipcmd.link_set(ifacename, 'master', vrfname) - self.enable_ipv6(ifacename) return - def enable_ipv6(self, ifname): + def enable_ipv6_if_prev_brport(self, ifname): """ - Only enable ipv6 on former bridge port - - workaround for intf moved from bridge port to VRF slave + If the intf was previously enslaved to a bridge it is possible ipv6 is still disabled. """ try: - self.write_file("/proc/sys/net/ipv6/conf/%s/disable_ipv6" % ifname, "0") + if os.path.exists("/sys/class/net/%s/brport" % ifname): + self.write_file("/proc/sys/net/ipv6/conf/%s/disable_ipv6" % ifname, "0") except Exception, e: self.logger.info(str(e)) @@ -483,8 +483,8 @@ class vrf(moduleBase): uppers = self.ipcmd.link_get_uppers(ifacename) if not uppers or vrfname not in uppers: self._handle_existing_connections(ifaceobj, vrfname) + self.enable_ipv6_if_prev_brport(ifacename) self.ipcmd.link_set(ifacename, 'master', vrfname) - self.enable_ipv6(ifacename) elif ifaceobj: vrf_master_objs = ifaceobj_getfunc(vrfname) if not vrf_master_objs: