public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta•com>
To: David Miller <davem@davemloft•net>
Cc: netdev@vger•kernel.org
Subject: [PATCH net-next 1/3] bridge: refactor fdb_notify
Date: Tue, 06 Dec 2011 15:02:24 -0800	[thread overview]
Message-ID: <20111206230315.904534660@vyatta.com> (raw)
In-Reply-To: 20111206230223.191544130@vyatta.com

[-- Attachment #1: br-local-notify.patch --]
[-- Type: text/plain, Size: 1338 bytes --]

Move fdb_notify outside of fdb_create. This fixes the problem
that notification of local entries are not flagged correctly.

Signed-off-by: Stephen Hemminger <shemminger@vyatta•com>

--- a/net/bridge/br_fdb.c	2011-12-06 14:58:24.122561721 -0800
+++ b/net/bridge/br_fdb.c	2011-12-06 15:01:23.656521166 -0800
@@ -347,7 +347,6 @@ static struct net_bridge_fdb_entry *fdb_
 		fdb->is_static = 0;
 		fdb->updated = fdb->used = jiffies;
 		hlist_add_head_rcu(&fdb->hlist, head);
-		fdb_notify(fdb, RTM_NEWNEIGH);
 	}
 	return fdb;
 }
@@ -379,6 +378,7 @@ static int fdb_insert(struct net_bridge
 		return -ENOMEM;
 
 	fdb->is_local = fdb->is_static = 1;
+	fdb_notify(fdb, RTM_NEWNEIGH);
 	return 0;
 }
 
@@ -424,9 +424,11 @@ void br_fdb_update(struct net_bridge *br
 		}
 	} else {
 		spin_lock(&br->hash_lock);
-		if (likely(!fdb_find(head, addr)))
-			fdb_create(head, source, addr);
-
+		if (likely(!fdb_find(head, addr))) {
+			fdb = fdb_create(head, source, addr);
+			if (fdb)
+				fdb_notify(fdb, RTM_NEWNEIGH);
+		}
 		/* else  we lose race and someone else inserts
 		 * it first, don't bother updating
 		 */
@@ -572,6 +574,7 @@ static int fdb_add_entry(struct net_brid
 		fdb = fdb_create(head, source, addr);
 		if (!fdb)
 			return -ENOMEM;
+		fdb_notify(fdb, RTM_NEWNEIGH);
 	} else {
 		if (flags & NLM_F_EXCL)
 			return -EEXIST;

  reply	other threads:[~2011-12-06 23:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-06 23:02 [PATCH net-next 0/3] bridge forwarding database patches Stephen Hemminger
2011-12-06 23:02 ` Stephen Hemminger [this message]
2011-12-06 23:02 ` [PATCH net-next 2/3] bridge: rearrange fdb notifications Stephen Hemminger
2011-12-08 17:17   ` [PATCH net-next 2/3] bridge: rearrange fdb notifications (v2) Stephen Hemminger
2011-12-06 23:02 ` [PATCH net-next 3/3] bridge: add local MAC address to forwarding table Stephen Hemminger
2011-12-08 17:17   ` [PATCH net-next 3/3] bridge: add local MAC address to forwarding table (v2) Stephen Hemminger
2011-12-07 18:50 ` [PATCH net-next 0/3] bridge forwarding database patches David Miller
2011-12-08 17:18   ` Stephen Hemminger
2011-12-09  0:56     ` 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=20111206230315.904534660@vyatta.com \
    --to=shemminger@vyatta$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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