From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: daniel@zonque.org, fw@strlen.de, a.perevalov@samsung.com,
netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf-next v2 1/2] netfilter: x_tables: refactor lookup helpers from xt_socket
Date: Fri, 27 Mar 2015 01:06:44 +0100 [thread overview]
Message-ID: <20150327000644.GC3545@salvia> (raw)
In-Reply-To: <647fedfdea7781dbe48a8cb720b4715ef769cd05.1427394874.git.daniel@iogearbox.net>
On Thu, Mar 26, 2015 at 08:14:47PM +0100, Daniel Borkmann wrote:
> The socket lookup helpers are also needed for fixing xt_cgroups,
> therefore refactor them into shareable helper functions.
>
> This simplifies and optimizes the xt_socket code itself a bit
> as well, i.e. time to verdict for early demux sockets should be
> much faster than previously:
>
> We've unnecessarily extracted proto, {s,d}addr and {s,d}ports
> from the skb data, accessing possible conntrack information,
> etc even though we were not even calling into the socket lookup
> via xt_socket_get_sock_v4() due to skb->sk hit.
>
> After this patch, we only proceed the slow-path when we have an
> actual skb->sk miss.
>
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> Cc: Daniel Mack <daniel@zonque.org>
> Cc: Florian Westphal <fw@strlen.de>
> ---
> net/netfilter/xt_sk_helper.h | 282 +++++++++++++++++++++++++++++++++++++++++
> net/netfilter/xt_socket.c | 293 +++----------------------------------------
> 2 files changed, 300 insertions(+), 275 deletions(-)
> create mode 100644 net/netfilter/xt_sk_helper.h
>
> diff --git a/net/netfilter/xt_sk_helper.h b/net/netfilter/xt_sk_helper.h
> new file mode 100644
> index 0000000..604b7ac
> --- /dev/null
> +++ b/net/netfilter/xt_sk_helper.h
Please, no code in a header file. Instead split the content of this
file in two:
* net/ipv4/netfilter/nf_sock_ipv4.c
* net/ipv6/netfilter/nf_sock_ipv6.c
You will have the corresponding Kconfig and Makefile trickery too.
Also rename all those functions to the prefix nf_sock_*
The Kconfig for xt_socket should contain:
select NF_SOCK_IPV4
select NF_SOCK_IPV6 if IP6_NF_IPTABLES
This is how we're doing with other extensions to share code between xt
and nft, you will help us if you do it like that.
Thanks.
next prev parent reply other threads:[~2015-03-27 0:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-26 19:14 [PATCH nf-next v2 0/2] xt_cgroups fix Daniel Borkmann
2015-03-26 19:14 ` [PATCH nf-next v2 1/2] netfilter: x_tables: refactor lookup helpers from xt_socket Daniel Borkmann
2015-03-27 0:06 ` Pablo Neira Ayuso [this message]
2015-03-27 8:18 ` Daniel Borkmann
2015-03-26 19:14 ` [PATCH nf-next v2 2/2] netfilter: x_tables: fix cgroup's NF_INET_LOCAL_IN sk lookups Daniel Borkmann
2015-03-27 0:14 ` Pablo Neira Ayuso
2015-03-27 2:10 ` Pablo Neira Ayuso
2015-03-27 9:48 ` Daniel Borkmann
2015-03-27 10:47 ` Pablo Neira Ayuso
2015-03-27 12:02 ` Daniel Borkmann
2015-03-27 8:40 ` Daniel Borkmann
2015-03-27 0:40 ` [PATCH nf-next v2 0/2] xt_cgroups fix Pablo Neira Ayuso
2015-03-27 8:48 ` Daniel Borkmann
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=20150327000644.GC3545@salvia \
--to=pablo@netfilter.org \
--cc=a.perevalov@samsung.com \
--cc=daniel@iogearbox.net \
--cc=daniel@zonque.org \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.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).