diff options
author | srividya0208 <68350089+srividya0208@users.noreply.github.com> | 2020-07-16 12:05:31 -0500 |
---|---|---|
committer | srividya0208 <68350089+srividya0208@users.noreply.github.com> | 2020-07-16 12:34:28 -0500 |
commit | f595f6fd817c8f1396240eee3eeebfaa133aaaaf (patch) | |
tree | 6683bbc7f0cc1b155176eda317900966b6283354 /src/conf_mode/interfaces-pseudo-ethernet.py | |
parent | 305c0910f08c8b6772be0247cfc03fa0282478c8 (diff) | |
download | vyos-1x-f595f6fd817c8f1396240eee3eeebfaa133aaaaf.tar.gz vyos-1x-f595f6fd817c8f1396240eee3eeebfaa133aaaaf.zip |
pseudo-ethernet: T2626: Fix for changing interface mode
Since it is not impossible to change MACVLAN interface mode on the fly, this fix adds a new one trigger to recreate it from scratch if the mode changed in system config
Diffstat (limited to 'src/conf_mode/interfaces-pseudo-ethernet.py')
-rwxr-xr-x | src/conf_mode/interfaces-pseudo-ethernet.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/conf_mode/interfaces-pseudo-ethernet.py b/src/conf_mode/interfaces-pseudo-ethernet.py index 70710e97c..fb8237bee 100755 --- a/src/conf_mode/interfaces-pseudo-ethernet.py +++ b/src/conf_mode/interfaces-pseudo-ethernet.py @@ -36,7 +36,7 @@ default_config_data = { 'ip_arp_cache_tmo': 30, 'ip_proxy_arp_pvlan': 0, 'source_interface': '', - 'source_interface_changed': False, + 'recreating_required': False, 'mode': 'private', 'vif_s': {}, 'vif_s_remove': [], @@ -79,11 +79,14 @@ def get_config(): peth['source_interface'] = conf.return_value(['source-interface']) tmp = conf.return_effective_value(['source-interface']) if tmp != peth['source_interface']: - peth['source_interface_changed'] = True + peth['recreating_required'] = True # MACvlan mode if conf.exists(['mode']): peth['mode'] = conf.return_value(['mode']) + tmp = conf.return_effective_value(['mode']) + if tmp != peth['mode']: + peth['recreating_required'] = True add_to_dict(conf, disabled, peth, 'vif', 'vif') add_to_dict(conf, disabled, peth, 'vif-s', 'vif_s') @@ -139,10 +142,10 @@ def apply(peth): return None # Check if MACVLAN interface already exists. Parameters like the underlaying - # source-interface device can not be changed on the fly and the interface + # source-interface device or mode can not be changed on the fly and the interface # needs to be recreated from the bottom. if peth['intf'] in interfaces(): - if peth['source_interface_changed']: + if peth['recreating_required']: MACVLANIf(peth['intf']).remove() # MACVLAN interface needs to be created on-block instead of passing a ton |