提交 eb8d7baa 编写于 作者: W Wilson Kok 提交者: David S. Miller

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: NWilson Kok <wkok@cumulusnetworks.com>
Signed-off-by: NNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 d4969581
...@@ -736,6 +736,12 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr, ...@@ -736,6 +736,12 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr,
struct net_bridge_fdb_entry *fdb; struct net_bridge_fdb_entry *fdb;
bool modified = false; 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 -EPERM;
fdb = fdb_find(head, addr, vid); fdb = fdb_find(head, addr, vid);
if (fdb == NULL) { if (fdb == NULL) {
if (!(flags & NLM_F_CREATE)) if (!(flags & NLM_F_CREATE))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册