mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
ifupdown2 should not allow IP address command under vlan aware bridge stanza
Ticket: CM-6106 Reviewed By: roopa,scotte Testing Done: ran ifupdown2 regression suite and hand tested This patch prevents IP address assignment under vlan aware bridges. This prevents some confusion because a bridge subinterface is required for layer 3 termination.
This commit is contained in:
@@ -104,9 +104,12 @@ class address(moduleBase):
|
|||||||
newaddrs = []
|
newaddrs = []
|
||||||
addrs = ifaceobj.get_attr_value('address')
|
addrs = ifaceobj.get_attr_value('address')
|
||||||
if addrs:
|
if addrs:
|
||||||
if ifaceobj.role & ifaceRole.SLAVE:
|
if (ifaceobj.role & ifaceRole.SLAVE) or \
|
||||||
|
(ifaceobj.link_kind & ifaceLinkKind.BRIDGE_VLAN_AWARE):
|
||||||
# we must not configure an IP address if the interface is enslaved
|
# we must not configure an IP address if the interface is enslaved
|
||||||
self.log_warn('interface %s is enslaved and cannot have an IP Address' % \
|
# or is a VLAN AWARE BRIDGE
|
||||||
|
self.log_warn('interface %s is enslaved or a vlan aware bridge '
|
||||||
|
'and cannot have an IP Address' % \
|
||||||
(ifaceobj.name))
|
(ifaceobj.name))
|
||||||
return
|
return
|
||||||
# If user address is not in CIDR notation, convert them to CIDR
|
# If user address is not in CIDR notation, convert them to CIDR
|
||||||
|
@@ -220,6 +220,9 @@ class bridge(moduleBase):
|
|||||||
if ifaceobj.link_type != ifaceLinkType.LINK_NA:
|
if ifaceobj.link_type != ifaceLinkType.LINK_NA:
|
||||||
ifaceobj.link_type = ifaceLinkType.LINK_MASTER
|
ifaceobj.link_type = ifaceLinkType.LINK_MASTER
|
||||||
ifaceobj.link_kind |= ifaceLinkKind.BRIDGE
|
ifaceobj.link_kind |= ifaceLinkKind.BRIDGE
|
||||||
|
# for special vlan aware bridges, we need to add another bit
|
||||||
|
if ifaceobj.get_attr_value_first('bridge-vlan-aware') == 'yes':
|
||||||
|
ifaceobj.link_kind |= ifaceLinkKind.BRIDGE_VLAN_AWARE
|
||||||
ifaceobj.role |= ifaceRole.MASTER
|
ifaceobj.role |= ifaceRole.MASTER
|
||||||
ifaceobj.dependency_type = ifaceDependencyType.MASTER_SLAVE
|
ifaceobj.dependency_type = ifaceDependencyType.MASTER_SLAVE
|
||||||
return self.parse_port_list(ifaceobj.get_attr_value_first(
|
return self.parse_port_list(ifaceobj.get_attr_value_first(
|
||||||
|
@@ -44,6 +44,7 @@ class ifaceLinkKind():
|
|||||||
BOND = 0x2
|
BOND = 0x2
|
||||||
VLAN = 0x4
|
VLAN = 0x4
|
||||||
VXLAN = 0x8
|
VXLAN = 0x8
|
||||||
|
BRIDGE_VLAN_AWARE = 0x10
|
||||||
|
|
||||||
class ifaceLinkType():
|
class ifaceLinkType():
|
||||||
LINK_UNKNOWN = 0x0
|
LINK_UNKNOWN = 0x0
|
||||||
|
Reference in New Issue
Block a user