Lines Matching refs:ifr
443 struct ifreq ifr = { in setCfg() local
446 strlcpy(ifr.ifr_name, cfg.ifName.c_str(), IFNAMSIZ); in setCfg()
450 RETURN_IF_NOT_OK(sys.ioctl(fd, SIOCSIFADDR, &ifr)); in setCfg()
453 RETURN_IF_NOT_OK(sys.ioctl(fd, SIOCGIFFLAGS, &ifr)); in setCfg()
454 uint16_t flags = ifr.ifr_flags; in setCfg()
458 ifr.ifr_flags = ifr.ifr_flags | IFF_UP; in setCfg()
460 ifr.ifr_flags = (ifr.ifr_flags & (~IFF_UP)); in setCfg()
464 if (ifr.ifr_flags != flags) { in setCfg()
465 RETURN_IF_NOT_OK(sys.ioctl(fd, SIOCSIFFLAGS, &ifr)); in setCfg()
486 struct ifreq ifr = {}; in getCfg() local
487 strlcpy(ifr.ifr_name, ifName.c_str(), IFNAMSIZ); in getCfg()
489 if (isOk(sys.ioctl(fd, SIOCGIFADDR, &ifr))) { in getCfg()
490 addr.s_addr = ((struct sockaddr_in*) &ifr.ifr_addr)->sin_addr.s_addr; in getCfg()
493 if (isOk(sys.ioctl(fd, SIOCGIFNETMASK, &ifr))) { in getCfg()
495 ipv4NetmaskToPrefixLength(((struct sockaddr_in*) &ifr.ifr_addr)->sin_addr.s_addr); in getCfg()
498 if (isOk(sys.ioctl(fd, SIOCGIFFLAGS, &ifr))) { in getCfg()
499 flags = ifr.ifr_flags; in getCfg()
504 if (isOk(sys.ioctl(fd, SIOCGIFHWADDR, &ifr))) { in getCfg()
505 memcpy((void*) hwaddr, &ifr.ifr_hwaddr.sa_data, ETH_ALEN); in getCfg()