From: "Anders K. Pedersen | Cohaesio" <akp@cohaesio.com>
To: "zlpnobody@gmail.com" <zlpnobody@gmail.com>
Cc: "netfilter-devel@vger.kernel.org"
<netfilter-devel@vger.kernel.org>,
"pablo@netfilter.org" <pablo@netfilter.org>
Subject: Re: [PATCH v2 nf-next 5/5] netfilter: nft: rt nexthop for inet family
Date: Thu, 20 Oct 2016 13:52:40 +0000 [thread overview]
Message-ID: <1476971559.1161.58.camel@cohaesio.com> (raw)
In-Reply-To: <CAML_gOd9JSCHWQqnGN8FqdhghFHqCgDX_TiXgdpYnegROArmpQ@mail.gmail.com>
Hi Liping,
On tor, 2016-10-20 at 21:27 +0800, Liping Zhang wrote:
> Hi Anders,
>
> 2016-10-20 20:36 GMT+08:00 Anders K. Pedersen | Cohaesio <akp@cohaesi
> o.com>:
> [...]
> >
> > Well, the suggested userspace implementation doesn't allow a rule
> > that
> > would hit this warning. It is required to use 'ether type ip ... rt
> > ip
> > nexthop' or 'ether type ip6 ... rt ip6 nexthop', when nexthop is
> > used
> > from the inet table.
> >
> > So I found it reasonable to generate a warning if such a rule
> > somehow
> > got configured anyway, but if you still feel that it should be
> > removed,
> > I can do that.
>
> I think WARN_ON was used to hint that maybe there's a bug in kernel.
> It is not appropriate to warn the user's wrong configuration.
OK, so would it be okay to replace it with
printk_once(KERN_WARNING KBUILD_MODNAME " Address families do not match\n");
?
> >
> > >
> > > switch (priv->key) {
> > > case NFT_RT_NEXTHOP:
> > > switch (pkt->pf)
> > > ...
> > > default:
> > > return nft_rt_get_eval(expr, regs, pkt);
> > > }
> >
> > My thinking was that for future rt sub-expressions, it will
> > probably
> > make sense to move
> >
> > const struct rtable *rt = skb_rtable(skb);
> >
> > if (!rt)
> > goto err;
> >
> > outside the inner switch statement, so it doesn't need to be
> > duplicated
> > for each sub-expression. And ditto for the IPV6 part.
> >
>
> If so, for future rt sub-expressions extension, I think the following
> codes
> maybe better?
>
> switch (pkt->pf)
> case IPV4:
> nft_rt_ipv4_get_eval();
> break;
> case IPV6:
> nft_rt_ipv6_get_eval();
> break;
>
> This can reduce the duplicate codes. Just a suggestion:)
Then NFT_RT_INET would have to select NFT_RT_IPV4 and NFT_RT_IPV6, but
I guess that is okay, since NFT_RT_INET depends on NF_TABLES_INET,
which selects NF_TABLES_IPV4 and NF_TABLES_IPV6, so I'll use this
solution.
Regards,
Anders K. Pedersen
next prev parent reply other threads:[~2016-10-20 13:52 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-19 18:34 [PATCH v2 nf-next 0/5] netfilter: nft: introduce routing expression Anders K. Pedersen | Cohaesio
2016-10-19 18:35 ` [PATCH v2 nf-next 1/5] netfilter: nft: UAPI headers for " Anders K. Pedersen | Cohaesio
2016-10-19 18:38 ` [PATCH v2 nf-next 2/5] netfilter: nft: basic " Anders K. Pedersen | Cohaesio
2016-10-19 18:39 ` [PATCH v2 nf-next 3/5] netfilter: nft: rt nexthop for IPv4 family Anders K. Pedersen | Cohaesio
2016-10-19 18:40 ` [PATCH v2 nf-next 4/5] netfilter: nft: rt nexthop for IPv6 family Anders K. Pedersen | Cohaesio
2016-10-19 18:41 ` [PATCH v2 nf-next 5/5] netfilter: nft: rt nexthop for inet family Anders K. Pedersen | Cohaesio
2016-10-20 9:13 ` Liping Zhang
2016-10-20 12:36 ` Anders K. Pedersen | Cohaesio
2016-10-20 13:27 ` Liping Zhang
2016-10-20 13:52 ` Anders K. Pedersen | Cohaesio [this message]
2016-10-21 2:06 ` Liping Zhang
2016-10-21 4:16 ` Anders K. Pedersen | Cohaesio
2016-10-21 6:17 ` Liping Zhang
2016-10-21 8:26 ` Anders K. Pedersen | Cohaesio
2016-10-21 12:42 ` Liping Zhang
2016-10-22 15:25 ` Anders K. Pedersen | Cohaesio
2016-10-21 9:21 ` Pablo Neira Ayuso
2016-10-21 13:22 ` Liping Zhang
2016-10-21 16:58 ` Pablo Neira Ayuso
2016-10-22 1:44 ` Liping Zhang
2016-10-22 16:08 ` Anders K. Pedersen | Cohaesio
2016-10-23 5:01 ` Liping Zhang
2016-10-27 17:50 ` Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1476971559.1161.58.camel@cohaesio.com \
--to=akp@cohaesio.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=zlpnobody@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.