aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_fdb.c
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2011-12-06 08:02:24 -0500
committerDavid S. Miller <davem@davemloft.net>2011-12-08 19:40:28 -0500
commitf58ee4e1a28b68ad94130a747d676cbc6644dbd1 (patch)
tree85f412fc18d4515bd844da0ca7dbaa23672041ea /net/bridge/br_fdb.c
parentf33f1fccbf67b3d9b310a4b09114b7c670320ad4 (diff)
bridge: refactor fdb_notify
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_fdb.c')
-rw-r--r--net/bridge/br_fdb.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 973813e34428..d9ca85b87971 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -347,7 +347,6 @@ static struct net_bridge_fdb_entry *fdb_create(struct hlist_head *head,
347 fdb->is_static = 0; 347 fdb->is_static = 0;
348 fdb->updated = fdb->used = jiffies; 348 fdb->updated = fdb->used = jiffies;
349 hlist_add_head_rcu(&fdb->hlist, head); 349 hlist_add_head_rcu(&fdb->hlist, head);
350 fdb_notify(fdb, RTM_NEWNEIGH);
351 } 350 }
352 return fdb; 351 return fdb;
353} 352}
@@ -379,6 +378,7 @@ static int fdb_insert(struct net_bridge *br, struct net_bridge_port *source,
379 return -ENOMEM; 378 return -ENOMEM;
380 379
381 fdb->is_local = fdb->is_static = 1; 380 fdb->is_local = fdb->is_static = 1;
381 fdb_notify(fdb, RTM_NEWNEIGH);
382 return 0; 382 return 0;
383} 383}
384 384
@@ -424,9 +424,11 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
424 } 424 }
425 } else { 425 } else {
426 spin_lock(&br->hash_lock); 426 spin_lock(&br->hash_lock);
427 if (likely(!fdb_find(head, addr))) 427 if (likely(!fdb_find(head, addr))) {
428 fdb_create(head, source, addr); 428 fdb = fdb_create(head, source, addr);
429 429 if (fdb)
430 fdb_notify(fdb, RTM_NEWNEIGH);
431 }
430 /* else we lose race and someone else inserts 432 /* else we lose race and someone else inserts
431 * it first, don't bother updating 433 * it first, don't bother updating
432 */ 434 */
@@ -572,6 +574,7 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr,
572 fdb = fdb_create(head, source, addr); 574 fdb = fdb_create(head, source, addr);
573 if (!fdb) 575 if (!fdb)
574 return -ENOMEM; 576 return -ENOMEM;
577 fdb_notify(fdb, RTM_NEWNEIGH);
575 } else { 578 } else {
576 if (flags & NLM_F_EXCL) 579 if (flags & NLM_F_EXCL)
577 return -EEXIST; 580 return -EEXIST;