> Hi, > > could someone with more knowledge of the tun device please take a look > at the code around line 387 in net/if_tun.c? It looks like tunoutput() > drops all packets here that aren't of the AF_INET family - most notably, > it drops IPv6 packets. > > We hacked around this with the simple fix below, but I'm not sure if > there are any drawbacks... > > --- if_tun.c.old Tue May 14 15:40:30 2002 > +++ if_tun.c Tue May 14 15:48:15 2002 > @@ -384,7 +384,7 @@ > *(u_int32_t *)m0->m_data = htonl(dst->sa_family); > } else { > #ifdef INET > - if (dst->sa_family != AF_INET) > + if (dst->sa_family != AF_INET && dst->sa_family != AF_INET6) > #endif > { > m_freem(m0); > > Thanks, > Lars > -- > Lars Eggert <[EMAIL PROTECTED]> USC Information Sciences Institute
If you look at the larger picture.... if (tp->tun_flags & TUN_IFHEAD) { /* Prepend the address family */ M_PREPEND(m0, 4, M_DONTWAIT); /* if allocation failed drop packet */ if (m0 == NULL) { ifp->if_iqdrops++; ifp->if_oerrors++; return (ENOBUFS); } else *(u_int32_t *)m0->m_data = htonl(dst->sa_family); } else { #ifdef INET if (dst->sa_family != AF_INET) #endif { m_freem(m0); return (EAFNOSUPPORT); } } The tun device, when given the TUNSIFHEAD ioctl, will prepend the address family. If TUNSIFHEAD is turned off, it will drop non IPv4 packets. This was done for backwards compatibility. To use IPv6 with tun, you must use the TUNSIFHEAD ioctl and prepend/strip the address family on the front of each packet (see bundle_Create() in src/usr.sbin/ppp/bundle.c). -- Brian <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> http://www.freebsd-services.com/ <brian@[uk.]FreeBSD.org> Don't _EVER_ lose your sense of humour ! <brian@[uk.]OpenBSD.org> To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-net" in the body of the message