Add a few MAC checks

Notably mac.is_multicast() which is needed for TAPs / LCPs and
interfaces.

Add a test for interface MAC addresses being non-multicast.
This commit is contained in:
Pim van Pelt
2022-04-09 14:16:27 +00:00
parent 1a00f14b53
commit 92a20d0755
5 changed files with 93 additions and 0 deletions

View File

@ -18,6 +18,7 @@ import config.loopback as loopback
import config.vxlan_tunnel as vxlan_tunnel
import config.lcp as lcp
import config.address as address
import config.mac as mac
def get_qinx_parent_by_name(yaml, ifname):
""" Returns the sub-interface which matches a QinAD or QinQ outer tag, or None,None
@ -424,6 +425,10 @@ def validate_interfaces(yaml):
if not 'state' in iface:
iface['state'] = 'up'
if 'mac' in iface and mac.is_multicast(iface['mac']):
msgs.append("interface %s MAC address %s cannot be multicast" % (ifname, iface['mac']))
result = False
iface_mtu = get_mtu(yaml, ifname)
iface_lcp = get_lcp(yaml, ifname)
iface_address = has_address(yaml, ifname)