From: Florian Westphal <fw@strlen.de>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Florian Westphal <fw@strlen.de>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 2/2] netfilter: connlabels: move set helper to xt_connlabel
Date: Fri, 22 Jul 2016 17:17:22 +0200 [thread overview]
Message-ID: <20160722151722.GA14547@breakpoint.cc> (raw)
In-Reply-To: <20160722150926.GA21470@salvia>
Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> On Thu, Jul 21, 2016 at 12:51:17PM +0200, Florian Westphal wrote:
> > xt_connlabel is the only user so move it.
> >
> > Signed-off-by: Florian Westphal <fw@strlen.de>
> > ---
> > include/net/netfilter/nf_conntrack_labels.h | 2 --
> > net/netfilter/nf_conntrack_labels.c | 17 -----------------
> > net/netfilter/xt_connlabel.c | 29 ++++++++++++++++-------------
> > 3 files changed, 16 insertions(+), 32 deletions(-)
> >
> [...]
> > @@ -40,10 +32,21 @@ connlabel_mt(const struct sk_buff *skb, struct xt_action_param *par)
> > if (ct == NULL || nf_ct_is_untracked(ct))
> > return invert;
> >
> > - if (info->options & XT_CONNLABEL_OP_SET)
> > - return (nf_connlabel_set(ct, info->bit) == 0) ^ invert;
> > + labels = nf_ct_labels_find(ct);
> > + if (!labels)
> > + return invert;
> > +
> > + if (test_bit(info->bit, labels->bits))
> > + return !invert;
> > +
> > + if (info->options & XT_CONNLABEL_OP_SET) {
> > + if (!test_and_set_bit(info->bit, labels->bits))
> > + nf_conntrack_event_cache(IPCT_LABEL, ct);
> > +
> > + return !invert;
> > + }
>
> This patch inverts the existing logic, right? So this is first testing
> for the bit, then setting it.
No, this should have no user-visible change (if it does thats a bug);
nf_connlabel_set() also had a test_bit().
The only change after the patches are applied is that if we have
a valid conntrack with the extension present then a set op will
always succeed (before we had to test if the label->bit[] area was large
enough).
next prev parent reply other threads:[~2016-07-22 15:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-21 10:51 netfilter: connlabels: get rid of variable-size support Florian Westphal
2016-07-21 10:51 ` [PATCH 1/2] netfilter: conntrack: support a fixed size of 128 distinct labels Florian Westphal
2016-07-23 10:27 ` Pablo Neira Ayuso
2016-07-21 10:51 ` [PATCH 2/2] netfilter: connlabels: move set helper to xt_connlabel Florian Westphal
2016-07-22 15:09 ` Pablo Neira Ayuso
2016-07-22 15:17 ` Florian Westphal [this message]
2016-07-23 10:27 ` 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=20160722151722.GA14547@breakpoint.cc \
--to=fw@strlen.de \
--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 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.