All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: roopa@cumulusnetworks.com
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	nolan@cumulusnetworks.com, shm@cumulusnetworks.com,
	wkok@cumulusnetworks.com
Subject: [PATCH v3 net-next] bridge: Add fdb dst check during fdb update
Date: Mon, 22 Apr 2013 15:56:49 -0700	[thread overview]
Message-ID: <20130422155649.2e4aebcf@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <1365968593-28725-1-git-send-email-roopa@cumulusnetworks.com>

The patch fixes a real oversight in the forwarding database management stuff.

A couple of minor tweaks.
 1. Always update used value but don't change 'updated' value unless changed.
 2. Rename notify flag to modified
 3. Add some whitespace.


From: roopa <roopa@cumulusnetworks.com>

Current bridge fdb update code does not seem to update the port
during fdb update. This patch adds a check for fdb dst (port)
change during fdb update. Also rearranges the call to
fdb_notify to send only one notification for create and update.

Changelog:
v2 - Change notify flag to bool

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

---
 net/bridge/br_fdb.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

--- a/net/bridge/br_fdb.c	2013-03-28 14:26:20.746064670 -0700
+++ b/net/bridge/br_fdb.c	2013-04-22 15:52:24.183494631 -0700
@@ -615,6 +615,7 @@ static int fdb_add_entry(struct net_brid
 	struct net_bridge *br = source->br;
 	struct hlist_head *head = &br->hash[br_mac_hash(addr, vid)];
 	struct net_bridge_fdb_entry *fdb;
+	bool modified = false;
 
 	fdb = fdb_find(head, addr, vid);
 	if (fdb == NULL) {
@@ -624,10 +625,16 @@ static int fdb_add_entry(struct net_brid
 		fdb = fdb_create(head, source, addr, vid);
 		if (!fdb)
 			return -ENOMEM;
-		fdb_notify(br, fdb, RTM_NEWNEIGH);
+
+		modified = true;
 	} else {
 		if (flags & NLM_F_EXCL)
 			return -EEXIST;
+
+		if (fdb->dst != source) {
+			fdb->dst = source;
+			modified = true;
+		}
 	}
 
 	if (fdb_to_nud(fdb) != state) {
@@ -639,7 +646,12 @@ static int fdb_add_entry(struct net_brid
 		} else
 			fdb->is_local = fdb->is_static = 0;
 
-		fdb->updated = fdb->used = jiffies;
+		modified = true;
+	}
+
+	fdb->used = jiffies;
+	if (modified) {
+		fdb->updated = jiffies;
 		fdb_notify(br, fdb, RTM_NEWNEIGH);
 	}
 

  parent reply	other threads:[~2013-04-22 22:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-14 19:43 [PATCH v2 net-next] bridge: Add fdb dst check during fdb update roopa
2013-04-19 20:51 ` David Miller
2013-04-22 20:12 ` David Miller
2013-04-22 22:56 ` Stephen Hemminger [this message]
2013-04-29 15:41   ` [PATCH v3 " 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=20130422155649.2e4aebcf@nehalam.linuxnetplumber.net \
    --to=stephen@networkplumber.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=nolan@cumulusnetworks.com \
    --cc=roopa@cumulusnetworks.com \
    --cc=shm@cumulusnetworks.com \
    --cc=wkok@cumulusnetworks.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.