Lines Matching refs:ifaddr
42 int set_ifname(struct ifaddrs* ifaddr, int interface) { in set_ifname() argument
48 ifaddr->ifa_name = new char[strlen(name) + 1]; in set_ifname()
49 strncpy(ifaddr->ifa_name, name, strlen(name) + 1); in set_ifname()
53 int set_flags(struct ifaddrs* ifaddr) { in set_flags() argument
60 strncpy(ifr.ifr_name, ifaddr->ifa_name, IFNAMSIZ - 1); in set_flags()
66 ifaddr->ifa_flags = ifr.ifr_flags; in set_flags()
70 int set_addresses(struct ifaddrs* ifaddr, in set_addresses() argument
78 ifaddr->ifa_addr = reinterpret_cast<sockaddr*>(sa); in set_addresses()
84 ifaddr->ifa_addr = reinterpret_cast<sockaddr*>(sa); in set_addresses()
91 int make_prefixes(struct ifaddrs* ifaddr, int family, int prefixlen) { in make_prefixes() argument
97 ifaddr->ifa_netmask = reinterpret_cast<sockaddr*>(mask); in make_prefixes()
106 ifaddr->ifa_netmask = reinterpret_cast<sockaddr*>(mask); in make_prefixes()
123 int populate_ifaddrs(struct ifaddrs* ifaddr, in populate_ifaddrs() argument
127 if (set_ifname(ifaddr, msg->ifa_index) != 0) { in populate_ifaddrs()
130 if (set_flags(ifaddr) != 0) { in populate_ifaddrs()
133 if (set_addresses(ifaddr, msg, bytes, len) != 0) { in populate_ifaddrs()
136 if (make_prefixes(ifaddr, msg->ifa_family, msg->ifa_prefixlen) != 0) { in populate_ifaddrs()