self.log_warn('%s: unable to process waitport: %s'
%(ifaceobj.name, str(e)))
- def _ports_enable_disable_ipv6(self, ports, enable='1'):
+ def _enable_disable_ipv6(self, port, enable='1'):
+ try:
+ self.write_file('/proc/sys/net/ipv6/conf/%s/disable_ipv6' % port, enable)
+ except Exception, e:
+ self.logger.info(str(e))
+
+ def handle_ipv6(self, ports, state, ifaceobj=None):
+ if ifaceobj and (ifaceobj.link_privflags & ifaceLinkPrivFlags.BRIDGE_VXLAN):
+ self._enable_disable_ipv6(ifaceobj.name, state)
for p in ports:
- try:
- self.write_file('/proc/sys/net/ipv6/conf/%s' %p +
- '/disable_ipv6', enable)
- except Exception, e:
- self.logger.info(str(e))
- pass
+ self._enable_disable_ipv6(p, state)
def _pretty_print_add_ports_error(self, errstr, bridgename, bridgeports):
""" pretty print bridge port add errors.
pass
# enable ipv6 for ports that were removed
- self._ports_enable_disable_ipv6(removedbridgeports, '0')
+ self.handle_ipv6(removedbridgeports, '0')
if err:
self.log_error('bridge configuration failed (missing ports)')
if not running_ports:
return
# disable ipv6 for ports that were added to bridge
- self._ports_enable_disable_ipv6(running_ports, '1')
+ self.handle_ipv6(running_ports, '1', ifaceobj=ifaceobj)
self._apply_bridge_port_settings_all(ifaceobj,
ifaceobj_getfunc=ifaceobj_getfunc)
except Exception, e:
ports = self.brctlcmd.get_bridge_ports(ifaceobj.name)
self.brctlcmd.delete_bridge(ifaceobj.name)
if ports:
- self._ports_enable_disable_ipv6(ports, '0')
+ self.handle_ipv6(ports, '0', ifaceobj=ifaceobj)
if ifaceobj.link_type != ifaceLinkType.LINK_NA:
map(lambda p: rtnetlink_api.rtnl_api.link_set(p,
"down"), ports)
class ifaceLinkPrivFlags():
""" This corresponds to kernel netdev->priv_flags
and can be BRIDGE_PORT, BOND_SLAVE etc """
- UNKNOWN = 0x0000
- BRIDGE_PORT = 0x0001
- BOND_SLAVE = 0x0010
- VRF_SLAVE = 0x0100
- BRIDGE_VLAN_AWARE = 0x1000
+ UNKNOWN = 0x00000
+ BRIDGE_PORT = 0x00001
+ BOND_SLAVE = 0x00010
+ VRF_SLAVE = 0x00100
+ BRIDGE_VLAN_AWARE = 0x01000
+ BRIDGE_VXLAN = 0x10000
@classmethod
def get_str(cls, flag):
return 'vrf slave'
elif flag == cls.BRIDGE_VLAN_AWARE:
return 'vlan aware bridge'
+ elif flag == cls.BRIDGE_VXLAN:
+ return 'vxlan bridge'
@classmethod
def get_all_str(cls, flags):
str = ''
- if (flags & cls.BRIDGE_PORT):
+ if flags & cls.BRIDGE_PORT:
str += 'bridgeport '
- if (flags == cls.BOND_SLAVE):
+ if flags & cls.BOND_SLAVE:
str += 'bondslave '
- elif flags == cls.VRF_SLAVE:
+ if flags & cls.VRF_SLAVE:
str += 'vrfslave '
- elif flags == cls.BRIDGE_VLAN_AWARE:
+ if flags & cls.BRIDGE_VLAN_AWARE:
str += 'vlanawarebridge '
+ if flags & cls.BRIDGE_VXLAN:
+ str += 'vxlanbridge '
return str
class ifaceLinkType():
self._set_iface_role(ifaceobj, ifaceRole.SLAVE, upperifaceobj)
ifaceobj.link_privflags |= ifaceLinkPrivFlags.BRIDGE_PORT
+ if (ifaceobj.link_kind & ifaceLinkKind.VXLAN) \
+ and (upperifaceobj.link_kind & ifaceLinkKind.BRIDGE):
+ upperifaceobj.link_privflags |= ifaceLinkPrivFlags.BRIDGE_VXLAN
+
# vrf masters get processed after slaves, which means
# check both link_kind vrf and vrf slave
if ((upperifaceobj.link_kind & ifaceLinkKind.VRF) or