[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b1656226-4caf-466e-8175-48431752286d@strongswan.org>
Date: Mon, 15 Jun 2020 11:56:34 +0200
From: Tobias Brunner <tobias@...ongswan.org>
To: Xin Long <lucien.xin@...il.com>, netdev@...r.kernel.org
Cc: Steffen Klassert <steffen.klassert@...unet.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
Jamal Hadi Salim <hadi@...erus.ca>,
Sabrina Dubroca <sd@...asysnail.net>
Subject: Re: [PATCH ipsec] xfrm: policy: match with both mark and mask on user
interfaces
Hi Xin,
> To fix this duplicated policies issue, and also fix the issue in
> commit ed17b8d377ea ("xfrm: fix a warning in xfrm_policy_insert_list"),
> when doing add/del/get/update on user interfaces, this patch is to change
> to look up a policy with both mark and mask by doing:
>
> mark.v == pol->mark.v && mark.m == pol->mark.m
Looks good, thanks a lot for your work on this. All tests in our
regression test suite complete successfully with this patch applied.
Tested-by: Tobias Brunner <tobias@...ongswan.org>
> and leave the check:
>
> ((mark.v & mark.m) & pol->mark.m) == pol->mark.v.
>
> for tx/rx path only.
If you are referring to the check in xfrm_policy_match() it's actually:
(fl->flowi_mark & pol->mark.m) != pol->mark.v
Or more generically something like:
(mark & pol->mark.m) == pol->mark.v
As we only have the mark on the packets/flow (no mask) to match against.
> -static bool xfrm_policy_mark_match(struct xfrm_policy *policy,
> +static bool xfrm_policy_mark_match(const struct xfrm_mark *mark,
> struct xfrm_policy *pol)
> {
> - if (policy->mark.v == pol->mark.v &&
> - policy->priority == pol->priority)
> - return true;
> -
> - return false;
> + return mark->v == pol->mark.v && mark->m == pol->mark.m;
> }
I guess you could make that function `static inline`.
Regards,
Tobias
Powered by blists - more mailing lists