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

Network driver again



Hello there

// rtems_glue.c
/*
   * Get the interface flags
   */
  strcpy (ifreq.ifr_name, ifp->name);

After that we have in ifreq.ifr_name just name of our interface but
name+unit


ioctl(s, SIOCGIFFLAGS, &ifreq) -> so_ioctl  -> ifioctl ->ifunit

// if.c
/*
 * Interface ioctls.
 */
int ifioctl(so, cmd, data, p)
        struct socket *so;
        int cmd;
        caddr_t data;
        struct proc *p;
{
        register struct ifnet *ifp;
        register struct ifreq *ifr;
        int error;

        switch (cmd) {

        case SIOCGIFCONF:
        case OSIOCGIFCONF:
                return (ifconf(cmd, data));
        }
        ifr = (struct ifreq *)data;
        ifp = ifunit(ifr->ifr_name);            // In this point I recieve 0
and rtems_panic ("Can't get %s flags: %s", ifp->name, strerror (errno));
        if (ifp == 0)
                return (ENXIO);


What's wrong?


Regards
Alexey