[Click] minor bug report with NetBSD

Vivek raghunathan vivek.raghunathan at gmail.com
Tue May 23 13:46:21 EDT 2006


Eddie and all,

Another question regarding the KernelTap. It seems like you cannot
push ARP packets to it, because the code in push(int, Packet *) infers
the Ethernet protocol field from the version information in the IP
header of the packet (IPv4/IPv6) and prepends it to the packet before
writing it to the tap device. It seems like the reason you do this is
that the universal tun/tap driver in Linux expects this field
prepended to the Ethernet frames written from userspace.

Since this information is also in the Ethernet header, why can't we
extract it from there? That would make the tap virtual Ethernet device
agnostic to which higher layer protocol it is transporting. Or am I
missing something fundamental here?

Vivek





On 5/20/06, Vivek raghunathan <vivek.raghunathan at gmail.com> wrote:
> Eddie,
>
> I am currently interning at BBN with the Internetworking Research
> group there. It seems like the KernelTap and KernelTun devices need to
> be patched for NetBSD support ... I'll send you the patch as soon as
> we are done.
>
> Vivek
>
>
> On 5/19/06, Eddie Kohler <kohler at cs.ucla.edu> wrote:
> > Hi Vivek,
> >
> > It looks like KernelTun needs to be altered to work on NetBSD.  If you look at
> > the source, in elements/userlevel/kerneltun.{cc,hh}, you'll see that there are
> > several cases built in to the code, for Apple, FreeBSD, Linux (ethertap and
> > universal tun), OpenBSD.  Would you like to provide us with a patch for NetBSD
> > support??  We'd love it...
> >
> > E
> >
> >
> > Vivek raghunathan wrote:
> > > Eddie,
> > >
> > > SIOCSIFMTU is supported. NetBSD's tun device has a max mtu of TUNMTU =
> > > 1500.
> > >
> > > Another minor bug in the userlevel/kerneltun.cc file: it seems like
> > > NetBSD does not preprend a 4 byte address family field in front of the
> > > IP header. Thus, in elements/kerneltun.cc:348 or so, the af field is
> > > in fact the first 4 bytes of the IP header, resulting in  (af !=
> > > AF_INET && af != AF_INET6) codepath being entered and userspace does
> > > not receive the packets.
> > >
> > > Vivek
> > >
> > >
> > > On 5/17/06, Eddie Kohler <kohler at cs.ucla.edu> wrote:
> > >> Hi Vivek,
> > >>
> > >> So the point of SIOCSIFMTU is to set the MTU.  Are you saying the
> > >> NetBSD's tun
> > >> device CANNOT have an MTU larger than 1500?  Or that the SIOCSIFMTU
> > >> ioctl is
> > >> not supported?
> > >>
> > >> Eddie
> > >>
> > >>
> > >> Vivek raghunathan wrote:
> > >> > The mail was partially sent.
> > >> >
> > >> > With NetBSD, the conf/test-tun.click script doesn't work.
> > >> >
> > >> > bash-3.1$ sudo userlevel/click conf/test-tun.click
> > >> > conf/test-tun.click:19: While initializing 'tun :: KernelTun':
> > >> >   SIOCSIFMTU failed: Invalid argument
> > >> > Router could not be initialized!
> > >> >
> > >> > Reason:
> > >> > minor bug in userlevel/kerneltun.cc:
> > >> >>     268 ifr.ifr_mtu = _mtu_out;
> > >> >>     269     if (ioctl(s, SIOCSIFMTU, &ifr) != 0)
> > >> >>     270         return errh->error("SIOCSIFMTU failed: %s",
> > >> strerror(errno));
> > >> >
> > >> > NetBSD's tun device has a default MTU of 1500. _mtu_out is set to 2048
> > >> > by default, and NetBSD returns EINVAL on the ioctl.
> > >> >
> > >> > Fix:
> > >> > set DEFAULT_MTU to <= 1500
> > >> >
> > >> > -Vivek
> > >> >
> > >> >
> > >> > On 5/17/06, Vivek raghunathan <vivek.raghunathan at gmail.com> wrote:
> > >> >> bug in userlevel/kerneltun.cc:
> > >> >> 268 ifr.ifr_mtu = _mtu_out;
> > >> >>     269     if (ioctl(s, SIOCSIFMTU, &ifr) != 0)
> > >> >>     270         return errh->error("SIOCSIFMTU failed: %s",
> > >> strerror(errno));
> > >> >>
> > >> >>
> > >> >>
> > >> >>
> > >> >> --
> > >> >>
> > >> >> *************************************
> > >> >> Vivek Raghunathan,
> > >> >> PhD student,
> > >> >> University of Illinois, Urbana-Champaign
> > >> >>
> > >> >> Contact Details:
> > >> >> 1012 W. Clark St #31,
> > >> >> Urbana IL 61801
> > >> >>
> > >> >> ph: 217-766-1868 (cell)
> > >> >>     217-333-7541 (off)
> > >> >>
> > >> >
> > >> >
> > >>
> > >
> > >
> >
>
>
> --
>
> *************************************
> Vivek Raghunathan,
> PhD student,
> University of Illinois, Urbana-Champaign
>
> Contact Details:
> 1012 W. Clark St #31,
> Urbana IL 61801
>
> ph: 217-766-1868 (cell)
>     217-333-7541 (off)
>


-- 

*************************************
Vivek Raghunathan,
PhD student,
University of Illinois, Urbana-Champaign

Contact Details:
1012 W. Clark St #31,
Urbana IL 61801

ph: 217-766-1868 (cell)
    217-333-7541 (off)


More information about the click mailing list