All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ken-ichirou MATSUZAWA <chamaken@gmail.com>
To: Florian Westphal <fw@strlen.de>
Cc: The netfilter developer mailinglist
	<netfilter-devel@vger.kernel.org>,
	Pablo Neira Ayuso <pablo@netfilter.org>
Subject: Re: [RFC PATCH 1/1 libnetfilter_conntrack] zero value handling of mark and zone
Date: Mon, 16 Jun 2014 09:04:03 +0900	[thread overview]
Message-ID: <CAGCkEt2KCUmMYU5nDuKnZh14YofB_bbwVSF3HvE-FQ83kWGrPg@mail.gmail.com> (raw)
In-Reply-To: <20140612094842.GA1982@breakpoint.cc>

 Hello,

2014-06-12 18:48 GMT+09:00 Florian Westphal <fw@strlen.de>:
> What about this:
>
> static int cmp_zone(const struct nf_conntrack *ct1,
>         const struct nf_conntrack *ct2, unsigned int flags)
> {
>  return nfct_get_attr_u16(ct1, ATTR_ZONE) == nfct_get_attr_u16(ct2, ATTR_ZONE);
> }
>
> Then it should be sufficient to not call __cmp at all, i.e.:
>
> - if (!__cmp(ATTR_ZONE, ct1, ct2, flags, cmp_zone))
> + if (!cmp_zone(ct1, ct2, flags))
>
> ct1 and ct2 zones would then always be equal except if
> both have ATTR_ZONE set and the zones are different.

Sorry, it did not work with NFCT_CMP_MASK in case of
only ct2 has attr. We need to think of NCFT_CMP_MASK
as you told.

  static int cmp_zone(const struct nf_conntrack *ct1,
                                  const struct nf_conntrack *ct2,
                                  unsigned int flags)
  {
      return (flags & NFCT_CMP_MASK &&
                 !test_bit(ATTR_ZONE, ct1->head.set)) ||
                 nfct_get_attr_u16(ct1, ATTR_ZONE)
                 == nfct_get_attr_u16(ct2, ATTR_ZONE);
  }

What about this?
Could I resend the patch if it is acceptable?

  parent reply	other threads:[~2014-06-16  0:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-11 23:42 [RFC PATCH 1/1 libnetfilter_conntrack] zero value handling of mark and zone Ken-ichirou MATSUZAWA
2014-06-12  0:18 ` Florian Westphal
2014-06-12  5:19   ` Ken-ichirou MATSUZAWA
2014-06-12  9:48     ` Florian Westphal
2014-06-12 11:33       ` Ken-ichirou MATSUZAWA
2014-06-12 11:59         ` Florian Westphal
2014-06-12 13:43           ` Ken-ichirou MATSUZAWA
2014-06-12 14:05             ` Florian Westphal
2014-06-12 23:12               ` Ken-ichirou MATSUZAWA
2014-06-16  0:04       ` Ken-ichirou MATSUZAWA [this message]
2014-06-16 11:41         ` Florian Westphal
2014-06-16 13:20           ` Ken-ichirou MATSUZAWA
2014-06-16 13:24             ` Florian Westphal

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=CAGCkEt2KCUmMYU5nDuKnZh14YofB_bbwVSF3HvE-FQ83kWGrPg@mail.gmail.com \
    --to=chamaken@gmail.com \
    --cc=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.