Commit dc81898
committed
Support update operation for link objects
When bridge interfaces are in vlan-aware mode, one of the rtnetlink
updates they produce was not handled correctly.
When the set of vlans active on a vlan-aware bridge itself
it being changed it produces RTM_NEWLINK message with AF_BRIDGE family
(e.g. with `bridge vlan add dev br0 vid 3 self`).
Unlike other messages arriving with AF_BRIDGE family - this one doesn't refer
to one of the member interfaces, but to the bridge itself as if it was its own member.
This message doesn't contain full information about bridge - mostly
about vlans in IFLA_AF_SPEC attribute. It does, however, refer to the bridge
interface itself via ifi_index parameter.
`libnl` parses such message into a link object with (AF_BRIDGE, <br-ifindex>) key.
At the same time, the regular rtnetlink message describing bridge interface itself
(one that arrives with AF_UNSPEC family and IFLA_LINKINFO/IFLA_INFO_KIND == bridge)
will also be parsed into link object with the same key (AF_BRIDGE, <br-ifindex>).
That is caused by the libnl classifying it internally as bridge (via IFLA_INFO_KIND)
and overriding its family to AF_BRIDGE.
Such collision results in an unexpected behavior when we have a cache
with the information about bridge (from AF_UNSPEC message) and then receive
notification produced by `bridge vlan add/del ... self`.
As both link entries have the same key - new one will override the old -
and we will have a misleading entry in cache, which doesn't contain
most of the information we've had about the bridge.
It also defies some established expectations about bridge interfaces in libnl.
E.g. `rtnl_link_is_bridge` is 1 for such entries, but `rtnl_link_get_type` is NULL.
This situation can be amended by implementing update mechanism for link objects.
With that, it is possible to properly handle such special rtnetlink messages
and merge information available in them into full bridge description.1 parent 49518ca commit dc81898
3 files changed
+51
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1126 | 1126 | | |
1127 | 1127 | | |
1128 | 1128 | | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
1129 | 1143 | | |
1130 | 1144 | | |
1131 | 1145 | | |
| |||
3215 | 3229 | | |
3216 | 3230 | | |
3217 | 3231 | | |
| 3232 | + | |
3218 | 3233 | | |
3219 | 3234 | | |
3220 | 3235 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
973 | 973 | | |
974 | 974 | | |
975 | 975 | | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
976 | 999 | | |
977 | 1000 | | |
978 | 1001 | | |
| |||
1851 | 1874 | | |
1852 | 1875 | | |
1853 | 1876 | | |
| 1877 | + | |
1854 | 1878 | | |
1855 | 1879 | | |
1856 | 1880 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
144 | 156 | | |
145 | 157 | | |
146 | 158 | | |
| |||
0 commit comments