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 | |
parent | 4a44abe0a9405bedc73a309cd53b99d20e37a3ad (diff) | |
download | vyos-1x-d61cab413307e0b235316e6bb2dbf1ed26e11590.tar.gz vyos-1x-d61cab413307e0b235316e6bb2dbf1ed26e11590.zip |
vrf: T31: enable vrf support for wireless interface
-rw-r--r-- | interface-definitions/interfaces-wireless.xml.in | 1 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-wireless.py | 18 |
2 files changed, 17 insertions, 2 deletions
diff --git a/interface-definitions/interfaces-wireless.xml.in b/interface-definitions/interfaces-wireless.xml.in index d6b257978..fd39fe11b 100644 --- a/interface-definitions/interfaces-wireless.xml.in +++ b/interface-definitions/interfaces-wireless.xml.in @@ -454,6 +454,7 @@ </leafNode> #include <include/interface-disable-link-detect.xml.i> #include <include/interface-disable.xml.i> + #include <include/interface-vrf.xml.i> <leafNode name="expunge-failing-stations"> <properties> <help>Disassociate stations based on excessive transmission failures</help> 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']: |