All of lore.kernel.org
 help / color / mirror / Atom feed
From: jamal <j.hadi123@gmail.com>
To: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Romain KUNTZ <r.kuntz@ipflavors.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	herbert@gondor.hengli.com.au,
	Emmanuel THIERRY <emmanuel.thierry@telecom-bretagne.eu>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Jamal Hadi Salim <hadi@cyberus.ca>
Subject: Re: [RFC PATCH] xfrm: fix handling of XFRM policies mark and mask.
Date: Wed, 06 Feb 2013 08:14:44 -0500	[thread overview]
Message-ID: <51125744.3030905@gmail.com> (raw)
In-Reply-To: <20130205081232.GF23291@secunet.com>

Hi Steffen,

On 13-02-05 03:12 AM, Steffen Klassert wrote:
>> For example, executing the below commands in that order succeed:
>>   ip -6 xfrm policy flush
>>   ip -6 xfrm policy add src fd00::1/128 dst fd00::2/128 dir out mark 1 mask 0xffffffff
>>   ip -6 xfrm policy add src fd00::1/128 dst fd00::2/128 dir out
> The policy with mark 1 is the first we find. The policy passes the
> mark check and if the flow matches the selectors, we use this policy.
>
>> But it fails in the reverse order:
>>   ip -6 xfrm policy flush
>>   ip -6 xfrm policy add src fd00::1/128 dst fd00::2/128 dir out
>>   ip -6 xfrm policy add src fd00::1/128 dst fd00::2/128 dir out mark 1 mask 0xffffffff
>>   RTNETLINK answers: File exists
> With this scenario, we would find the policy with mark and mask 0 first.
> This policy passes the mark check too. So we would use this policy if the
> flow matches the selectors, but the flow asked for a policy with mark 1.

I think the intent Romain is expressing is reasonable and should resolved at
insertion time(xfrm_policy_insert()).
i.e even though the policy (such as mark=1) is inserted afterwards, at
insertion time if it proves it is more specific and not duplicate, it 
should be
inserted ahead of the mark=0.
The runtime check will work then.

cheers,
jamal






WARNING: multiple messages have this Message-ID (diff)
From: jamal <j.hadi123@gmail.com>
To: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Romain KUNTZ <r.kuntz@ipflavors.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	herbert@gondor.apana.org.au,
	Emmanuel THIERRY <emmanuel.thierry@telecom-bretagne.eu>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Jamal Hadi Salim <hadi@cyberus.ca>
Subject: Re: [RFC PATCH] xfrm: fix handling of XFRM policies mark and mask.
Date: Wed, 06 Feb 2013 08:14:44 -0500	[thread overview]
Message-ID: <51125744.3030905@gmail.com> (raw)
In-Reply-To: <20130205081232.GF23291@secunet.com>

Hi Steffen,

On 13-02-05 03:12 AM, Steffen Klassert wrote:
>> For example, executing the below commands in that order succeed:
>>   ip -6 xfrm policy flush
>>   ip -6 xfrm policy add src fd00::1/128 dst fd00::2/128 dir out mark 1 mask 0xffffffff
>>   ip -6 xfrm policy add src fd00::1/128 dst fd00::2/128 dir out
> The policy with mark 1 is the first we find. The policy passes the
> mark check and if the flow matches the selectors, we use this policy.
>
>> But it fails in the reverse order:
>>   ip -6 xfrm policy flush
>>   ip -6 xfrm policy add src fd00::1/128 dst fd00::2/128 dir out
>>   ip -6 xfrm policy add src fd00::1/128 dst fd00::2/128 dir out mark 1 mask 0xffffffff
>>   RTNETLINK answers: File exists
> With this scenario, we would find the policy with mark and mask 0 first.
> This policy passes the mark check too. So we would use this policy if the
> flow matches the selectors, but the flow asked for a policy with mark 1.

I think the intent Romain is expressing is reasonable and should resolved at
insertion time(xfrm_policy_insert()).
i.e even though the policy (such as mark=1) is inserted afterwards, at
insertion time if it proves it is more specific and not duplicate, it 
should be
inserted ahead of the mark=0.
The runtime check will work then.

cheers,
jamal

  reply	other threads:[~2013-02-06 13:14 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-02 17:27 [RFC PATCH] xfrm: fix handling of XFRM policies mark and mask Romain KUNTZ
2013-02-02 17:27 ` Romain KUNTZ
2013-02-05  8:12 ` Steffen Klassert
2013-02-05  8:12   ` Steffen Klassert
2013-02-06 13:14   ` jamal [this message]
2013-02-06 13:14     ` jamal
2013-02-06 13:53     ` Emmanuel Thierry
2013-02-06 13:53       ` Emmanuel Thierry
2013-02-06 14:30       ` Jamal Hadi Salim
2013-02-06 14:30         ` Jamal Hadi Salim
2013-02-06 14:39         ` Emmanuel Thierry
2013-02-06 14:39           ` Emmanuel Thierry
2013-02-06 15:50           ` Jamal Hadi Salim
2013-02-06 15:50             ` Jamal Hadi Salim
2013-02-07 10:49       ` Steffen Klassert
2013-02-07 10:49         ` Steffen Klassert
2013-02-07 11:08         ` Emmanuel Thierry
2013-02-07 11:08           ` Emmanuel Thierry
2013-02-07 11:16           ` Emmanuel Thierry
2013-02-07 11:16             ` Emmanuel Thierry
2013-02-07 12:54           ` Steffen Klassert
2013-02-07 12:54             ` Steffen Klassert
2013-02-08 14:16             ` Emmanuel Thierry
2013-02-08 14:16               ` Emmanuel Thierry
2013-02-11 12:57               ` Romain KUNTZ
2013-02-11 12:57                 ` Romain KUNTZ
2013-02-11 13:04                 ` Steffen Klassert
2013-02-11 13:04                   ` Steffen Klassert

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=51125744.3030905@gmail.com \
    --to=j.hadi123@gmail.com \
    --cc=davem@davemloft.net \
    --cc=emmanuel.thierry@telecom-bretagne.eu \
    --cc=hadi@cyberus.ca \
    --cc=herbert@gondor.hengli.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=r.kuntz@ipflavors.com \
    --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 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.