1 From e50a7ccadb460bf923d841d620080f351fd74d9d Mon Sep 17 00:00:00 2001
2 From: Alexandre Derumier <aderumier@odiso.com>
3 Date: Thu, 20 Apr 2023 11:48:11 +0200
4 Subject: [PATCH] vlan: query_check: check vlan-protocol for not dotted
8 ifupdown2/addons/vlan.py | 44 +++++++++++++++++++++-------------------
9 1 file changed, 23 insertions(+), 21 deletions(-)
11 diff --git a/ifupdown2/addons/vlan.py b/ifupdown2/addons/vlan.py
12 index 584fe6e..3b045dc 100644
13 --- a/ifupdown2/addons/vlan.py
14 +++ b/ifupdown2/addons/vlan.py
15 @@ -224,10 +224,13 @@ class vlan(Addon, moduleBase):
16 def _query_check(self, ifaceobj, ifaceobjcurr):
17 if not self.cache.link_exists(ifaceobj.name):
20 + ifname = ifaceobj.name
21 + cached_vlan_info_data = self.cache.get_link_info_data(ifname)
23 if '.' not in ifaceobj.name:
24 # if vlan name is not in the dot format, check its running state
26 - ifname = ifaceobj.name
27 cached_vlan_raw_device = self.cache.get_lower_device_ifname(ifname)
30 @@ -239,8 +242,6 @@ class vlan(Addon, moduleBase):
31 cached_vlan_raw_device != ifaceobj.get_attr_value_first('vlan-raw-device')
34 - cached_vlan_info_data = self.cache.get_link_info_data(ifname)
39 @@ -252,27 +253,28 @@ class vlan(Addon, moduleBase):
40 cached_vlan_id_str = str(cached_vlan_id)
41 ifaceobjcurr.update_config_with_status('vlan-id', cached_vlan_id_str, vlanid_config != cached_vlan_id_str)
46 - protocol_config = ifaceobj.get_attr_value_first('vlan-protocol')
49 + # vlan-protocol (dot or not dot format)
51 + protocol_config = ifaceobj.get_attr_value_first('vlan-protocol')
54 - cached_vlan_protocol = cached_vlan_info_data.get(Link.IFLA_VLAN_PROTOCOL)
55 + cached_vlan_protocol = cached_vlan_info_data.get(Link.IFLA_VLAN_PROTOCOL)
57 - if protocol_config.upper() != cached_vlan_protocol.upper():
58 - ifaceobjcurr.update_config_with_status(
60 - cached_vlan_protocol,
64 - ifaceobjcurr.update_config_with_status(
69 + if protocol_config.upper() != cached_vlan_protocol.upper():
70 + ifaceobjcurr.update_config_with_status(
72 + cached_vlan_protocol,
76 + ifaceobjcurr.update_config_with_status(
82 + if '.' not in ifaceobj.name: