On Wed, Apr 27, 2005 at 08:27:06AM -0400, Jamal Hadi Salim wrote:
>
> --- /usr/src/26117-mod/net/xfrm/xfrm_policy.c 2005/04/27 11:32:13 1.1
> +++ /usr/src/26117-mod/net/xfrm/xfrm_policy.c 2005/04/27 12:25:24
> @@ -345,7 +345,9 @@
>
> write_lock_bh(&xfrm_policy_lock);
> for (p = &xfrm_policy_list[dir]; (pol=*p)!=NULL;) {
> - if (!delpol && memcmp(&policy->selector, &pol->selector,
> sizeof(pol->selector)) == 0) {
> + if (!delpol &&
> + ((!excl && policy->index && (policy->index == pol->index)) ||
> + (memcmp(&policy->selector, &pol->selector,
> sizeof(pol->selector)) == 0))) {
I have no problems with the idea itself. However, I have a couple of
minor issues with this patch :)
First of all please align the continued lines to the if expression, e.g.,
if (!delpol &&
(policy->index && (policy->index == pol->index)) ||
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.
> if (excl) {
> write_unlock_bh(&xfrm_policy_lock);
> return -EEXIST;
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
|