From: Yuehaibing <yuehaibing@huawei.com>
To: Xin Long <lucien.xin@gmail.com>,
Steffen Klassert <steffen.klassert@secunet.com>
Cc: 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: Fri, 22 May 2020 09:45:06 +0800 [thread overview]
Message-ID: <550a82f1-9cb3-2392-25c6-b2a84a00ca33@huawei.com> (raw)
In-Reply-To: <CADvbK_eXW24SkuLUOKkcg4JPa8XLcWpp6RNCrQT+=okaWe+GDA@mail.gmail.com>
On 2020/5/21 14:49, Xin Long wrote:
> 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.
policy A (mark.v = 0x1011, mark.m = 0x1011, priority = 1)
policy B (mark.v = 0x1001, mark.m = 0x1001, priority = 1)
when fl->flowi_mark == 0x12341011, in xfrm_policy_match() do check like this:
(fl->flowi_mark & pol->mark.m) != pol->mark.v
0x12341011 & 0x1011 == 0x00001011
0x12341011 & 0x1001 == 0x00001001
This also match different policy depends on the order of policy inserting.
>
> .
>
next prev parent reply other threads:[~2020-05-22 1:45 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
2020-05-22 1:45 ` Yuehaibing [this message]
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=550a82f1-9cb3-2392-25c6-b2a84a00ca33@huawei.com \
--to=yuehaibing@huawei.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=steffen.klassert@secunet.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).