diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-03-08 12:53:20 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-03-08 12:53:20 +0100 |
commit | d61cab413307e0b235316e6bb2dbf1ed26e11590 (patch) | |
tree | 95602668fc6ce174e54081bb5a01236a20db7d3a /src | |
parent | 4a44abe0a9405bedc73a309cd53b99d20e37a3ad (diff) | |
download | vyos-1x-d61cab413307e0b235316e6bb2dbf1ed26e11590.tar.gz vyos-1x-d61cab413307e0b235316e6bb2dbf1ed26e11590.zip |
vrf: T31: enable vrf support for wireless interface
Diffstat (limited to 'src')
-rwxr-xr-x | src/conf_mode/interfaces-wireless.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/conf_mode/interfaces-wireless.py b/src/conf_mode/interfaces-wireless.py index 2d4b16faa..3da057e91 100755 --- a/src/conf_mode/interfaces-wireless.py +++ b/src/conf_mode/interfaces-wireless.py @@ -838,7 +838,8 @@ default_config_data = { 'ssid' : '', 'type' : 'monitor', 'vif': [], - 'vif_remove': [] + 'vif_remove': [], + 'vrf': '' } def get_conf_file(conf_type, intf): @@ -1150,6 +1151,10 @@ def get_config(): if conf.exists('mode'): wifi['mode'] = conf.return_value('mode') + # retrieve VRF instance + if conf.exists('vrf'): + wifi['vrf'] = conf.return_value('vrf') + # Wireless physical device if conf.exists('phy'): wifi['phy'] = conf.return_value('phy') @@ -1278,7 +1283,6 @@ def verify(wifi): if not wifi['channel']: raise ConfigError('Channel must be set for {}'.format(wifi['intf'])) - if len(wifi['sec_wep_key']) > 4: raise ConfigError('No more then 4 WEP keys configurable') @@ -1298,6 +1302,10 @@ def verify(wifi): if not radius['key']: raise ConfigError('Misssing RADIUS shared secret key for server: {}'.format(radius['server'])) + vrf_name = wifi['vrf'] + if vrf_name and vrf_name not in interfaces(): + raise ConfigError(f'VRF "{vrf_name}" does not exist') + # use common function to verify VLAN configuration verify_vlan_config(wifi) @@ -1396,6 +1404,12 @@ def apply(wifi): # ignore link state changes w.set_link_detect(wifi['disable_link_detect']) + # assign to VRF + if wifi['vrf']: + d.add_vrf(wifi['vrf']) + else: + d.del_vrf(wifi['vrf']) + # Change interface MAC address - re-set to real hardware address (hw-id) # if custom mac is removed if wifi['mac']: |