kernel-ark/net/bridge
Toshiaki Makita 2b292fb4a5 bridge: Fix the way to check if a local fdb entry can be deleted
We should take into account the followings when deleting a local fdb
entry.

- nbp_vlan_find() can be used only when vid != 0 to check if an entry is
  deletable, because a fdb entry with vid 0 can exist at any time while
  nbp_vlan_find() always return false with vid 0.

  Example of problematic case:
    ip link set eth0 address 12:34:56:78:90:ab
    ip link set eth1 address 12:34:56:78:90:ab
    brctl addif br0 eth0
    brctl addif br0 eth1
    ip link set eth0 address aa:bb:cc:dd:ee:ff
  Then, the fdb entry 12:34:56:78:90:ab will be deleted even though the
  bridge port eth1 still has that address.

- The port to which the bridge device is attached might needs a local entry
  if its mac address is set manually.

  Example of problematic case:
    ip link set eth0 address 12:34:56:78:90:ab
    brctl addif br0 eth0
    ip link set br0 address 12:34:56:78:90:ab
    ip link set eth0 address aa:bb:cc:dd:ee:ff
  Then, the fdb still must have the entry 12:34:56:78:90:ab, but it will be
  deleted.

We can use br->dev->addr_assign_type to check if the address is manually
set or not, but I propose another approach.

Since we delete and insert local entries whenever changing mac address
of the bridge device, we can change dst of the entry to NULL regardless of
addr_assign_type when deleting an entry associated with a certain port,
and if it is found to be unnecessary later, then delete it.
That is, if changing mac address of a port, the entry might be changed
to its dst being NULL first, but is eventually deleted when recalculating
and changing bridge id.

This approach is especially useful when we want to share the code with
deleting vlan in which the bridge device might want such an entry regardless
of addr_assign_type, and makes things easy because we don't have to consider
if mac address of the bridge device will be changed or not at the time we
delete a local entry of a port, which means fdb code will not be bothered
even if the bridge id calculating logic is changed in the future.

Also, this change reduces inconsistent state, where frames whose dst is the
mac address of the bridge, can't reach the bridge because of premature fdb
entry deletion. This change reduces the possibility that the bridge device
replies unreachable mac address to arp requests, which could occur during
the short window between calling del_nbp() and br_stp_recalculate_bridge_id()
in br_del_if(). This will effective after br_fdb_delete_by_port() starts to
use the same code by following patch.

Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Acked-by: Vlad Yasevich <vyasevic@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-02-10 14:34:33 -08:00
..
netfilter netfilter: nf_tables: rename nft_do_chain_pktinfo() to nft_do_chain() 2014-01-09 20:17:16 +01:00
br_device.c bridge: Change local fdb entries whenever mac address of bridge device changes 2014-02-10 14:34:33 -08:00
br_fdb.c bridge: Fix the way to check if a local fdb entry can be deleted 2014-02-10 14:34:33 -08:00
br_forward.c bridge: remove unnecessary parentheses 2013-12-19 19:27:26 -05:00
br_if.c bridge: Change local fdb entries whenever mac address of bridge device changes 2014-02-10 14:34:33 -08:00
br_input.c bridge: Fix the way to find old local fdb entries in br_fdb_changeaddr 2014-02-10 14:34:33 -08:00
br_ioctl.c bridge: add space before '(/{', after ',', etc. 2013-12-19 19:27:26 -05:00
br_mdb.c Revert "bridge: only expire the mdb entry when query is received" 2013-10-22 14:41:02 -04:00
br_multicast.c bridge: use spin_lock_bh() in br_multicast_set_hash_max 2014-01-06 16:39:47 -05:00
br_netfilter.c bridge: change "foo* bar" to "foo *bar" 2013-12-19 19:27:26 -05:00
br_netlink.c netlink: cleanup rntl_af_register 2014-01-01 23:42:19 -05:00
br_notify.c net: convert resend IGMP to notifier event 2013-07-23 16:52:47 -07:00
br_private_stp.h net: 8021q/bluetooth/bridge/can/ceph: Remove extern from function prototypes 2013-10-19 19:12:11 -04:00
br_private.h bridge: Fix the way to check if a local fdb entry can be deleted 2014-02-10 14:34:33 -08:00
br_stp_bpdu.c br: fix use of ->rx_handler_data in code executed on non-rx_handler path 2013-12-06 15:41:40 -05:00
br_stp_if.c bridge: Change local fdb entries whenever mac address of bridge device changes 2014-02-10 14:34:33 -08:00
br_stp_timer.c bridge: add space before '(/{', after ',', etc. 2013-12-19 19:27:26 -05:00
br_stp.c bridge: Clamp forward_delay when enabling STP 2013-09-12 23:32:14 -04:00
br_sysfs_br.c bridge: use DEVICE_ATTR_xx macros 2014-01-06 16:40:46 -05:00
br_sysfs_if.c bridge: change "foo* bar" to "foo *bar" 2013-12-19 19:27:26 -05:00
br_vlan.c bridge: Fix the way to check if a local fdb entry can be deleted 2014-02-10 14:34:33 -08:00
br.c bridge: move br_net_exit() to br.c 2014-01-13 23:42:39 -08:00
Kconfig bridge: Add vlan filtering infrastructure 2013-02-13 19:41:46 -05:00
Makefile bridge: Add vlan filtering infrastructure 2013-02-13 19:41:46 -05:00