Lines Matching refs:ifre
103 struct ifreq ifre; in display_ifconfig() local
104 struct sockaddr_in *si = (void *)&ifre.ifr_addr; in display_ifconfig()
118 xstrncpy(ifre.ifr_name, name, IFNAMSIZ); in display_ifconfig()
119 if (ioctl(TT.sockfd, SIOCGIFFLAGS, &ifre)<0) perror_exit_raw(name); in display_ifconfig()
120 flags = ifre.ifr_flags; in display_ifconfig()
127 ioctl(TT.sockfd, SIOCGIFADDR, &ifre); in display_ifconfig()
129 if (!ioctl(TT.sockfd, SIOCGIFNETMASK, &ifre)) in display_ifconfig()
138 ioctl(TT.sockfd, SIOCGIFHWADDR, &ifre); in display_ifconfig()
141 for (i=0; i<6; i++) printf(":%02x"+!i, ifre.ifr_hwaddr.sa_data[i]); in display_ifconfig()
144 if (ifre.ifr_hwaddr.sa_family == types[i].type) break; in display_ifconfig()
146 if(ifre.ifr_hwaddr.sa_family == ARPHRD_ETHER) { in display_ifconfig()
148 for (i=0; i<6; i++) xprintf(":%02x"+!i, ifre.ifr_hwaddr.sa_data[i]); in display_ifconfig()
158 ifre.ifr_addr.sa_family = AF_INET; in display_ifconfig()
159 memset(&ifre.ifr_addr, 0, sizeof(ifre.ifr_addr)); in display_ifconfig()
160 ioctl(TT.sockfd, SIOCGIFADDR, &ifre); in display_ifconfig()
161 pp = (char *)&ifre.ifr_addr; in display_ifconfig()
162 for (i = 0; i<sizeof(ifre.ifr_addr); i++) if (pp[i]) break; in display_ifconfig()
164 if (!(toys.optflags&FLAG_S) && i != sizeof(ifre.ifr_addr)) { in display_ifconfig()
165 struct sockaddr_in *si = (struct sockaddr_in *)&ifre.ifr_addr; in display_ifconfig()
182 if (addr[i].ioctl && ioctl(TT.sockfd, addr[i].ioctl, &ifre)) in display_ifconfig()
255 if (ioctl(TT.sockfd, SIOCGIFMTU, &ifre) < 0) ifre.ifr_mtu = 0; in display_ifconfig()
256 xprintf(" MTU:%d", ifre.ifr_mtu); in display_ifconfig()
257 if (ioctl(TT.sockfd, SIOCGIFMETRIC, &ifre) < 0) ifre.ifr_metric = 0; in display_ifconfig()
258 if (!ifre.ifr_metric) ifre.ifr_metric = 1; in display_ifconfig()
259 xprintf(" Metric:%d", ifre.ifr_metric); in display_ifconfig()
272 if (ioctl(TT.sockfd, SIOCGIFTXQLEN, &ifre) >= 0) val[16] = ifre.ifr_qlen; in display_ifconfig()
284 if(!ioctl(TT.sockfd, SIOCGIFMAP, &ifre) && (ifre.ifr_map.irq || in display_ifconfig()
285 ifre.ifr_map.mem_start || ifre.ifr_map.dma || ifre.ifr_map.base_addr)) in display_ifconfig()
288 if(ifre.ifr_map.irq) xprintf("Interrupt:%d ", ifre.ifr_map.irq); in display_ifconfig()
289 if(ifre.ifr_map.base_addr >= 0x100) // IO_MAP_INDEX in display_ifconfig()
290 xprintf("Base address:0x%x ", ifre.ifr_map.base_addr); in display_ifconfig()
291 if(ifre.ifr_map.mem_start) in display_ifconfig()
292 xprintf("Memory:%lx-%lx ", ifre.ifr_map.mem_start, ifre.ifr_map.mem_end); in display_ifconfig()
293 if(ifre.ifr_map.dma) xprintf("DMA chan:%x ", ifre.ifr_map.dma); in display_ifconfig()
342 struct ifreq *ifre; in show_iface() local
354 ifre = ifcon.ifc_req; in show_iface()
355 for(num = 0; num < ifcon.ifc_len && ifre; num += sizeof(struct ifreq), ifre++) in show_iface()
359 if(!strcmp(sl->str, ifre->ifr_name)) break; in show_iface()
361 if(!sl) display_ifconfig(ifre->ifr_name, toys.optflags & FLAG_a, 0); in show_iface()
371 #define IFREQ_OFFSZ(x) -(int)((offsetof(struct ifreq, x)<<16) + sizeof(ifre.x))
376 struct ifreq ifre; in ifconfig_main() local
386 memset(&ifre, 0, sizeof(struct ifreq)); in ifconfig_main()
387 xstrncpy(ifre.ifr_name, *argv, IFNAMSIZ); in ifconfig_main()
426 struct sockaddr *sock = &ifre.ifr_hwaddr; in ifconfig_main()
460 if (sock->sa_family == ARPHRD_INFINIBAND && !strchr(ifre.ifr_name, '/')) { in ifconfig_main()
463 sprintf(toybuf, "/sys/class/net/%s/address", ifre.ifr_name); in ifconfig_main()
467 } else xioctl(TT.sockfd, SIOCSIFHWADDR, &ifre); in ifconfig_main()
484 xioctl(fd6, SIOCGIFINDEX, &ifre); in ifconfig_main()
485 ifre6.index = ifre.ifr_ifindex; in ifconfig_main()
510 if (off == SIOCSIFMAP) xioctl(TT.sockfd, SIOCGIFMAP, &ifre); in ifconfig_main()
512 poke((on>>16) + (char *)&ifre, l, on&15); in ifconfig_main()
513 xioctl(TT.sockfd, off, &ifre); in ifconfig_main()
516 struct sockaddr_in *si = (struct sockaddr_in *)&ifre.ifr_addr; in ifconfig_main()
523 xioctl(TT.sockfd, off, &ifre); in ifconfig_main()
530 xioctl(TT.sockfd, SIOCSIFNETMASK, &ifre); in ifconfig_main()
539 xioctl(TT.sockfd, SIOCGIFFLAGS, &ifre); in ifconfig_main()
540 ifre.ifr_flags &= ~(rev ? on : off); in ifconfig_main()
541 ifre.ifr_flags |= (rev ? off : on); in ifconfig_main()
542 xioctl(TT.sockfd, SIOCSIFFLAGS, &ifre); in ifconfig_main()