summaryrefslogtreecommitdiff
path: root/src/network/getifaddrs.c
AgeCommit message (Collapse)AuthorLines
2015-11-30properly handle point-to-point interfaces in getifaddrs()Jo-Philipp Wich-3/+16
With point-to-point interfaces, the IFA_ADDRESS netlink attribute contains the peer address while an extra attribute IFA_LOCAL carries the actual local interface address. Both the glibc and uclibc implementations of getifaddrs() handle this case by moving the ifa_addr contents to the broadcast/remote address union and overwriting ifa_addr upon receipt of an IFA_LOCAL attribute. This patch adds the same special treatment logic of IFA_LOCAL to musl's implementation of getifaddrs() in order to align its behaviour with that of uclibc and glibc. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-07-29reimplement if_nameindex and getifaddrs using netlinkTimo Teräs-146/+168
the previous implementations had several deficiencies, the most severe of which was the inability to report unconfigured interfaces or interfaces without ipv4 addresses. among the options discussed for fixing this, using netlink turned out to be the one with the least cost and most additional advantages. other improvements include: if_nameindex now avoids duplicates in the list it produces, but still includes legacy-style interface aliases if any are in use. getifaddrs now reports hardware addresses and includes the scope_id for link-local ipv6 addresses in the resulting address.
2013-12-12include cleanups: remove unused headers and add feature test macrosSzabolcs Nagy-0/+1
2013-11-20fix fd leak (missing close-on-exec) in getifaddrsRich Felker-1/+1
2013-07-09fix missing SOCK_CLOEXEC in various functions that use sockets internallyRich Felker-1/+1
2013-04-09getifaddrs: implement proper ipv6 netmasksrofl0r-2/+11
2013-04-06getifaddrs: remove unused labelrofl0r-1/+0
2013-04-05getifaddrs: use if_nameindex to enumerate interfacesrofl0r-23/+9
2013-04-05getifaddrs: one less indent levelrofl0r-30/+28
2013-04-05getifaddrs: less mallocrofl0r-55/+52
2013-04-05add getifaddrsrofl0r-0/+191
supports ipv4 and ipv6, but not the "extended" usage where usage statistics and other info are assigned to ifa_data members of duplicate entries with AF_PACKET family.