Lines Matching refs:ifre
103 struct ifreq ifre;
104 struct sockaddr_in *si = (void *)&ifre.ifr_addr;
118 xstrncpy(ifre.ifr_name, name, IFNAMSIZ);
119 if (ioctl(TT.sockfd, SIOCGIFFLAGS, &ifre)<0) perror_exit_raw(name);
120 flags = ifre.ifr_flags;
127 ioctl(TT.sockfd, SIOCGIFADDR, &ifre);
129 if (!ioctl(TT.sockfd, SIOCGIFNETMASK, &ifre))
137 xioctl(TT.sockfd, SIOCGIFHWADDR, &ifre);
140 for (i=0; i<6; i++) printf(":%02x"+!i, ifre.ifr_hwaddr.sa_data[i]);
143 if (ifre.ifr_hwaddr.sa_family == types[i].type) break;
145 if(ifre.ifr_hwaddr.sa_family == ARPHRD_ETHER) {
147 for (i=0; i<6; i++) xprintf(":%02x"+!i, ifre.ifr_hwaddr.sa_data[i]);
157 ifre.ifr_addr.sa_family = AF_INET;
158 memset(&ifre.ifr_addr, 0, sizeof(ifre.ifr_addr));
159 ioctl(TT.sockfd, SIOCGIFADDR, &ifre);
160 pp = (char *)&ifre.ifr_addr;
161 for (i = 0; i<sizeof(ifre.ifr_addr); i++) if (pp[i]) break;
163 if (!(toys.optflags&FLAG_S) && i != sizeof(ifre.ifr_addr)) {
164 struct sockaddr_in *si = (struct sockaddr_in *)&ifre.ifr_addr;
181 if (addr[i].ioctl && ioctl(TT.sockfd, addr[i].ioctl, &ifre))
254 if (ioctl(TT.sockfd, SIOCGIFMTU, &ifre) < 0) ifre.ifr_mtu = 0;
255 xprintf(" MTU:%d", ifre.ifr_mtu);
256 if (ioctl(TT.sockfd, SIOCGIFMETRIC, &ifre) < 0) ifre.ifr_metric = 0;
257 if (!ifre.ifr_metric) ifre.ifr_metric = 1;
258 xprintf(" Metric:%d", ifre.ifr_metric);
271 if (ioctl(TT.sockfd, SIOCGIFTXQLEN, &ifre) >= 0) val[16] = ifre.ifr_qlen;
283 if(!ioctl(TT.sockfd, SIOCGIFMAP, &ifre) && (ifre.ifr_map.irq ||
284 ifre.ifr_map.mem_start || ifre.ifr_map.dma || ifre.ifr_map.base_addr))
287 if(ifre.ifr_map.irq) xprintf("Interrupt:%d ", ifre.ifr_map.irq);
288 if(ifre.ifr_map.base_addr >= 0x100) // IO_MAP_INDEX
289 xprintf("Base address:0x%x ", ifre.ifr_map.base_addr);
290 if(ifre.ifr_map.mem_start)
291 xprintf("Memory:%lx-%lx ", ifre.ifr_map.mem_start, ifre.ifr_map.mem_end);
292 if(ifre.ifr_map.dma) xprintf("DMA chan:%x ", ifre.ifr_map.dma);
341 struct ifreq *ifre;
353 ifre = ifcon.ifc_req;
354 for(num = 0; num < ifcon.ifc_len && ifre; num += sizeof(struct ifreq), ifre++)
358 if(!strcmp(sl->str, ifre->ifr_name)) break;
360 if(!sl) display_ifconfig(ifre->ifr_name, toys.optflags & FLAG_a, 0);
370 #define IFREQ_OFFSZ(x) -(int)((offsetof(struct ifreq, x)<<16) + sizeof(ifre.x))
375 struct ifreq ifre;
385 memset(&ifre, 0, sizeof(struct ifreq));
386 xstrncpy(ifre.ifr_name, *argv, IFNAMSIZ);
425 struct sockaddr *sock = &ifre.ifr_hwaddr;
459 if (sock->sa_family == ARPHRD_INFINIBAND && !strchr(ifre.ifr_name, '/')) {
462 sprintf(toybuf, "/sys/class/net/%s/address", ifre.ifr_name);
466 } else xioctl(TT.sockfd, SIOCSIFHWADDR, &ifre);
483 xioctl(fd6, SIOCGIFINDEX, &ifre);
484 ifre6.index = ifre.ifr_ifindex;
505 // Assign value to ifre field and call ioctl? (via IFREQ_OFFSZ.)
509 if (off == SIOCSIFMAP) xioctl(TT.sockfd, SIOCGIFMAP, &ifre);
511 poke((on>>16) + (char *)&ifre, l, on&15);
512 xioctl(TT.sockfd, off, &ifre);
515 struct sockaddr_in *si = (struct sockaddr_in *)&ifre.ifr_addr;
522 xioctl(TT.sockfd, off, &ifre);
529 xioctl(TT.sockfd, SIOCSIFNETMASK, &ifre);
538 xioctl(TT.sockfd, SIOCGIFFLAGS, &ifre);
539 ifre.ifr_flags &= ~(rev ? on : off);
540 ifre.ifr_flags |= (rev ? off : on);
541 xioctl(TT.sockfd, SIOCSIFFLAGS, &ifre);