Lines Matching refs:ifre
98 struct ifreq ifre;
112 xstrncpy(ifre.ifr_name, name, IFNAMSIZ);
113 if (ioctl(TT.sockfd, SIOCGIFFLAGS, &ifre)<0) perror_exit_raw(name);
114 flags = ifre.ifr_flags;
118 i = ioctl(TT.sockfd, SIOCGIFHWADDR, &ifre);
121 if (ifre.ifr_hwaddr.sa_family == types[i].type) break;
124 if(i >= 0 && ifre.ifr_hwaddr.sa_family == ARPHRD_ETHER) {
126 for (i=0; i<6; i++) xprintf(":%02x"+!i, ifre.ifr_hwaddr.sa_data[i]);
132 ifre.ifr_addr.sa_family = AF_INET;
133 memset(&ifre.ifr_addr, 0, sizeof(ifre.ifr_addr));
134 ioctl(TT.sockfd, SIOCGIFADDR, &ifre);
135 pp = (char *)&ifre.ifr_addr;
136 for (i = 0; i<sizeof(ifre.ifr_addr); i++) if (pp[i]) break;
138 if (i != sizeof(ifre.ifr_addr)) {
139 struct sockaddr_in *si = (struct sockaddr_in *)&ifre.ifr_addr;
155 if (addr[i].ioctl && ioctl(TT.sockfd, addr[i].ioctl, &ifre))
222 if (ioctl(TT.sockfd, SIOCGIFMTU, &ifre) < 0) ifre.ifr_mtu = 0;
223 xprintf(" MTU:%d", ifre.ifr_mtu);
224 if (ioctl(TT.sockfd, SIOCGIFMETRIC, &ifre) < 0) ifre.ifr_metric = 0;
225 if (!ifre.ifr_metric) ifre.ifr_metric = 1;
226 xprintf(" Metric:%d", ifre.ifr_metric);
239 if (ioctl(TT.sockfd, SIOCGIFTXQLEN, &ifre) >= 0) val[16] = ifre.ifr_qlen;
251 if(!ioctl(TT.sockfd, SIOCGIFMAP, &ifre) && (ifre.ifr_map.irq ||
252 ifre.ifr_map.mem_start || ifre.ifr_map.dma || ifre.ifr_map.base_addr))
255 if(ifre.ifr_map.irq) xprintf("Interrupt:%d ", ifre.ifr_map.irq);
256 if(ifre.ifr_map.base_addr >= 0x100) // IO_MAP_INDEX
257 xprintf("Base address:0x%x ", ifre.ifr_map.base_addr);
258 if(ifre.ifr_map.mem_start)
259 xprintf("Memory:%lx-%lx ", ifre.ifr_map.mem_start, ifre.ifr_map.mem_end);
260 if(ifre.ifr_map.dma) xprintf("DMA chan:%x ", ifre.ifr_map.dma);
309 struct ifreq *ifre;
321 ifre = ifcon.ifc_req;
322 for(num = 0; num < ifcon.ifc_len && ifre; num += sizeof(struct ifreq), ifre++)
326 if(!strcmp(sl->str, ifre->ifr_name)) break;
328 if(!sl) display_ifconfig(ifre->ifr_name, toys.optflags & FLAG_a, 0);
338 #define IFREQ_OFFSZ(x) -(int)((offsetof(struct ifreq, x)<<16) + sizeof(ifre.x))
343 struct ifreq ifre;
353 memset(&ifre, 0, sizeof(struct ifreq));
354 xstrncpy(ifre.ifr_name, *argv, IFNAMSIZ);
393 struct sockaddr *sock = &ifre.ifr_hwaddr;
427 if (sock->sa_family == ARPHRD_INFINIBAND && !strchr(ifre.ifr_name, '/')) {
430 sprintf(toybuf, "/sys/class/net/%s/address", ifre.ifr_name);
434 } else xioctl(TT.sockfd, SIOCSIFHWADDR, &ifre);
451 xioctl(fd6, SIOCGIFINDEX, &ifre);
452 ifre6.index = ifre.ifr_ifindex;
473 // Assign value to ifre field and call ioctl? (via IFREQ_OFFSZ.)
477 if (off == SIOCSIFMAP) xioctl(TT.sockfd, SIOCGIFMAP, &ifre);
479 poke((on>>16) + (char *)&ifre, l, on&15);
480 xioctl(TT.sockfd, off, &ifre);
483 struct sockaddr_in *si = (struct sockaddr_in *)&ifre.ifr_addr;
490 xioctl(TT.sockfd, off, &ifre);
497 xioctl(TT.sockfd, SIOCSIFNETMASK, &ifre);
506 xioctl(TT.sockfd, SIOCGIFFLAGS, &ifre);
507 ifre.ifr_flags &= ~(rev ? on : off);
508 ifre.ifr_flags |= (rev ? off : on);
509 xioctl(TT.sockfd, SIOCSIFFLAGS, &ifre);