From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XcYlSFKFIgpm8tcAstvWlJ5bLgqUHukHY6Vh4zxSntM=; b=LDiwurYDNvT1uBMVk+m8OU3Crao2sfd10bs1dvKwBVW53bNy3dduaVq9Fyy7GM/6vhfEHcB95Hu5PBhOJ4JhZamDE/EcW+WYzWxTpvjqQWbZLPtATG23DstTqxaqSaOkEcljs0KmVMVl2lqigVehf+Y85ePzoR1rZIwcdr49np0= From: Vladimir Oltean Date: Tue, 10 Aug 2021 10:09:29 +0000 Message-ID: <20210810100928.uk7dfstrnts2may4@skbuf> References: <20210801231730.7493-1-vladimir.oltean@nxp.com> <20210809160521.audhnv7o2tugwtmp@skbuf> In-Reply-To: Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [Bridge] [PATCH net] net: bridge: validate the NUD_PERMANENT bit when adding an extern_learn FDB entry List-Id: Linux Ethernet Bridging List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ido Schimmel Cc: "syzbot+9ba1174359adba5a5b7c@syzkaller.appspotmail.com" , Jiri Pirko , "netdev@vger.kernel.org" , "bridge@lists.linux-foundation.org" , syzkaller-bugs , "nikolay@nvidia.com" , Roopa Prabhu , Jakub Kicinski , "David S. Miller" On Tue, Aug 10, 2021 at 09:46:34AM +0300, Ido Schimmel wrote: > On Mon, Aug 09, 2021 at 04:05:22PM +0000, Vladimir Oltean wrote: > > On Mon, Aug 09, 2021 at 03:16:40PM +0300, Ido Schimmel wrote: > > > I have at least once selftest where I forgot the 'static' keyword: > > > > > > bridge fdb add de:ad:be:ef:13:37 dev $swp1 master extern_learn vlan 1 > > > > > > This patch breaks the test when run against both the kernel and hardw= are > > > data paths. I don't mind patching these tests, but we might get more > > > reports in the future. > >=20 > > Is it the 'static' keyword that you forgot, or 'dynamic'? The > > tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh selftest > > looks to me like it's testing the behavior of an FDB entry which should > > roam, and which without the extern_learn flag would be ageable. >=20 > static - no aging, no roaming > dynamic - aging, roaming > extern_learn - no aging, roaming >=20 > So these combinations do not make any sense and the kernel will ignore > static/dynamic when extern_learn is specified. It's needed to work > around iproute2 behavior of "assume permanent" Since NTF_EXT_LEARNED is part of ndm->ndm_flags and NUD_REACHABLE/NUD_NOARP are part of ndm->ndm_state, it is not at all clear to me that 'extern_learn= ' belongs to the same class of bridge neighbor attributes as 'static'/'dynami= c', and that it is invalid to have the full degree of freedom. If it isn't, shouldn't the kernel validate that, instead of just ignoring the ndm->ndm_s= tate? If it's too late to validate, shouldn't we at least document somewhere that the ndm_state is ignored in the presence of ndm_flags & NTF_EXT_LEARNE= D? It is user API after all, easter eggs like this aren't very enjoyable.=