From d1c9ee33f25e45cea0d01f9685f99c960ed4d7f8 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 19 Sep 2020 21:08:40 +0200 Subject: ifconfig: T2653: convert VLAN interfaces do discrete class Instead of using an Adapter pattern to make interfaces VLAN-aware, create a derived class named VLANIf to represent a VLAN. This change was necessary to eliminate mixed code in Interfaces class which was VLAN - free, but recently gained some VLAN specific code for set_admin_state(). In addition this "autoresolves" the issue in T2894 as a bond vlan interface will no longer change the lower interface. --- python/vyos/ifconfig/wireless.py | 5 ----- 1 file changed, 5 deletions(-) (limited to 'python/vyos/ifconfig/wireless.py') diff --git a/python/vyos/ifconfig/wireless.py b/python/vyos/ifconfig/wireless.py index a50346ffa..053566a1e 100644 --- a/python/vyos/ifconfig/wireless.py +++ b/python/vyos/ifconfig/wireless.py @@ -13,14 +13,9 @@ # You should have received a copy of the GNU Lesser General Public # License along with this library. If not, see . -import os - from vyos.ifconfig.interface import Interface -from vyos.ifconfig.vlan import VLAN - @Interface.register -@VLAN.enable class WiFiIf(Interface): """ Handle WIFI/WLAN interfaces. -- cgit v1.2.3 From 670536709b693f9b312a1f3da354d85eaf8a13b3 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 19 Sep 2020 22:18:19 +0200 Subject: wifi: ifconfig: T2875: add_to_bridge() must be called after starting services hostapd/wpa_supplicant will control the admin state of an interface, thus we should re-add it to a bridge after we have launched those services. --- python/vyos/ifconfig/wireless.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'python/vyos/ifconfig/wireless.py') diff --git a/python/vyos/ifconfig/wireless.py b/python/vyos/ifconfig/wireless.py index 053566a1e..346577119 100644 --- a/python/vyos/ifconfig/wireless.py +++ b/python/vyos/ifconfig/wireless.py @@ -72,9 +72,22 @@ class WiFiIf(Interface): interface setup code and provide a single point of entry when workin on any interface. """ + # We can not call add_to_bridge() until wpa_supplicant is running, thus + # we will remove the key from the config dict and react to this specal + # case in thie derived class. + # re-add ourselves to any bridge we might have fallen out of + bridge_member = '' + if 'is_bridge_member' in config: + bridge_member = config['is_bridge_member'] + del config['is_bridge_member'] + # call base class first super().update(config) + # re-add ourselves to any bridge we might have fallen out of + if bridge_member: + self.add_to_bridge(bridge_member) + # Enable/Disable of an interface must always be done at the end of the # derived class to make use of the ref-counting set_admin_state() # function. We will only enable the interface if 'up' was called as -- cgit v1.2.3