diff options
author | Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp> | 2015-02-09 06:16:17 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-02-09 17:19:04 -0500 |
commit | 25d3b493a52d4ece811ba07881558fc7f6778fb8 (patch) | |
tree | 1f3e101ca4fd32471448cadaf0c8daf9ce15a529 /net/bridge/br_fdb.c | |
parent | b750f5b4273316b4bb4d0a4a474c1eeaf0833648 (diff) |
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: 5be5a2df40f0 ("bridge: Add filtering support for default_pvid")
Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_fdb.c')
-rw-r--r-- | net/bridge/br_fdb.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index cc36e59db7d7..c041f99f5a78 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c | |||
@@ -840,10 +840,9 @@ int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], | |||
840 | /* VID was specified, so use it. */ | 840 | /* VID was specified, so use it. */ |
841 | err = __br_fdb_add(ndm, p, addr, nlh_flags, vid); | 841 | err = __br_fdb_add(ndm, p, addr, nlh_flags, vid); |
842 | } else { | 842 | } else { |
843 | if (!pv || bitmap_empty(pv->vlan_bitmap, VLAN_N_VID)) { | 843 | err = __br_fdb_add(ndm, p, addr, nlh_flags, 0); |
844 | err = __br_fdb_add(ndm, p, addr, nlh_flags, 0); | 844 | if (err || !pv) |
845 | goto out; | 845 | goto out; |
846 | } | ||
847 | 846 | ||
848 | /* We have vlans configured on this port and user didn't | 847 | /* We have vlans configured on this port and user didn't |
849 | * specify a VLAN. To be nice, add/update entry for every | 848 | * 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 | 910 | ||
912 | err = __br_fdb_delete(p, addr, vid); | 911 | err = __br_fdb_delete(p, addr, vid); |
913 | } else { | 912 | } else { |
914 | if (!pv || bitmap_empty(pv->vlan_bitmap, VLAN_N_VID)) { | 913 | err = -ENOENT; |
915 | err = __br_fdb_delete(p, addr, 0); | 914 | err &= __br_fdb_delete(p, addr, 0); |
915 | if (!pv) | ||
916 | goto out; | 916 | goto out; |
917 | } | ||
918 | 917 | ||
919 | /* We have vlans configured on this port and user didn't | 918 | /* We have vlans configured on this port and user didn't |
920 | * specify a VLAN. To be nice, add/update entry for every | 919 | * specify a VLAN. To be nice, add/update entry for every |
921 | * vlan on this port. | 920 | * vlan on this port. |
922 | */ | 921 | */ |
923 | err = -ENOENT; | ||
924 | for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) { | 922 | for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) { |
925 | err &= __br_fdb_delete(p, addr, vid); | 923 | err &= __br_fdb_delete(p, addr, vid); |
926 | } | 924 | } |