From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sn1nam01on0091.outbound.protection.outlook.com ([104.47.32.91]:51937 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756464AbeDIAcO (ORCPT ); Sun, 8 Apr 2018 20:32:14 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Nikolay Aleksandrov , Roopa Prabhu , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 202/293] bridge: allow ext learned entries to change ports Date: Mon, 9 Apr 2018 00:25:31 +0000 Message-ID: <20180409002239.163177-202-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Nikolay Aleksandrov [ Upstream commit 7597b266c56feaad7d4e6e65822766e929407da2 ] current code silently ignores change of port in the request message. This patch makes sure the port is modified and notification is sent to userspace. Fixes: cf6b8e1eedff ("bridge: add API to notify bridge driver of learned FB= D on offloaded device") Signed-off-by: Nikolay Aleksandrov Signed-off-by: Roopa Prabhu Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/bridge/br_fdb.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index 6b43c8c88f19..f32b8138f9c8 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -1101,8 +1101,9 @@ void br_fdb_unsync_static(struct net_bridge *br, stru= ct net_bridge_port *p) int br_fdb_external_learn_add(struct net_bridge *br, struct net_bridge_por= t *p, const unsigned char *addr, u16 vid) { - struct hlist_head *head; struct net_bridge_fdb_entry *fdb; + struct hlist_head *head; + bool modified =3D false; int err =3D 0; =20 ASSERT_RTNL(); @@ -1118,14 +1119,25 @@ int br_fdb_external_learn_add(struct net_bridge *br= , struct net_bridge_port *p, } fdb->added_by_external_learn =3D 1; fdb_notify(br, fdb, RTM_NEWNEIGH); - } else if (fdb->added_by_external_learn) { - /* Refresh entry */ - fdb->updated =3D fdb->used =3D jiffies; - } else if (!fdb->added_by_user) { - /* Take over SW learned entry */ - fdb->added_by_external_learn =3D 1; + } else { fdb->updated =3D jiffies; - fdb_notify(br, fdb, RTM_NEWNEIGH); + + if (fdb->dst !=3D p) { + fdb->dst =3D p; + modified =3D true; + } + + if (fdb->added_by_external_learn) { + /* Refresh entry */ + fdb->used =3D jiffies; + } else if (!fdb->added_by_user) { + /* Take over SW learned entry */ + fdb->added_by_external_learn =3D 1; + modified =3D true; + } + + if (modified) + fdb_notify(br, fdb, RTM_NEWNEIGH); } =20 err_unlock: --=20 2.15.1