On Thu, Dec 11, 2008 at 06:29:56PM +0100, Andreas Henriksson wrote:
> It seems like the kernel rejects the configuration (missing both local
> and remote) without returning a proper error code for the ioctl call
> in ip/tunnel.c:tnl_add_ioctl().
> 

Actually, it does nothing if an identical configuration already exists
(ignoring the name you give).

try this:
ip tunnel add test1 mode ipip remote 1.2.3.4
ip tunnel add test2 mode ipip remote 1.2.3.4

Result: test1 will be added, test2 won't because the configuration is
identical to test1 which already exists.

Your example, missing both remote and local is identical to the
"always existing" tunnel interface that gets added as soon as you load the
module. (ie. sit0 for sit, tunl0 for ipip, ...)


from linux-2.6/net/ipv4/ipip.c:

static struct ip_tunnel * ipip_tunnel_locate(struct net *net,
                struct ip_tunnel_parm *parms, int create)
{
        ...

        for (tp = __ipip_bucket(ipn, parms); (t = *tp) != NULL; tp = &t->next) {
                if (local == t->parms.iph.saddr && remote == t->parms.iph.daddr)
                        return t;
        }
        if (!create)
                return NULL;

        ... otherwise create it here...
}

This function gets called with create==1, but it'll never create the
tunnel interface because the for loop matches in both our cases discussed
above.

Not very obvious for the user...

-- 
Andreas Henriksson

Attachment: signature.asc
Description: Digital signature

Reply via email to