(usagi-users 04017) Re: Linux kernel net/ipv6/ip6_tunnel.c

Yasuyuki KOZAKAI <[email protected]> Tue, 15 Jan 2008 21:39:57 +0900 (JST)
Newsgroups gmane.linux.ipv6.usagi.users
Message-ID <[email protected]>
[Cc: usagi-users ]

Sorry for very late replying. I've noticed your mail now...

From: Gregoire Henry <[email protected]>
Date: Wed, 12 Sep 2007 14:29:16 +0200

> Dear ip6_tunnel hackers,
>=20
>   Here is a single-line patch and one question.
>=20
>   First: since this module allow to encapsulate IPv4 packets too, I
> believe, we may have to use 2 tunnels with the same endpoints but
> different encapsulated protocols. The current implementation did not
> allow this. A patch is attached. Hope it helps.

You can create tunnel which encapsulates both of IPv4 and IPv6 packets by

$ ip -f inet6 tunnel add <tunnel name> mode any local <local addr> <remot=
e addr>

>   Second: did you intends to implement something=20
> like NBMA tunnels as in net/ipv4/ip_gre.c  ? (see
> http://linux-ip.net/gl/ip-tunnels/node4.html)
> Or, if not, have you an argument against I try to implement
> it and submit it to your expertise ?

No. I have no plan to implement it.

> Greetings,
> -- Gr=E9goire Henry

> diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
> index ca774d8..926a930 100644
> --- a/net/ipv6/ip6_tunnel.c
> +++ b/net/ipv6/ip6_tunnel.c
> @@ -282,7 +282,8 @@ static struct ip6_tnl *ip6_tnl_locate(struct ip6_tn=
l_parm *p, int create)
> =20
>  	for (t =3D *ip6_tnl_bucket(p); t; t =3D t->next) {
>  		if (ipv6_addr_equal(local, &t->parms.laddr) &&
> -		    ipv6_addr_equal(remote, &t->parms.raddr))
> +		    ipv6_addr_equal(remote, &t->parms.raddr) &&
> +		    p->proto =3D=3D t->parms.proto)
>  			return t;
>  	}
>  	if (!create)

'proto' can be 0 (it means wildcard). So we have to consider the range of
the overlapped protocol number, if we really allow users to create multip=
le
tunnels for different inner protocols. I want to keep the current code fo=
r
simplicity and you can configure the tunnel which you want without this
patch.

Regards,

-- Yasuyuki Kozakai