From: Vlad Yasevich <vyasevic@redhat.com>
To: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>,
"David S . Miller" <davem@davemloft.net>,
Stephen Hemminger <stephen@networkplumber.org>,
netdev@vger.kernel.org
Subject: Re: [PATCH v3 net 7/9] bridge: Properly check if local fdb entry can be deleted in br_fdb_delete_by_port
Date: Mon, 10 Feb 2014 12:37:04 -0500 [thread overview]
Message-ID: <52F90E40.5000900@redhat.com> (raw)
In-Reply-To: <1391759306-24956-8-git-send-email-makita.toshiaki@lab.ntt.co.jp>
On 02/07/2014 02:48 AM, Toshiaki Makita wrote:
> br_fdb_delete_by_port() doesn't care about vlan and mac address of the
> bridge device.
>
> As the check is almost the same as mac address changing, slightly modify
> fdb_delete_local() and use it.
>
> Note that we can always set added_by_user to 0 in fdb_delete_local() because
> - br_fdb_delete_by_port() calls fdb_delete_local() for local entries
> regardless of its added_by_user. In this case, we have to check if another
> port has the same address and vlan, and if found, we have to create the
> entry (by changing dst). This is kernel-added entry, not user-added.
> - br_fdb_changeaddr() doesn't call fdb_delete_local() for user-added entry.
>
> Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Acked-by: Vlad Yasevich <vyasevic@redhat.com>
-vlad
> ---
> net/bridge/br_fdb.c | 25 ++++++-------------------
> 1 file changed, 6 insertions(+), 19 deletions(-)
>
> diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
> index 15bf13d..43e54d1 100644
> --- a/net/bridge/br_fdb.c
> +++ b/net/bridge/br_fdb.c
> @@ -103,6 +103,7 @@ static void fdb_delete_local(struct net_bridge *br,
> if (op != p && ether_addr_equal(op->dev->dev_addr, addr) &&
> (!vid || nbp_vlan_find(op, vid))) {
> f->dst = op;
> + f->added_by_user = 0;
> return;
> }
> }
> @@ -111,6 +112,7 @@ static void fdb_delete_local(struct net_bridge *br,
> if (p && ether_addr_equal(br->dev->dev_addr, addr) &&
> (!vid || br_vlan_find(br, vid))) {
> f->dst = NULL;
> + f->added_by_user = 0;
> return;
> }
>
> @@ -261,26 +263,11 @@ void br_fdb_delete_by_port(struct net_bridge *br,
>
> if (f->is_static && !do_all)
> continue;
> - /*
> - * if multiple ports all have the same device address
> - * then when one port is deleted, assign
> - * the local entry to other port
> - */
> - if (f->is_local) {
> - struct net_bridge_port *op;
> - list_for_each_entry(op, &br->port_list, list) {
> - if (op != p &&
> - ether_addr_equal(op->dev->dev_addr,
> - f->addr.addr)) {
> - f->dst = op;
> - f->added_by_user = 0;
> - goto skip_delete;
> - }
> - }
> - }
>
> - fdb_delete(br, f);
> - skip_delete: ;
> + if (f->is_local)
> + fdb_delete_local(br, p, f);
> + else
> + fdb_delete(br, f);
> }
> }
> spin_unlock_bh(&br->hash_lock);
>
next prev parent reply other threads:[~2014-02-10 17:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-07 7:48 [PATCH v3 net 0/9] bridge: Fix corner case problems around local fdb entries Toshiaki Makita
2014-02-07 7:48 ` [PATCH v3 net 1/9] bridge: Fix the way to find old local fdb entries in br_fdb_changeaddr Toshiaki Makita
2014-02-07 7:48 ` [PATCH v3 net 2/9] bridge: Fix the way to insert new " Toshiaki Makita
2014-02-07 16:31 ` Stephen Hemminger
2014-02-08 2:43 ` Toshiaki Makita
2014-02-07 7:48 ` [PATCH v3 net 3/9] bridge: Fix the way to find old local fdb entries in br_fdb_change_mac_address Toshiaki Makita
2014-02-07 7:48 ` [PATCH v3 net 4/9] bridge: Change local fdb entries whenever mac address of bridge device changes Toshiaki Makita
2014-02-07 7:48 ` [PATCH v3 net 5/9] bridge: Fix the way to check if a local fdb entry can be deleted Toshiaki Makita
2014-02-10 17:22 ` Vlad Yasevich
2014-02-07 7:48 ` [PATCH v3 net 6/9] bridge: Properly check if local fdb entry can be deleted in br_fdb_change_mac_address Toshiaki Makita
2014-02-07 7:48 ` [PATCH v3 net 7/9] bridge: Properly check if local fdb entry can be deleted in br_fdb_delete_by_port Toshiaki Makita
2014-02-10 17:37 ` Vlad Yasevich [this message]
2014-02-07 7:48 ` [PATCH v3 net 8/9] bridge: Properly check if local fdb entry can be deleted when deleting vlan Toshiaki Makita
2014-02-07 7:48 ` [PATCH v3 net 9/9] bridge: Prevent possible race condition in br_fdb_change_mac_address Toshiaki Makita
2014-02-10 22:36 ` [PATCH v3 net 0/9] bridge: Fix corner case problems around local fdb entries David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52F90E40.5000900@redhat.com \
--to=vyasevic@redhat.com \
--cc=davem@davemloft.net \
--cc=makita.toshiaki@lab.ntt.co.jp \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).