Commit 25d3b493 authored by Toshiaki Makita's avatar Toshiaki Makita Committed by David S. Miller

bridge: Fix inability to add non-vlan fdb entry

Bridge's default_pvid adds a vid by default, by which we cannot add a
non-vlan fdb entry by default, because br_fdb_add() adds fdb entries for
all vlans instead of a non-vlan one when any vlan is configured.

 # ip link add br0 type bridge
 # ip link set eth0 master br0
 # bridge fdb add 12:34:56:78:90:ab dev eth0 master temp
 # bridge fdb show brport eth0 | grep 12:34:56:78:90:ab
 12:34:56:78:90:ab dev eth0 vlan 1 static

We expect a non-vlan fdb entry as well as vlan 1:
 12:34:56:78:90:ab dev eth0 static

To fix this, we need to insert a non-vlan fdb entry if vlan is not
specified, even when any vlan is configured.

Fixes: 5be5a2df ("bridge: Add filtering support for default_pvid")
Signed-off-by: default avatarToshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b750f5b4
...@@ -840,10 +840,9 @@ int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], ...@@ -840,10 +840,9 @@ int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
/* VID was specified, so use it. */ /* VID was specified, so use it. */
err = __br_fdb_add(ndm, p, addr, nlh_flags, vid); err = __br_fdb_add(ndm, p, addr, nlh_flags, vid);
} else { } else {
if (!pv || bitmap_empty(pv->vlan_bitmap, VLAN_N_VID)) { err = __br_fdb_add(ndm, p, addr, nlh_flags, 0);
err = __br_fdb_add(ndm, p, addr, nlh_flags, 0); if (err || !pv)
goto out; goto out;
}
/* We have vlans configured on this port and user didn't /* We have vlans configured on this port and user didn't
* specify a VLAN. To be nice, add/update entry for every * specify a VLAN. To be nice, add/update entry for every
...@@ -911,16 +910,15 @@ int br_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[], ...@@ -911,16 +910,15 @@ int br_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[],
err = __br_fdb_delete(p, addr, vid); err = __br_fdb_delete(p, addr, vid);
} else { } else {
if (!pv || bitmap_empty(pv->vlan_bitmap, VLAN_N_VID)) { err = -ENOENT;
err = __br_fdb_delete(p, addr, 0); err &= __br_fdb_delete(p, addr, 0);
if (!pv)
goto out; goto out;
}
/* We have vlans configured on this port and user didn't /* We have vlans configured on this port and user didn't
* specify a VLAN. To be nice, add/update entry for every * specify a VLAN. To be nice, add/update entry for every
* vlan on this port. * vlan on this port.
*/ */
err = -ENOENT;
for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) { for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) {
err &= __br_fdb_delete(p, addr, vid); err &= __br_fdb_delete(p, addr, vid);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment