OSDN Git Service

Implement if_nameindex(3)/if_freenameindex(3).
authorElliott Hughes <enh@google.com>
Sat, 16 Jan 2016 05:02:56 +0000 (21:02 -0800)
committerElliott Hughes <enh@google.com>
Mon, 18 Jan 2016 20:07:38 +0000 (12:07 -0800)
commited57b98758176f0cccdec16cbed524e444039fe7
tree75089e67cfcbff961a859ac13409b1f19137cfc6
parent68d0150221eb505a576f6ad5ca1f367b4ce547a0
Implement if_nameindex(3)/if_freenameindex(3).

This is just a subset of the recently-implemented getifaddrs(3), though if
we want to handle interfaces (such as "rmnet_*") that don't have an address,
we need to either expose ifaddrs_storage and keep track of which interfaces
we've already seen (which is pretty messy), or refactor the netlink code so
we can reuse it and just extract the information we need for if_nameindex(3).
This patch goes the latter route.

Also clean up if_nametoindex(3) and if_indextoname(3).

Change-Id: I5ffc5df0bab62286cdda2e7af06f032c767119a8
19 files changed:
libc/Android.mk
libc/bionic/bionic_netlink.cpp [new file with mode: 0644]
libc/bionic/bionic_netlink.h [moved from libc/bionic/if_nametoindex.c with 64% similarity]
libc/bionic/if_indextoname.c [deleted file]
libc/bionic/ifaddrs.cpp
libc/bionic/net_if.cpp [new file with mode: 0644]
libc/include/net/if.h
libc/libc.arm.brillo.map
libc/libc.arm.map
libc/libc.arm64.map
libc/libc.map.txt
libc/libc.mips.brillo.map
libc/libc.mips.map
libc/libc.mips64.map
libc/libc.x86.brillo.map
libc/libc.x86.map
libc/libc.x86_64.map
tests/ifaddrs_test.cpp
tests/net_if_test.cpp