netdev
[Top] [All Lists]

Re: [XFRM] Probe selected algorithm only

To: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [XFRM] Probe selected algorithm only
From: Andreas Schwab <schwab@xxxxxxx>
Date: Fri, 04 Feb 2005 22:29:49 +0100
Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>, netdev@xxxxxxxxxxx
In-reply-to: <20050121101938.GA1133@gondor.apana.org.au> (Herbert Xu's message of "Fri, 21 Jan 2005 21:19:38 +1100")
References: <20050121101938.GA1133@gondor.apana.org.au>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)
Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> writes:

> ===== net/xfrm/xfrm_algo.c 1.15 vs edited =====
> --- 1.15/net/xfrm/xfrm_algo.c 2004-12-28 13:33:32 +11:00
> +++ edited/net/xfrm/xfrm_algo.c       2005-01-21 21:17:12 +11:00
> @@ -13,6 +13,7 @@
>  #include <linux/module.h>
>  #include <linux/kernel.h>
>  #include <linux/pfkeyv2.h>
> +#include <linux/crypto.h>
>  #include <net/xfrm.h>
>  #if defined(CONFIG_INET_AH) || defined(CONFIG_INET_AH_MODULE) || 
> defined(CONFIG_INET6_AH) || defined(CONFIG_INET6_AH_MODULE)
>  #include <net/ah.h>
> @@ -346,58 +347,48 @@
>       return NULL;
>  }
>  
> -struct xfrm_algo_desc *xfrm_aalg_get_byname(char *name)
> +static struct xfrm_algo_desc *xfrm_get_byname(struct xfrm_algo_desc *list,
> +                                           int entries, char *name,
> +                                           int probe)
>  {
> -     int i;
> +     int i, status;
>  
>       if (!name)
>               return NULL;
>  
> -     for (i=0; i < aalg_entries(); i++) {
> -             if (strcmp(name, aalg_list[i].name) == 0) {
> -                     if (aalg_list[i].available)
> -                             return &aalg_list[i];
> -                     else
> -                             break;
> -             }
> +     for (i = 0; i < entries; i++) {
> +             if (!strcmp(name, list[i].name))
> +                     continue;

You probably didn't mean this. :-)

Return the first matching entry in xfrm_get_byname instead of the first
non-matching one.

Signed-off-by: Andreas Schwab <schwab@xxxxxxx>

--- linux-2.6.11-rc3/net/xfrm/xfrm_algo.c.~1~   2005-02-03 22:54:42.000000000 
+0100
+++ linux-2.6.11-rc3/net/xfrm/xfrm_algo.c       2005-02-04 21:56:11.000000000 
+0100
@@ -357,7 +357,7 @@ static struct xfrm_algo_desc *xfrm_get_b
                return NULL;
 
        for (i = 0; i < entries; i++) {
-               if (!strcmp(name, list[i].name))
+               if (strcmp(name, list[i].name) != 0)
                        continue;
 
                if (list[i].available)

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@xxxxxxx
SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 NÃrnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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