strcpy(ifr.ifr_name, ifname); if (ec_sock >= 0 && ioctl(ec_sock, SIOCGIFADDR, &ifr) == 0) { ife->ecaddr = ifr.ifr_addr; ife->has_econet = 1;
fd = get_socket_for_af(AF_ECONET); if (fd >= 0) { strcpy(ifr.ifr_name, ifname); if (ioctl(fd, SIOCGIFADDR, &ifr) == 0) { ife->ecaddr = ifr.ifr_addr; ife->has_econet = 1; }
if_fetch(char *ifname, struct interface *ife){  struct ifreq ifr;  strcpy(ifr.ifr_name, ifname);  if (ioctl(skfd, SIOCGIFFLAGS, &ifr) < 0) return(-1);  ife->flags = ifr.ifr_flags;  strcpy(ifr.ifr_name, ifname);  if (ioctl(skfd, SIOCGIFHWADDR, &ifr) < 0)     memset(ife->hwaddr, 0, 32);  else     memcpy(ife->hwaddr,ifr.ifr_hwaddr.sa_data,8);  ife->type=ifr.ifr_hwaddr.sa_family;  strcpy(ifr.ifr_name, ifname);  if (ioctl(skfd, SIOCGIFMETRIC, &ifr) < 0)    ife->metric = 0;  else     ife->metric = ifr.ifr_metric;  strcpy(ifr.ifr_name, ifname);  if (ioctl(skfd, SIOCGIFMTU, &ifr) < 0)    ife->mtu = 0;  else     ife->mtu = ifr.ifr_mtu;  if (ife->type==ARPHRD_SLIP || ife->type==ARPHRD_CSLIP ||      ife->type==ARPHRD_SLIP6 || ife->type==ARPHRD_CSLIP6 ||       ife->type==ARPHRD_ADAPT) {#ifdef SIOCGOUTFILL    strcpy(ifr.ifr_name, ifname);    if (ioctl(skfd, SIOCGOUTFILL, &ifr) < 0)      ife->outfill = 0;    else      ife->outfill = (unsigned int)ifr.ifr_data;#endif#ifdef SIOCGKEEPALIVE    strcpy(ifr.ifr_name, ifname);    if (ioctl(skfd, SIOCGKEEPALIVE, &ifr) < 0)      ife->keepalive = 0;    else      ife->keepalive = (unsigned int)ifr.ifr_data;#endif  }  strcpy(ifr.ifr_name, ifname);  if (ioctl(skfd, SIOCGIFMAP, &ifr) < 0)    memset(&ife->map, 0, sizeof(struct ifmap));  else     memcpy(&ife->map,&ifr.ifr_map,sizeof(struct ifmap));  strcpy(ifr.ifr_name, ifname);  if (ioctl(skfd, SIOCGIFMAP, &ifr) < 0)    memset(&ife->map, 0, sizeof(struct ifmap));  else     ife->map = ifr.ifr_map;#ifdef HAVE_TXQUEUELEN  strcpy(ifr.ifr_name, ifname);  if (ioctl(skfd, SIOCGIFTXQLEN, &ifr) < 0)    ife->tx_queue_len = -1; /* unknown value */  else     ife->tx_queue_len = ifr.ifr_qlen;#else  ife->tx_queue_len = -1; /* unknown value */#endif#if HAVE_AFINET  strcpy(ifr.ifr_name, ifname);  if (inet_sock < 0 || ioctl(inet_sock, SIOCGIFDSTADDR, &ifr) < 0)    memset(&ife->dstaddr, 0, sizeof(struct sockaddr));  else     ife->dstaddr = ifr.ifr_dstaddr;  strcpy(ifr.ifr_name, ifname);  if (inet_sock < 0 || ioctl(inet_sock, SIOCGIFBRDADDR, &ifr) < 0)    memset(&ife->broadaddr, 0, sizeof(struct sockaddr));  else     ife->broadaddr = ifr.ifr_broadaddr;  strcpy(ifr.ifr_name, ifname);  if (inet_sock < 0 || ioctl(inet_sock, SIOCGIFNETMASK, &ifr) < 0)    memset(&ife->netmask, 0, sizeof(struct sockaddr));  else     ife->netmask = ifr.ifr_netmask;  strcpy(ifr.ifr_name, ifname);  if (inet_sock < 0 || ioctl(inet_sock, SIOCGIFADDR, &ifr) < 0)     memset(&ife->addr, 0, sizeof(struct sockaddr));  else     ife->addr = ifr.ifr_addr;#endif  #if HAVE_AFATALK  /* DDP address maybe ? */  strcpy(ifr.ifr_name, ifname);  if (ddp_sock >= 0 && ioctl(ddp_sock, SIOCGIFADDR, &ifr) == 0) {    ife->ddpaddr=ifr.ifr_addr;    ife->has_ddp=1;  }#endif#if HAVE_AFIPX    /* Look for IPX addresses with all framing types */  strcpy(ifr.ifr_name, ifname);  if (ipx_sock >= 0) {    if (!ipx_getaddr(ipx_sock, IPX_FRAME_ETHERII, &ifr)) {      ife->has_ipx_bb=1;      ife->ipxaddr_bb=ifr.ifr_addr;    }    strcpy(ifr.ifr_name, ifname);    if (!ipx_getaddr(ipx_sock, IPX_FRAME_SNAP, &ifr)) {      ife->has_ipx_sn=1;      ife->ipxaddr_sn=ifr.ifr_addr;    }    strcpy(ifr.ifr_name, ifname);    if(!ipx_getaddr(ipx_sock, IPX_FRAME_8023, &ifr)) {      ife->has_ipx_e3=1;      ife->ipxaddr_e3=ifr.ifr_addr;    }    strcpy(ifr.ifr_name, ifname);    if(!ipx_getaddr(ipx_sock, IPX_FRAME_8022, &ifr)) {      ife->has_ipx_e2=1;      ife->ipxaddr_e2=ifr.ifr_addr;    }  }#endif#if HAVE_AFECONET  /* Econet address maybe? */  strcpy(ifr.ifr_name, ifname);  if (ec_sock >= 0 && ioctl(ec_sock, SIOCGIFADDR, &ifr) == 0) {    ife->ecaddr = ifr.ifr_addr;    ife->has_econet = 1;  }#endif  return 0;}