From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14612C433F5 for ; Thu, 29 Sep 2022 16:14:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236080AbiI2QOc (ORCPT ); Thu, 29 Sep 2022 12:14:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236102AbiI2QOT (ORCPT ); Thu, 29 Sep 2022 12:14:19 -0400 Received: from mailout-taastrup.gigahost.dk (mailout-taastrup.gigahost.dk [46.183.139.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB5231DADE0; Thu, 29 Sep 2022 09:14:13 -0700 (PDT) Received: from mailout.gigahost.dk (mailout.gigahost.dk [89.186.169.112]) by mailout-taastrup.gigahost.dk (Postfix) with ESMTP id 462101884BA5; Thu, 29 Sep 2022 16:14:11 +0000 (UTC) Received: from smtp.gigahost.dk (smtp.gigahost.dk [89.186.169.109]) by mailout.gigahost.dk (Postfix) with ESMTP id 3F4F32500370; Thu, 29 Sep 2022 16:14:11 +0000 (UTC) Received: by smtp.gigahost.dk (Postfix, from userid 1000) id 34F409EC0002; Thu, 29 Sep 2022 16:14:11 +0000 (UTC) X-Screener-Id: 413d8c6ce5bf6eab4824d0abaab02863e8e3f662 MIME-Version: 1.0 Date: Thu, 29 Sep 2022 18:14:11 +0200 From: netdev@kapio-technology.com To: Stephen Hemminger Cc: davem@davemloft.net, kuba@kernel.org, Andrew Lunn , Alexandre Belloni , Nikolay Aleksandrov , Kurt Kanzenbach , Eric Dumazet , linux-kselftest@vger.kernel.org, Joachim Wiberg , Shuah Khan , Ivan Vecera , Florian Fainelli , Daniel Borkmann , Ido Schimmel , bridge@lists.linux-foundation.org, Russell King , linux-arm-kernel@lists.infradead.org, Roopa Prabhu , Paolo Abeni , Vivien Didelot , Woojung Huh , Landen Chao , Jiri Pirko , Amit Cohen , Christian Marangi , Hauke Mehrtens , Hans Schultz , Sean Wang , DENG Qingfang , Claudiu Manoil , linux-mediatek@lists.infradead.org, Matthias Brugger , Yuwei Wang , Petr Machata , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, UNGLinuxDriver@microchip.com, Vladimir Oltean , Florent Fourcot Subject: Re: [Bridge] [PATCH iproute2-next 2/2] bridge: fdb: enable FDB blackhole feature 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> User-Agent: Gigahost Webmail Message-ID: <6de8a39832ebb15fc5e8c2f19e469514@kapio-technology.com> X-Sender: netdev@kapio-technology.com Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?