NL_CAPABILITY_RTNL_LINK_PARSE_GRE_REMOTE = 13,
#define NL_CAPABILITY_RTNL_LINK_PARSE_GRE_REMOTE NL_CAPABILITY_RTNL_LINK_PARSE_GRE_REMOTE
+ /**
+ * Don't skip over vlan ingress-map entries with "to" field zero when serializing
+ * a netlink message. Previously such entires would be ignored which inhibits the
+ * user from clearing ingress map entries.
+ */
+ NL_CAPABILITY_RTNL_LINK_VLAN_INGRESS_MAP_CLEAR = 14,
+#define NL_CAPABILITY_RTNL_LINK_VLAN_INGRESS_MAP_CLEAR NL_CAPABILITY_RTNL_LINK_VLAN_INGRESS_MAP_CLEAR
+
__NL_CAPABILITY_MAX,
NL_CAPABILITY_MAX = (__NL_CAPABILITY_MAX - 1),
#define NL_CAPABILITY_MAX NL_CAPABILITY_MAX
{
uint16_t vi_vlan_id;
uint16_t vi_protocol;
+ unsigned int vi_ingress_qos_mask:(VLAN_PRIO_MAX+1);
uint32_t vi_flags;
uint32_t vi_flags_mask;
uint32_t vi_ingress_qos[VLAN_PRIO_MAX+1];
struct nlattr *nla;
int remaining;
+ vi->vi_ingress_qos_mask = 0;
memset(vi->vi_ingress_qos, 0, sizeof(vi->vi_ingress_qos));
nla_for_each_nested(nla, tb[IFLA_VLAN_INGRESS_QOS], remaining) {
return -NLE_INVAL;
}
+ /* Kernel will not explicitly serialize mappings with "to" zero
+ * (although they are implicitly set).
+ *
+ * Thus we only mark those as "set" which are explicitly sent.
+ * That is similar to what we do with the egress map and it preserves
+ * previous behavior before NL_CAPABILITY_RTNL_LINK_VLAN_INGRESS_MAP_CLEAR.
+ *
+ * It matters only when a received object is send back to kernel to modify
+ * the link.
+ */
+ vi->vi_ingress_qos_mask |= (1 << map->from);
vi->vi_ingress_qos[map->from] = map->to;
}
nl_dump_line(p,
" ingress vlan prio -> qos/socket prio mapping:\n");
for (i = 0, printed = 0; i <= VLAN_PRIO_MAX; i++) {
- if (vi->vi_ingress_qos[i]) {
+ if (vi->vi_ingress_qos_mask & (1 << i)) {
if (printed == 0)
nl_dump_line(p, " ");
nl_dump(p, "%x -> %#08x, ",
goto nla_put_failure;
for (i = 0; i <= VLAN_PRIO_MAX; i++) {
- if (vi->vi_ingress_qos[i]) {
+ if (vi->vi_ingress_qos_mask & (1 << i)) {
map.from = i;
map.to = vi->vi_ingress_qos[i];
if (from < 0 || from > VLAN_PRIO_MAX)
return -NLE_INVAL;
+ vi->vi_ingress_qos_mask |= (1 << from);
vi->vi_ingress_qos[from] = to;
vi->vi_mask |= VLAN_HAS_INGRESS_QOS;
NL_CAPABILITY_VERSION_3_2_27,
NL_CAPABILITY_RTNL_LINK_VLAN_PROTOCOL_SERIALZE,
NL_CAPABILITY_RTNL_LINK_PARSE_GRE_REMOTE,
- 0,
+ NL_CAPABILITY_RTNL_LINK_VLAN_INGRESS_MAP_CLEAR,
0,
0),
/* IMPORTANT: these capability numbers are intended to be universal and stable