tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ifconfig -a error



On Wed, Aug 13, 2008 at 09:57:35AM +0100, Iain Hibbert wrote:
> On Mon, 4 Aug 2008, Iain Hibbert wrote:
> 
> > with the new ifconfig (on i386) I notice an error
> >
> > % ifconfig -a
> > eon0: flags=3<UP,BROADCAST> mtu 1500
> > ifconfig: link_status: ioctl: Invalid argument
> 
> with the following patch
> 
> --- /usr/src/sys/netiso/if_eon.c      2008-06-20 17:32:11.000000000 +0100
> +++ if_eon.c  2008-08-13 09:36:55.000000000 +0100
> @@ -135,6 +135,7 @@ void
>  eonattach(void)
>  {
>       struct ifnet *ifp = eonif;
> +     uint8_t lla[] = { 0x00, 0x00, 0x00, 0x00, 0x00 };
> 
>  #ifdef ARGO_DEBUG
>       if (argo_debug[D_EON]) {
> @@ -153,7 +154,7 @@ eonattach(void)
>       ifp->if_hdrlen = EONIPLEN;
>       ifp->if_flags = IFF_BROADCAST;
>       if_attach(ifp);
> -     if_alloc_sadl(ifp);
> +     if_set_sadl(ifp, lla, sizeof(lla));
>       eonioctl(ifp, SIOCSIFADDR, ifp->if_dl);
>       eon_llinfo.el_qhdr.link =
>               eon_llinfo.el_qhdr.rlink = &(eon_llinfo.el_qhdr);
> 
> then the ifconfig proceeds thus:
> 
> % ifconfig eon0
> eon0: flags=3<UP,BROADCAST> mtu 1500
>         address: 00:00:00:00:00
> 
> now, clearly this is not right but it indicates that eonattach is not
> setting the address properly. What is the eon address supposed to be?

The link-layer address on an eon(4) instance only holds the instance
name.  A gre(4) also has a lladdr, but gre(4) also sets if_addrlen to 0.
Maybe eon(4) should do the same?

> The SIOCSIFADDR ioctl doesn't actually set any address, it just marks the
> interface as up (seems wrong :).

Many drivers' ioctl code is misleading in this way.  Sometimes a
SIOCSIFADDR is not a SIOCSIFADDR!  The kernel abuses the command constant
SIOCSIFADDR to pass an ifaddr (not an ifreq, mind you!) from the protocols
to the drivers.  (I have fixed this in my tree by introducing a new ioctl,
SIOCINITIFADDR.)  The work of setting an address is done by iso_control()
and iso_ifinit().

> I don't see any documentation about eon

I don't think that documentation exists in the manual.

Dave

-- 
David Young             OJC Technologies
dyoung%ojctech.com@localhost      Urbana, IL * (217) 278-3933 ext 24


Home | Main Index | Thread Index | Old Index