netdev
[Top] [All Lists]

Re: patch: policy update by id

To: jamal <hadi@xxxxxxxxxx>
Subject: Re: patch: policy update by id
From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 28 Apr 2005 11:21:35 +1000
Cc: netdev@xxxxxxxxxxx
In-reply-to: <1114650816.7663.13.camel@localhost.localdomain>
References: <1114602874.7670.4.camel@localhost.localdomain> <1114604657.7670.22.camel@localhost.localdomain> <1114604826.7670.24.camel@localhost.localdomain> <20050427233924.GA22238@gondor.apana.org.au> <1114650816.7663.13.camel@localhost.localdomain>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.6+20040907i
On Wed, Apr 27, 2005 at 09:13:36PM -0400, jamal wrote:
>
> > > +         if (!delpol && 
> > > +         ((!excl && policy->index && (policy->index == pol->index)) || 
> > > +          (memcmp(&policy->selector, &pol->selector, 
> > > sizeof(pol->selector)) == 0))) {
>
> > Also the excl check doesn't make sense.  You should let the
> > following excl check take place after you've found out that
> > the indices is identical.
> 
> the policy->index is only relevant for the update not the add;
> the update could also be done by selector. So i didnt follow.

I see.  In that case you want to change your expression above
so that the memcmp is never done if excl is off and the index
is non-zero.  Otherwise this will result in non-deterministic
behaviour as the result will change depending on whether the
first hit is an index match or a selector match.

Actually, would it be so bad to check the policy->index for the
add case? It does have a well-defined meaning there.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

<Prev in Thread] Current Thread [Next in Thread>