From: Fernando Fernandez Mancera <ffmancera@riseup.net>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf-next WIP] netfilter: nf_tables: Add SYNPROXY support
Date: Mon, 17 Jun 2019 23:58:30 +0200 [thread overview]
Message-ID: <a5612bc7-a20e-a1da-fb2f-fbc203f87c9e@riseup.net> (raw)
In-Reply-To: <20190617215514.6zpkgww7a3wjhsj3@salvia>
On 6/17/19 11:55 PM, Pablo Neira Ayuso wrote:
> On Mon, Jun 17, 2019 at 09:49:43PM +0200, Fernando Fernandez Mancera wrote:
>> Hi Pablo, comments below.
>>
>> On 6/17/19 5:45 PM, Pablo Neira Ayuso wrote:
>>> On Mon, Jun 17, 2019 at 12:32:35PM +0200, Fernando Fernandez Mancera wrote:
>>>> Add SYNPROXY module support in nf_tables. It preserves the behaviour of the
>>>> SYNPROXY target of iptables but structured in a different way to propose
>>>> improvements in the future.
>>>>
>>>> Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
>>>> ---
>>>> include/uapi/linux/netfilter/nf_SYNPROXY.h | 4 +
>>>> include/uapi/linux/netfilter/nf_tables.h | 16 +
>>>> net/netfilter/Kconfig | 11 +
>>>> net/netfilter/Makefile | 1 +
>>>> net/netfilter/nft_synproxy.c | 328 +++++++++++++++++++++
>>>> 5 files changed, 360 insertions(+)
>>>> create mode 100644 net/netfilter/nft_synproxy.c
>>>>
>> [...]
>>>> +
>>>> +static void nft_synproxy_eval(const struct nft_expr *expr,
>>>> + struct nft_regs *regs,
>>>> + const struct nft_pktinfo *pkt)
>>>> +{
>>>
>>> You have to check if this is TCP traffic in first place, otherwise UDP
>>> packets may enter this path :-).
>>>
>>>> + switch (nft_pf(pkt)) {
>>>> + case NFPROTO_IPV4:
>>>> + nft_synproxy_eval_v4(expr, regs, pkt);
>>>> + return;
>>>> +#if IS_ENABLED(CONFIG_NF_TABLES_IPV6)
>>>> + case NFPROTO_IPV6:
>>>> + nft_synproxy_eval_v6(expr, regs, pkt);
>>>> + return;
>>>> +#endif
>>>
>>> Please, use skb->protocol instead of nft_pf(), I would like we can use
>>> nft_synproxy from NFPROTO_NETDEV (ingress) and NFPROTO_BRIDGE families
>>> too.
>>>
>>
>> If I use skb->protocol no packet enters in the path. What do you
>> recommend me? Other than that, the rest of the suggestions are done and
>> it has been tested and it worked as expected. Thanks :-)
>
> skb->protocol uses big endian representation, you have to check for:
>
> switch (skb->protocol) {
> case htons(ETH_P_IP):
> ...
> break;
> case htons(ETH_P_IPV6):
> ...
> break;
> }
>
Oh, I didn't know that. A patch series including tests and documentation
it is going to be ready soon if everything seem fine to you. After this,
I think we can implement some improvements. Thanks :-)
next prev parent reply other threads:[~2019-06-17 21:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-17 10:32 [PATCH libnftnl WIP] expr: add synproxy support Fernando Fernandez Mancera
2019-06-17 10:32 ` [PATCH nf-next WIP] netfilter: nf_tables: Add SYNPROXY support Fernando Fernandez Mancera
2019-06-17 15:25 ` Pablo Neira Ayuso
2019-06-17 15:45 ` Pablo Neira Ayuso
2019-06-17 19:49 ` Fernando Fernandez Mancera
2019-06-17 21:55 ` Pablo Neira Ayuso
2019-06-17 21:58 ` Fernando Fernandez Mancera [this message]
2019-06-17 10:32 ` [PATCH nft WIP] src: introduce SYNPROXY matching Fernando Fernandez Mancera
2019-06-17 10:41 ` Fernando Fernandez Mancera
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=a5612bc7-a20e-a1da-fb2f-fbc203f87c9e@riseup.net \
--to=ffmancera@riseup.net \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).