From: Wilson Kok Date: Mon, 25 May 2015 13:39:31 +0000 (-0700) Subject: bridge: skip fdb add if the port shouldn't learn X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=eb8d7baae21584a7b27e79c2deca3eee72376ff0;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Nikolay Aleksandrov Signed-off-by: David S. Miller --- 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, 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 -EPERM; + fdb = fdb_find(head, addr, vid); if (fdb == NULL) { if (!(flags & NLM_F_CREATE))