Subject: dhcpd
To: None <current-users@netbsd.org>
From: Patrick Welche <prlw1@newn.cam.ac.uk>
List: current-users
Date: 09/12/2007 15:44:53
Something changed with dhcpd within the last 2 days, but I can't spot what.
10th Sep kernel/userland works, todays gives me:

  Can't get interface flags for >: Device not configured

which is from src/dist/dhcp/common/discover.c:265

(gdb) n
265                     if (ioctl (sock, SIOCGIFFLAGS, &ifr) < 0)
(gdb)
266                             log_fatal ("Can't get interface flags for %s: %m
",  
(gdb) print ifr
$21 = {ifr_name = "\006>\000W ]", ifr_ifru = {ifru_addr = {
      sa_len = 67 'C', sa_family = 136 '\210',
      sa_data = "\000\000\000\000\000\000\002\000\000\000$⺻"},
    ifru_dstaddr = {sa_len = 67 'C', sa_family = 136 '\210',
      sa_data = "\000\000\000\000\000\000\002\000\000\000$⺻"},
    ifru_broadaddr = {sa_len = 67 'C', sa_family = 136 '\210',
      sa_data = "\000\000\000\000\000\000\002\000\000\000$⺻"}, ifru_space = {
      ss_len = 67 'C', ss_family = 136 '\210',
      __ss_pad1 = "\000\000\000\000\000", __ss_align = -4919370998702145534,
      __ss_pad2 = "\000\020\b\b\000\000\000\001H\216\004\b\205\221\004\b(鿿
;\031\b\b\000x\020\b\000Ƽ`4\n\b\000\000\000\000\230鿿j\210\000\000\000\
000\000\000\000\000\220꿿\210鿿\204\006\b\000\000\000\000i\006\b\000Ƽnh
鿿\000\000\000\000\000\000\000\000\000¼x\002\000"}, ifru_flags = -30653,
    ifru_metric = 34883, ifru_mtu = 34883, ifru_dlt = 34883,
    ifru_value = 34883, ifru_data = 0x8843, ifru_b = {b_buflen = 34883,
      b_buf = 0x0}}}


Thing is, the loop

    /* Cycle through the list of interfaces looking for IP addresses. */
    for (i = 0; i < ic.ifc_len;) {

seems to succeed once with ifcpy.ifr.ifr_name=bge0, but then gets run
again, and the ioctl fails the second time - ifr_name is still bge0.

ic.ifc_len=1008

#ifdef HAVE_SA_LEN
        if (ifp -> ifr_addr.sa_len > sizeof (struct sockaddr)) {
            if (sizeof(struct ifreq) + ifp->ifr_addr.sa_len >
                sizeof(ifcpy))
                break;
            memcpy(&ifcpy, (caddr_t)ic.ifc_req + i, 
                sizeof(struct ifreq) + ifp->ifr_addr.sa_len);
            i += offsetof(struct ifreq, ifr_ifru) +
                ifp -> ifr_addr.sa_len;
        } else         

After i+1, i=34.

None of those source files seem to have changed since 10th...

Thoughts?

Cheers,

Patrick