Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bridge: Don't include NDA_VLAN for FDB entries with vid 0

An FDB entry with vlan_id 0 doesn't mean it is used in vlan 0, but used when
vlan_filtering is disabled.

There is inconsistency around NDA_VLAN whose payload is 0 - even if we add
an entry by RTM_NEWNEIGH without any NDA_VLAN, and even though adding an
entry with NDA_VLAN 0 is prohibited, we get an entry with NDA_VLAN 0 by
RTM_GETNEIGH.

Dumping an FDB entry with vlan_id 0 shouldn't include NDA_VLAN.

Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Toshiaki Makita and committed by
David S. Miller
47fab41a 7afcaec4

+1 -1
+1 -1
net/bridge/br_fdb.c
··· 631 631 if (nla_put(skb, NDA_CACHEINFO, sizeof(ci), &ci)) 632 632 goto nla_put_failure; 633 633 634 - if (nla_put(skb, NDA_VLAN, sizeof(u16), &fdb->vlan_id)) 634 + if (fdb->vlan_id && nla_put(skb, NDA_VLAN, sizeof(u16), &fdb->vlan_id)) 635 635 goto nla_put_failure; 636 636 637 637 return nlmsg_end(skb, nlh);