All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bridge] [PATCH net-next] bridge: skip fdb add if the port shouldn't learn
@ 2015-05-21 10:42 ` Nikolay Aleksandrov
  0 siblings, 0 replies; 30+ messages in thread
From: Nikolay Aleksandrov @ 2015-05-21 10:42 UTC (permalink / raw)
  To: netdev; +Cc: Nikolay Aleksandrov, bridge, davem, wkok

From: Wilson Kok <wkok@cumulusnetworks.com>

Check in fdb_add_entry() if the source port should learn, similar
check is used in br_fdb_update.
Note that new fdb entries which are added manually or
as local ones are still permitted.
This patch has been tested by running traffic via a bridge port and
switching the port's state, also by manually adding/removing entries
from the bridge's fdb.

Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
Nik: Maybe it'd be better if we returned an error even though it
     doesn't look necessary. I'm open to suggestions.

 net/bridge/br_fdb.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index e0670d7054f9..27de0b7bd76b 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -736,6 +736,12 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr,
 	struct net_bridge_fdb_entry *fdb;
 	bool modified = false;
 
+	/* If the port cannot learn allow only local and static entries */
+	if (!(state & NUD_PERMANENT) && !(state & NUD_NOARP) &&
+	    !(source->state == BR_STATE_LEARNING ||
+	      source->state == BR_STATE_FORWARDING))
+		return 0;
+
 	fdb = fdb_find(head, addr, vid);
 	if (fdb == NULL) {
 		if (!(flags & NLM_F_CREATE))
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2015-06-04  8:14 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-21 10:42 [Bridge] [PATCH net-next] bridge: skip fdb add if the port shouldn't learn Nikolay Aleksandrov
2015-05-21 10:42 ` Nikolay Aleksandrov
2015-05-25  2:59 ` [Bridge] " David Miller
2015-05-25  2:59   ` David Miller
2015-05-25 11:35   ` [Bridge] " Nikolay Aleksandrov
2015-05-25 11:35     ` Nikolay Aleksandrov
2015-05-25 11:41   ` [Bridge] " Nikolay Aleksandrov
2015-05-25 11:41     ` Nikolay Aleksandrov
2015-05-25 13:39 ` [Bridge] [PATCH net-next v2] " Nikolay Aleksandrov
2015-05-25 13:39   ` Nikolay Aleksandrov
2015-05-26 17:28 ` [Bridge] [PATCH net-next] " Stephen Hemminger
2015-05-26 17:28   ` Stephen Hemminger
2015-05-27  7:05   ` [Bridge] " Nikolay Aleksandrov
2015-05-27  7:05     ` Nikolay Aleksandrov
2015-05-27  7:59     ` [Bridge] " Scott Feldman
2015-05-27  7:59       ` Scott Feldman
2015-05-27  8:35       ` [Bridge] " Nikolay Aleksandrov
2015-05-27  8:35         ` Nikolay Aleksandrov
2015-05-27 16:01         ` [Bridge] " Scott Feldman
2015-05-27 16:01           ` Scott Feldman
2015-05-27 16:14           ` [Bridge] " Nikolay Aleksandrov
2015-05-27 16:14             ` Nikolay Aleksandrov
2015-05-27 20:41             ` [Bridge] " Scott Feldman
2015-05-27 20:41               ` Scott Feldman
2015-06-02 17:14           ` [Bridge] " roopa
2015-06-02 17:14             ` roopa
2015-06-03  5:57             ` [Bridge] " Scott Feldman
2015-06-03  5:57               ` Scott Feldman
2015-06-04  8:14               ` [Bridge] " Nikolay Aleksandrov
2015-06-04  8:14                 ` Nikolay Aleksandrov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.