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>À\000¿ÉW¸» ]»»", 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\000¼i\006\b\000Ƽ»n¸·»h
é¿¿\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