bridge: Don't include NDA_VLAN for FDB entries with vid 0
authorToshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Wed, 30 Jul 2014 04:31:51 +0000 (13:31 +0900)
committerDavid S. Miller <davem@davemloft.net>
Thu, 31 Jul 2014 19:18:44 +0000 (12:18 -0700)
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>
net/bridge/br_fdb.c

index b524c36c12731b6c84a7587125fdf2db6417c830..02359e81f86ec88e67aa1a34ac7d38b32ce89d2c 100644 (file)
@@ -631,7 +631,7 @@ static int fdb_fill_info(struct sk_buff *skb, const struct net_bridge *br,
        if (nla_put(skb, NDA_CACHEINFO, sizeof(ci), &ci))
                goto nla_put_failure;
 
-       if (nla_put(skb, NDA_VLAN, sizeof(u16), &fdb->vlan_id))
+       if (fdb->vlan_id && nla_put(skb, NDA_VLAN, sizeof(u16), &fdb->vlan_id))
                goto nla_put_failure;
 
        return nlmsg_end(skb, nlh);