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
|