]>
Commit | Line | Data |
---|---|---|
3c4e774f AD |
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 | |
5 | interface | |
6 | ||
7 | --- | |
8 | ifupdown2/addons/vlan.py | 44 +++++++++++++++++++++------------------- | |
9 | 1 file changed, 23 insertions(+), 21 deletions(-) | |
10 | ||
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): | |
18 | return | |
19 | + | |
20 | + ifname = ifaceobj.name | |
21 | + cached_vlan_info_data = self.cache.get_link_info_data(ifname) | |
22 | + | |
23 | if '.' not in ifaceobj.name: | |
24 | # if vlan name is not in the dot format, check its running state | |
25 | ||
26 | - ifname = ifaceobj.name | |
27 | cached_vlan_raw_device = self.cache.get_lower_device_ifname(ifname) | |
28 | ||
29 | # | |
30 | @@ -239,8 +242,6 @@ class vlan(Addon, moduleBase): | |
31 | cached_vlan_raw_device != ifaceobj.get_attr_value_first('vlan-raw-device') | |
32 | ) | |
33 | ||
34 | - cached_vlan_info_data = self.cache.get_link_info_data(ifname) | |
35 | - | |
36 | # | |
37 | # vlan-id | |
38 | # | |
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) | |
42 | ||
43 | - # | |
44 | - # vlan-protocol | |
45 | - # | |
46 | - protocol_config = ifaceobj.get_attr_value_first('vlan-protocol') | |
47 | - if protocol_config: | |
48 | + # | |
49 | + # vlan-protocol (dot or not dot format) | |
50 | + # | |
51 | + protocol_config = ifaceobj.get_attr_value_first('vlan-protocol') | |
52 | + if protocol_config: | |
53 | ||
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) | |
56 | ||
57 | - if protocol_config.upper() != cached_vlan_protocol.upper(): | |
58 | - ifaceobjcurr.update_config_with_status( | |
59 | - 'vlan-protocol', | |
60 | - cached_vlan_protocol, | |
61 | - 1 | |
62 | - ) | |
63 | - else: | |
64 | - ifaceobjcurr.update_config_with_status( | |
65 | - 'vlan-protocol', | |
66 | - protocol_config, | |
67 | - 0 | |
68 | - ) | |
69 | + if protocol_config.upper() != cached_vlan_protocol.upper(): | |
70 | + ifaceobjcurr.update_config_with_status( | |
71 | + 'vlan-protocol', | |
72 | + cached_vlan_protocol, | |
73 | + 1 | |
74 | + ) | |
75 | + else: | |
76 | + ifaceobjcurr.update_config_with_status( | |
77 | + 'vlan-protocol', | |
78 | + protocol_config, | |
79 | + 0 | |
80 | + ) | |
81 | ||
82 | + if '.' not in ifaceobj.name: | |
83 | # | |
84 | # vlan-bridge-binding | |
85 | # | |
86 | -- | |
87 | 2.30.2 | |
88 |