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? 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 944C5C433FE for ; Thu, 29 Sep 2022 16:14:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234376AbiI2QOa (ORCPT ); Thu, 29 Sep 2022 12:14:30 -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-kselftest@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? 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8FD61C433FE for ; Thu, 29 Sep 2022 16:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:Cc:To:From :Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9PswifPjYhRA0/Vspt5es8s55qpyIKY5PcxCbmqIlyE=; b=r5voWz70T8tseIDaVOOqZDbJsa z1DoNoHPpOu6CM6+Yru98hcwrzM+a9A64HqPrK8OQDz9YNUsgWjzGG6OEaGZJcOxQM1sWp/KCAEjn lc0pLwNsTg32EK05enYo2Ul0mDCc/U0n/eMeUvx9B4Gj9LLkzisaDm/0C6a8xYFShdworkfUTa30g sf6VBfhBJLijmbAC7/igcKuYufjMzTuU3oXtxpfSGYpNEh5Lmvk5f0nv24Xhqs9A+6cYaUGrjs7/z nCEcwm6HAoYWp7FO5vaiHA8qT949uISlIdjOqTyz2stQYUVkfil3LXvjfA7VPsIrxLTfPFDh7O9L0 wKoQN0Lw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1odwAy-0044w7-8k; Thu, 29 Sep 2022 16:14:16 +0000 Received: from mailout-taastrup.gigahost.dk ([46.183.139.199]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1odwAv-0044ti-4x; Thu, 29 Sep 2022 16:14:14 +0000 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220929_091413_383693_FF7B7283 X-CRM114-Status: GOOD ( 12.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel