diff options
author | Christian Breunig <christian@breunig.cc> | 2024-05-10 15:15:53 +0200 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2024-05-10 15:18:08 +0200 |
commit | d8ddd7191d3004e886fa45a2cf9bd8dd5e7f5e14 (patch) | |
tree | f2288362d3b4ef9bba115ba938e89cc2f952346a /src/conf_mode/interfaces_bonding.py | |
parent | 234f35d8bae71b5d33ad97cdabc236ec6b13c3a2 (diff) | |
download | vyos-1x-d8ddd7191d3004e886fa45a2cf9bd8dd5e7f5e14.tar.gz vyos-1x-d8ddd7191d3004e886fa45a2cf9bd8dd5e7f5e14.zip |
bond: T6303: system-mac is not allowed to be a multicast MAC address
Diffstat (limited to 'src/conf_mode/interfaces_bonding.py')
-rwxr-xr-x | src/conf_mode/interfaces_bonding.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/conf_mode/interfaces_bonding.py b/src/conf_mode/interfaces_bonding.py index 371b219c0..5e5d5fba1 100755 --- a/src/conf_mode/interfaces_bonding.py +++ b/src/conf_mode/interfaces_bonding.py @@ -33,6 +33,7 @@ from vyos.ifconfig import BondIf from vyos.ifconfig.ethernet import EthernetIf from vyos.ifconfig import Section from vyos.template import render_to_string +from vyos.utils.assertion import assert_mac from vyos.utils.dict import dict_search from vyos.utils.dict import dict_to_paths_values from vyos.utils.network import interface_exists @@ -244,6 +245,16 @@ def verify(bond): raise ConfigError('primary interface only works for mode active-backup, ' \ 'transmit-load-balance or adaptive-load-balance') + if 'system_mac' in bond: + if bond['mode'] != '802.3ad': + raise ConfigError('Actor MAC address only available in 802.3ad mode!') + + system_mac = bond['system_mac'] + try: + assert_mac(system_mac, test_all_zero=False) + except: + raise ConfigError(f'Cannot use a multicast MAC address "{system_mac}" as system-mac!') + return None def generate(bond): |