All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: tgraf@suug.ch, challa@noironetworks.com, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf-next v2 1/3] netfilter: nf_conntrack: push zone object into functions
Date: Wed, 15 Jul 2015 21:16:30 +0200	[thread overview]
Message-ID: <55A6B18E.2070508@iogearbox.net> (raw)
In-Reply-To: <20150715173558.GA7161@salvia>

On 07/15/2015 07:35 PM, Pablo Neira Ayuso wrote:
> On Sat, Jul 11, 2015 at 03:14:05AM +0200, Daniel Borkmann wrote:
>> This patch replaces the zone id which is pushed down into functions
>> with the actual zone object. It's a bigger one-time change, but
>> needed for later on extending zones with a direction parameter, and
>> thus decoupling this additional information from all call-sites.
>>
>> It was suggested during NFWS to let the nf_ct_zone() helper store
>> the meta data on the stack as we currently do, but in a similar
>> fashion as skb_header_pointer() does, so we can avoid keeping track
>> of the object lifetime. In general, dealing directly with the object
>> also facilitates for adding other possible meta data in future.
>>
>> No functional changes in this patch.
> [...]
>> diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
>> index 80d5554..75f7860 100644
>> --- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
>> +++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
>> @@ -134,9 +134,10 @@ icmp_error_message(struct net *net, struct nf_conn *tmpl, struct sk_buff *skb,
>>   	struct nf_conntrack_tuple innertuple, origtuple;
>>   	const struct nf_conntrack_l4proto *innerproto;
>>   	const struct nf_conntrack_tuple_hash *h;
>> -	u16 zone = tmpl ? nf_ct_zone(tmpl) : NF_CT_DEFAULT_ZONE;
>> +	struct nf_conntrack_zone *zone, __zone;
>>
>>   	NF_CT_ASSERT(skb->nfct == NULL);
>> +	zone = nf_ct_zone_tmpl(tmpl, &__zone);
>
> This was one possible idea, but I also suggested to have a dummy:
>
> static const struct nf_ct_zone nf_ct_zone_dflt = {
>          .zone_id        = NF_CT_DEFAULT_ZONE,
> };
>
> that we return in case no zone extension is set, and use it instead of
> your nf_ct_zone_dflt() function.

There are multiple possibilities, no doubt, I liked this one better and
therefore took that path as it integrated nicely with the 3rd patch in
this series, and it also consumed less stack space, it's 4 byte after all.

  reply	other threads:[~2015-07-15 19:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-11  1:14 [PATCH nf-next v2 0/3] Netfilter zone directions Daniel Borkmann
2015-07-11  1:14 ` [PATCH nf-next v2 1/3] netfilter: nf_conntrack: push zone object into functions Daniel Borkmann
2015-07-15 17:35   ` Pablo Neira Ayuso
2015-07-15 19:16     ` Daniel Borkmann [this message]
2015-07-11  1:14 ` [PATCH nf-next v2 2/3] netfilter: nf_conntrack: add direction support for zones Daniel Borkmann
2015-07-11  1:14 ` [PATCH nf-next v2 3/3] netfilter: nf_conntrack: add efficient mark to zone mapping Daniel Borkmann
2015-07-15 17:50   ` Pablo Neira Ayuso
2015-07-15 20:04     ` Daniel Borkmann
2015-07-20 16:18       ` Daniel Borkmann
2015-07-20 17:03         ` Pablo Neira Ayuso
2015-07-20 17:27           ` Daniel Borkmann
2015-07-20 18:24             ` Pablo Neira Ayuso
2015-07-20 20:05               ` Daniel Borkmann
2015-07-21  7:37                 ` Pablo Neira Ayuso
2015-07-21  9:08                   ` 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=55A6B18E.2070508@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=challa@noironetworks.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=tgraf@suug.ch \
    /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.