netdev
[Top] [All Lists]

Re: patch2: del/get byid

To: jamal <hadi@xxxxxxxxxx>
Subject: Re: patch2: del/get byid
From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 29 Apr 2005 09:11:54 +1000
Cc: Alexey Kuznetsov <kuznet@xxxxxxxxxxxxx>, netdev@xxxxxxxxxxx, "David S. Miller" <davem@xxxxxxxxxxxxx>
In-reply-to: <1114698033.7663.197.camel@xxxxxxxxxxxxxxxxxxxxx>
References: <1114654284.7663.50.camel@xxxxxxxxxxxxxxxxxxxxx> <20050428021426.GA23415@xxxxxxxxxxxxxxxxxxx> <1114655014.7663.61.camel@xxxxxxxxxxxxxxxxxxxxx> <20050428022549.GA23556@xxxxxxxxxxxxxxxxxxx> <1114655980.7663.76.camel@xxxxxxxxxxxxxxxxxxxxx> <20050428024253.GA23695@xxxxxxxxxxxxxxxxxxx> <1114656932.7663.88.camel@xxxxxxxxxxxxxxxxxxxxx> <20050428030325.GB23823@xxxxxxxxxxxxxxxxxxx> <1114658657.7663.110.camel@xxxxxxxxxxxxxxxxxxxxx> <1114698033.7663.197.camel@xxxxxxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.6+20040907i
On Thu, Apr 28, 2005 at 10:20:33AM -0400, jamal wrote:
> 
> Well, heres some minimalist patch i havent tested. i.e doesnt change any
> of the functions; but at least it doesnt break the timers.
> This includes both patches i posted earlier and introduces dir in 
> xfrm_policy. 

Thanks, the dir stuff looks good.

> @@ -345,7 +345,10 @@
>  
>       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))) {

Now that you are allowing the user to set the index, this excl check
really needs to go.  Otherwise the user can add two policies with
the same index.

You also still need to solve the problem that you may need to
delete two policies if one matches the index while the other matches
the selector (or selector plus priority if you do that).

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>