aboutsummaryrefslogtreecommitdiff
path: root/src/network/getifaddrs.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Setup stub unit test infrastructureEuAndreh2024-01-051-0/+8
|
* getifaddrs: fix UB via taking address of null pointer union dereferenceAlexey Izbyshev2023-02-281-7/+7
| | | | | | | | getifaddrs computes &ctx->first->ifa even if ctx->first is NULL. While this shouldn't be possible on the success path because the loopback interface is hardcoded into the kernel, this is still possible on the error path (for example, if __rtnetlink_enumerate couldn't create a socket due to exceeding the fd limit).
* properly handle point-to-point interfaces in getifaddrs()Jo-Philipp Wich2015-11-301-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>
* reimplement if_nameindex and getifaddrs using netlinkTimo Teräs2014-07-291-145/+167
| | | | | | | | | | | | | | 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.
* include cleanups: remove unused headers and add feature test macrosSzabolcs Nagy2013-12-121-0/+1
|
* fix fd leak (missing close-on-exec) in getifaddrsRich Felker2013-11-201-1/+1
|
* fix missing SOCK_CLOEXEC in various functions that use sockets internallyRich Felker2013-07-091-1/+1
|
* getifaddrs: implement proper ipv6 netmasksrofl0r2013-04-091-2/+11
|
* getifaddrs: remove unused labelrofl0r2013-04-061-1/+0
|
* getifaddrs: use if_nameindex to enumerate interfacesrofl0r2013-04-051-23/+9
|
* getifaddrs: one less indent levelrofl0r2013-04-051-30/+28
|
* getifaddrs: less mallocrofl0r2013-04-051-55/+52
|
* add getifaddrsrofl0r2013-04-051-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.