diff options
author | stephen hemminger <shemminger@vyatta.com> | 2011-12-06 13:02:24 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-12-08 19:40:28 -0500 |
commit | f58ee4e1a28b68ad94130a747d676cbc6644dbd1 (patch) | |
tree | 85f412fc18d4515bd844da0ca7dbaa23672041ea /net/bridge | |
parent | f33f1fccbf67b3d9b310a4b09114b7c670320ad4 (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')
-rw-r--r-- | net/bridge/br_fdb.c | 11 |
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, 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 *br, struct net_bridge_port *source, 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, struct net_bridge_port *source, } } 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_bridge_port *source, const __u8 *addr, fdb = fdb_create(head, source, addr); if (!fdb) return -ENOMEM; + fdb_notify(fdb, RTM_NEWNEIGH); } else { if (flags & NLM_F_EXCL) return -EEXIST; |