From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 49E4F60BF6 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 95E0460B4C MIME-Version: 1.0 Date: Thu, 29 Sep 2022 18:14:11 +0200 From: netdev@kapio-technology.com In-Reply-To: <20220929084312.2a216698@hermes.local> References: <20220929152137.167626-1-netdev@kapio-technology.com> <20220929152137.167626-2-netdev@kapio-technology.com> <20220929084312.2a216698@hermes.local> Message-ID: <6de8a39832ebb15fc5e8c2f19e469514@kapio-technology.com> Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Bridge] [PATCH iproute2-next 2/2] bridge: fdb: enable FDB blackhole feature List-Id: Linux Ethernet Bridging List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stephen Hemminger Cc: Andrew Lunn , Alexandre Belloni , Nikolay Aleksandrov , Kurt Kanzenbach , Eric Dumazet , linux-kselftest@vger.kernel.org, Joachim Wiberg , UNGLinuxDriver@microchip.com, Shuah Khan , Ivan Vecera , Florian Fainelli , Daniel Borkmann , Florent Fourcot , bridge@lists.linux-foundation.org, Russell King , Yuwei Wang , Roopa Prabhu , kuba@kernel.org, Paolo Abeni , Vivien Didelot , Woojung Huh , Landen Chao , Jiri Pirko , Amit Cohen , Ido Schimmel , Hans Schultz , Sean Wang , DENG Qingfang , Claudiu Manoil , linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org, Petr Machata , Hauke Mehrtens , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Christian Marangi , Vladimir Oltean , davem@davemloft.net On 2022-09-29 17:43, Stephen Hemminger wrote: > On Thu, 29 Sep 2022 17:21:37 +0200 > Hans Schultz wrote: > >> >> @@ -493,6 +496,8 @@ static int fdb_modify(int cmd, int flags, int >> argc, char **argv) >> req.ndm.ndm_flags |= NTF_EXT_LEARNED; >> } else if (matches(*argv, "sticky") == 0) { >> req.ndm.ndm_flags |= NTF_STICKY; >> + } else if (matches(*argv, "blackhole") == 0) { >> + ext_flags |= NTF_EXT_BLACKHOLE; >> } else { >> if (strcmp(*argv, "to") == 0) >> NEXT_ARG(); > > The parsing of flags is weird here, most of the flags are compared with > strcmp() > but some use matches().. I should have used strcmp() all the time; but > at the > time did not realize what kind of confusion matches() can cause. Maybe just change all of them then, and then how about using strncmp() and maybe also strnlen() instead?