diff options
author | Wilson Kok <wkok@cumulusnetworks.com> | 2015-05-25 09:39:31 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-05-25 20:29:54 -0400 |
commit | eb8d7baae21584a7b27e79c2deca3eee72376ff0 (patch) | |
tree | d8bbfc35fd7d7021a31fa0cc941bbaec8ef74ab8 | |
parent | d4969581452be430135ba5040c5b6c9023c1d461 (diff) |
bridge: skip fdb add if the port shouldn't learn
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/bridge/br_fdb.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index e0670d7054f9..7896cf143045 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, | |||
736 | struct net_bridge_fdb_entry *fdb; | 736 | struct net_bridge_fdb_entry *fdb; |
737 | bool modified = false; | 737 | bool modified = false; |
738 | 738 | ||
739 | /* If the port cannot learn allow only local and static entries */ | ||
740 | if (!(state & NUD_PERMANENT) && !(state & NUD_NOARP) && | ||
741 | !(source->state == BR_STATE_LEARNING || | ||
742 | source->state == BR_STATE_FORWARDING)) | ||
743 | return -EPERM; | ||
744 | |||
739 | fdb = fdb_find(head, addr, vid); | 745 | fdb = fdb_find(head, addr, vid); |
740 | if (fdb == NULL) { | 746 | if (fdb == NULL) { |
741 | if (!(flags & NLM_F_CREATE)) | 747 | if (!(flags & NLM_F_CREATE)) |