Skip to contentSkip to conversation

bridge: Add fdb dst check during fdb update

PATCH Superseded [email protected] 2 participants 2 messages Apr 14, 2013

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bridge: Add fdb dst check during fdb update

From: roopa <[email protected]>

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.

---
 net/bridge/br_fdb.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
net/bridge/br_fdb.c +10 -1
index c581f12..7a7d920 100644
@@ -615,6 +615,7 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr,
 	struct net_bridge *br = source->br;
 	struct hlist_head *head = &br->hash[br_mac_hash(addr, vid)];
 	struct net_bridge_fdb_entry *fdb;
+	int notify = 0;
 
 	fdb = fdb_find(head, addr, vid);
 	if (fdb == NULL) {
@@ -624,7 +625,7 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr,
 		fdb = fdb_create(head, source, addr, vid);
 		if (!fdb)
 			return -ENOMEM;
-		fdb_notify(br, fdb, RTM_NEWNEIGH);
+		notify = 1;
 	} else {
 		if (flags & NLM_F_EXCL)
 			return -EEXIST;
@@ -638,7 +639,15 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr,
 			fdb->is_static = 1;
 		} else
 			fdb->is_local = fdb->is_static = 0;
+		notify = 1;
+	}
+
+	if (fdb->dst != source) {
+		fdb->dst = source;
+		notify = 1;
+	}
 
+	if (notify) {
 		fdb->updated = fdb->used = jiffies;
 		fdb_notify(br, fdb, RTM_NEWNEIGH);
 	}
Signature · 1 line
1.7.10.4
#1 lore raw

net/bridge/br_fdb.c static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr, · line 618

Quoted 9 lines · On Sun, 14 Apr 2013 at 04:58 GMT, [email protected]…
net/bridge/br_fdb.c +1 -0
index c581f12..7a7d920 100644
@@ -615,6 +615,7 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr,
 	struct net_bridge *br = source->br;
 	struct hlist_head *head = &br->hash[br_mac_hash(addr, vid)];
 	struct net_bridge_fdb_entry *fdb;
+	int notify = 0;

Make it 'bool'.