Commit f58ee4e1 authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

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: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f33f1fcc
...@@ -347,7 +347,6 @@ static struct net_bridge_fdb_entry *fdb_create(struct hlist_head *head, ...@@ -347,7 +347,6 @@ static struct net_bridge_fdb_entry *fdb_create(struct hlist_head *head,
fdb->is_static = 0; fdb->is_static = 0;
fdb->updated = fdb->used = jiffies; fdb->updated = fdb->used = jiffies;
hlist_add_head_rcu(&fdb->hlist, head); hlist_add_head_rcu(&fdb->hlist, head);
fdb_notify(fdb, RTM_NEWNEIGH);
} }
return fdb; return fdb;
} }
...@@ -379,6 +378,7 @@ static int fdb_insert(struct net_bridge *br, struct net_bridge_port *source, ...@@ -379,6 +378,7 @@ static int fdb_insert(struct net_bridge *br, struct net_bridge_port *source,
return -ENOMEM; return -ENOMEM;
fdb->is_local = fdb->is_static = 1; fdb->is_local = fdb->is_static = 1;
fdb_notify(fdb, RTM_NEWNEIGH);
return 0; return 0;
} }
...@@ -424,9 +424,11 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source, ...@@ -424,9 +424,11 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
} }
} else { } else {
spin_lock(&br->hash_lock); spin_lock(&br->hash_lock);
if (likely(!fdb_find(head, addr))) if (likely(!fdb_find(head, addr))) {
fdb_create(head, source, addr); fdb = fdb_create(head, source, addr);
if (fdb)
fdb_notify(fdb, RTM_NEWNEIGH);
}
/* else we lose race and someone else inserts /* else we lose race and someone else inserts
* it first, don't bother updating * it first, don't bother updating
*/ */
...@@ -572,6 +574,7 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr, ...@@ -572,6 +574,7 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr,
fdb = fdb_create(head, source, addr); fdb = fdb_create(head, source, addr);
if (!fdb) if (!fdb)
return -ENOMEM; return -ENOMEM;
fdb_notify(fdb, RTM_NEWNEIGH);
} else { } else {
if (flags & NLM_F_EXCL) if (flags & NLM_F_EXCL)
return -EEXIST; return -EEXIST;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment