mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: michael-dev <michael-dev@fami-braun.de>
To: <stephen@networkplumber.org>
Cc: <davem@davemloft.net>, <netdev@vger.kernel.org>,
	<bridge@lists.linux-foundation.org>,
	<linux-kernel@vger.kernel.org>, <projekt-wlan@fem.tu-ilmenau.de>
Subject: [PATCH] Notify userspace about bridge learning MAC on new port
Date: Mon, 15 Apr 2013 12:29:10 +0200	[thread overview]
Message-ID: <7a31d9fe5bc9b65d4ffe6e03cbd2823f@fami-braun.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 491 bytes --]

Hi,

currently, the userspace is informed about the port the MAC is learned 
on a bridge and about the bridge removing the MAC from its forwarding 
table, but not when the MAC is learned on a different port. This is 
inconsistent and makes it difficult for applications to keep track of 
all MACs learned by a bridge on a subset of its ports.

Please find attached a patch that fixes this by sending an RTM_NEWNEIGH 
message when the forwarding destination port changes.

Regards,
  M. Braun

[-- Attachment #2: 999-make-bridge-notify-switched-port.diff --]
[-- Type: text/plain, Size: 1213 bytes --]

Notify userspace about bridge learning MAC on new port

Currently, the userspace is informed about the port the MAC is learned on a
bridge and about the bridge removing the MAC from its forwarding table, but not
when the MAC is learned on a different port.
This is inconsistent and makes it difficult for applications to keep track
of all MACs learned by a bridge on a subset of its ports.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>

--- a/net/bridge/br_fdb.c	2013-04-15 11:21:51.638963668 +0200
+++ b/net/bridge/br_fdb.c	2013-04-15 11:23:55.941166319 +0200
@@ -408,6 +408,7 @@ static int fdb_insert(struct net_bridge
 {
 	struct hlist_head *head = &br->hash[br_mac_hash(addr, vid)];
 	struct net_bridge_fdb_entry *fdb;
+	struct net_bridge_port *origsrc;
 
 	if (!is_valid_ether_addr(addr))
 		return -EINVAL;
@@ -471,8 +472,12 @@ void br_fdb_update(struct net_bridge *br
 					source->dev->name);
 		} else {
 			/* fastpath: update of existing entry */
+			origsrc = fdb->dst;
 			fdb->dst = source;
 			fdb->updated = jiffies;
+			/* notify applications of modified slave device */
+			if (origsrc != source)
+				fdb_notify(br, fdb, RTM_NEWNEIGH);
 		}
 	} else {
 		spin_lock(&br->hash_lock);

                 reply	other threads:[~2013-04-15 10:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7a31d9fe5bc9b65d4ffe6e03cbd2823f@fami-braun.de \
    --to=michael-dev@fami-braun.de \
    --cc=bridge@lists.linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=projekt-wlan@fem.tu-ilmenau.de \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®