From d61cab413307e0b235316e6bb2dbf1ed26e11590 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 8 Mar 2020 12:53:20 +0100 Subject: vrf: T31: enable vrf support for wireless interface --- interface-definitions/interfaces-wireless.xml.in | 1 + 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 @@ #include #include + #include Disassociate stations based on excessive transmission failures 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']: -- cgit v1.2.3