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 42874C433EF for ; Tue, 15 Mar 2022 20:05:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351541AbiCOUHK (ORCPT ); Tue, 15 Mar 2022 16:07:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351439AbiCOUHJ (ORCPT ); Tue, 15 Mar 2022 16:07:09 -0400 Received: from orbyte.nwl.cc (orbyte.nwl.cc [IPv6:2001:41d0:e:133a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BEFB56234; Tue, 15 Mar 2022 13:05:56 -0700 (PDT) Received: from n0-1 by orbyte.nwl.cc with local (Exim 4.94.2) (envelope-from ) id 1nUDQX-000536-Ey; Tue, 15 Mar 2022 21:05:53 +0100 Date: Tue, 15 Mar 2022 21:05:53 +0100 From: Phil Sutter To: Jakub Kicinski Cc: Pablo Neira Ayuso , netfilter-devel@vger.kernel.org, davem@davemloft.net, netdev@vger.kernel.org Subject: Re: [PATCH nf-next 2/6] netfilter: nf_tables: Reject tables of unsupported family Message-ID: Mail-Followup-To: Phil Sutter , Jakub Kicinski , Pablo Neira Ayuso , netfilter-devel@vger.kernel.org, davem@davemloft.net, netdev@vger.kernel.org References: <20220315091513.66544-1-pablo@netfilter.org> <20220315091513.66544-3-pablo@netfilter.org> <20220315115644.66fab74b@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220315115644.66fab74b@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Hi Jakub, On Tue, Mar 15, 2022 at 11:56:44AM -0700, Jakub Kicinski wrote: > On Tue, 15 Mar 2022 10:15:09 +0100 Pablo Neira Ayuso wrote: > > + return false > > +#ifdef CONFIG_NF_TABLES_INET > > + || family == NFPROTO_INET > > +#endif > > +#ifdef CONFIG_NF_TABLES_IPV4 > > + || family == NFPROTO_IPV4 > > +#endif > > +#ifdef CONFIG_NF_TABLES_ARP > > + || family == NFPROTO_ARP > > +#endif > > +#ifdef CONFIG_NF_TABLES_NETDEV > > + || family == NFPROTO_NETDEV > > +#endif > > +#if IS_ENABLED(CONFIG_NF_TABLES_BRIDGE) > > is there a reason this one is IS_ENABLED() and everything else is ifdef? I based my patch on the existing ifdefs in nft_chain_filter.c where these config symbols are checked exactly like above. Looking at git history, the check was changed from a simple ifdef in commit dfee0e99bcff7 ("netfilter: bridge: make NF_TABLES_BRIDGE tristate"). > > + || family == NFPROTO_BRIDGE > > +#endif > > +#ifdef CONFIG_NF_TABLES_IPV6 > > + || family == NFPROTO_IPV6 > > +#endif > > + ; > > return (IS_ENABLED(CONFIG_NF_TABLES_INET) && family == NFPROTO_INET)) || > (IS_ENABLED(CONFIG_NF_TABLES_IPV4) && family == NFPROTO_IPV4)) || > ... > > would have also been an option, for future reference. Yes, that is indeed much cleaner. I wasn't aware of this possibility using IS_ENABLED. What do you think, worth a follow-up? Thanks, Phil