Commit b0a397fb authored by roopa's avatar roopa Committed by David S. Miller

bridge: Add fdb dst check during fdb update

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: default avatarRoopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: default avatarStephen Hemminger <stephen@networkplumber.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c39904a0
...@@ -615,6 +615,7 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr, ...@@ -615,6 +615,7 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr,
struct net_bridge *br = source->br; struct net_bridge *br = source->br;
struct hlist_head *head = &br->hash[br_mac_hash(addr, vid)]; struct hlist_head *head = &br->hash[br_mac_hash(addr, vid)];
struct net_bridge_fdb_entry *fdb; struct net_bridge_fdb_entry *fdb;
bool modified = false;
fdb = fdb_find(head, addr, vid); fdb = fdb_find(head, addr, vid);
if (fdb == NULL) { if (fdb == NULL) {
...@@ -624,10 +625,16 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr, ...@@ -624,10 +625,16 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr,
fdb = fdb_create(head, source, addr, vid); fdb = fdb_create(head, source, addr, vid);
if (!fdb) if (!fdb)
return -ENOMEM; return -ENOMEM;
fdb_notify(br, fdb, RTM_NEWNEIGH);
modified = true;
} else { } else {
if (flags & NLM_F_EXCL) if (flags & NLM_F_EXCL)
return -EEXIST; return -EEXIST;
if (fdb->dst != source) {
fdb->dst = source;
modified = true;
}
} }
if (fdb_to_nud(fdb) != state) { if (fdb_to_nud(fdb) != state) {
...@@ -639,7 +646,12 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr, ...@@ -639,7 +646,12 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr,
} else } else
fdb->is_local = fdb->is_static = 0; 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); fdb_notify(br, fdb, RTM_NEWNEIGH);
} }
......
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