netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xin Long <lucien.xin@gmail.com>
To: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Yuehaibing <yuehaibing@huawei.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	davem <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>,
	network dev <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] xfrm: policy: Fix xfrm policy match
Date: Thu, 21 May 2020 14:49:07 +0800	[thread overview]
Message-ID: <CADvbK_eXW24SkuLUOKkcg4JPa8XLcWpp6RNCrQT+=okaWe+GDA@mail.gmail.com> (raw)
In-Reply-To: <20200519085353.GE13121@gauss3.secunet.de>

On Tue, May 19, 2020 at 4:53 PM Steffen Klassert
<steffen.klassert@secunet.com> wrote:
>
> On Fri, May 15, 2020 at 04:39:57PM +0800, Yuehaibing wrote:
> >
> > Friendly ping...
> >
> > Any plan for this issue?
>
> There was still no consensus between you and Xin on how
> to fix this issue. Once this happens, I consider applying
> a fix.
>
Sorry, Yuehaibing, I can't really accept to do: (A->mark.m & A->mark.v)
I'm thinking to change to:

 static bool xfrm_policy_mark_match(struct xfrm_policy *policy,
                                   struct xfrm_policy *pol)
 {
-       u32 mark = policy->mark.v & policy->mark.m;
-
-       if (policy->mark.v == pol->mark.v && policy->mark.m == pol->mark.m)
-               return true;
-
-       if ((mark & pol->mark.m) == pol->mark.v &&
-           policy->priority == pol->priority)
+       if (policy->mark.v == pol->mark.v &&
+           (policy->mark.m == pol->mark.m ||
+            policy->priority == pol->priority))
                return true;

        return false;

which means we consider (the same value and mask) or
(the same value and priority) as the same one. This will
cover both problems.

  reply	other threads:[~2020-05-21  6:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21 14:31 [PATCH] xfrm: policy: Only use mark as policy lookup key YueHaibing
2020-04-22  9:33 ` Steffen Klassert
2020-04-22 12:18   ` Yuehaibing
2020-04-22 15:41     ` Xin Long
2020-04-22 15:54       ` Xin Long
2020-04-23  2:25       ` Yuehaibing
2020-04-23  6:37         ` Xin Long
2020-04-23  8:40           ` Yuehaibing
2020-04-23  9:43             ` Xin Long
2020-04-24  3:48               ` Yuehaibing
2020-04-30  6:30                 ` Yuehaibing
2020-04-22 12:53 ` [PATCH v2] xfrm: policy: Fix xfrm policy match YueHaibing
2020-05-15  8:39   ` Yuehaibing
2020-05-19  8:53     ` Steffen Klassert
2020-05-21  6:49       ` Xin Long [this message]
2020-05-22  1:45         ` Yuehaibing
2020-05-22  5:49           ` Xin Long
2020-05-22 12:39             ` Yuehaibing
2020-05-23  9:02               ` Xin Long
2020-05-25  3:04                 ` Yuehaibing

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='CADvbK_eXW24SkuLUOKkcg4JPa8XLcWpp6RNCrQT+=okaWe+GDA@mail.gmail.com' \
    --to=lucien.xin@gmail.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    --cc=yuehaibing@huawei.com \
    /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).