Allow BondEthernet to set MAC, and disallow interfaces to set their MAC if they are a bond member

This commit is contained in:
Pim van Pelt
2022-04-09 21:18:26 +00:00
parent 35edcff884
commit be36cc0ede
5 changed files with 40 additions and 1 deletions

View File

@ -13,6 +13,7 @@
#
import logging
import config.interface as interface
import config.mac as mac
def get_bondethernets(yaml):
""" Return a list of all bondethernets. """
@ -170,6 +171,9 @@ def validate_bondethernets(yaml):
if not get_mode(yaml, bond_ifname) in ['xor','lacp'] and 'load-balance' in iface:
msgs.append("bondethernet %s can only have load-balance if in mode XOR or LACP" % (ifname))
result = False
if 'mac' in iface and mac.is_multicast(iface['mac']):
msgs.append("bondethernet %s MAC address %s cannot be multicast" % (ifname, iface['mac']))
result = False
if not 'interfaces' in iface:
continue