Lines Matching refs:ifr
476 struct ifreq ifr = { in setCfg() local
479 strlcpy(ifr.ifr_name, cfg.ifName.c_str(), IFNAMSIZ); in setCfg()
483 RETURN_IF_NOT_OK(sys.ioctl(fd, SIOCSIFADDR, &ifr)); in setCfg()
486 RETURN_IF_NOT_OK(sys.ioctl(fd, SIOCGIFFLAGS, &ifr)); in setCfg()
487 uint16_t flags = ifr.ifr_flags; in setCfg()
491 ifr.ifr_flags = ifr.ifr_flags | IFF_UP; in setCfg()
493 ifr.ifr_flags = (ifr.ifr_flags & (~IFF_UP)); in setCfg()
497 if (ifr.ifr_flags != flags) { in setCfg()
498 RETURN_IF_NOT_OK(sys.ioctl(fd, SIOCSIFFLAGS, &ifr)); in setCfg()
519 struct ifreq ifr = {}; in getCfg() local
520 strlcpy(ifr.ifr_name, ifName.c_str(), IFNAMSIZ); in getCfg()
522 if (isOk(sys.ioctl(fd, SIOCGIFADDR, &ifr))) { in getCfg()
523 addr.s_addr = ((struct sockaddr_in*) &ifr.ifr_addr)->sin_addr.s_addr; in getCfg()
526 if (isOk(sys.ioctl(fd, SIOCGIFNETMASK, &ifr))) { in getCfg()
528 ipv4NetmaskToPrefixLength(((struct sockaddr_in*) &ifr.ifr_addr)->sin_addr.s_addr); in getCfg()
531 if (isOk(sys.ioctl(fd, SIOCGIFFLAGS, &ifr))) { in getCfg()
532 flags = ifr.ifr_flags; in getCfg()
537 if (isOk(sys.ioctl(fd, SIOCGIFHWADDR, &ifr))) { in getCfg()
538 memcpy((void*) hwaddr, &ifr.ifr_hwaddr.sa_data, ETH_ALEN); in getCfg()