Parse IfIndex for Netlink RTM_NEWADDR / RTM_DELADDR event

Bug: 64692591
Test: cts-tradefed run commandAndExit cts-dev -m CtsHostsideNetworkTests -t com.android.cts.net.HostsideVpnTests
Change-Id: Icb2ae1264f0d2fcd285b04edd27641175dd2646f
Merged-In: Icb2ae1264f0d2fcd285b04edd27641175dd2646f
(cherry picked from commit 3668291d8e)
This commit is contained in:
Rubin Xu 2018-05-16 23:35:41 +01:00
parent 51f0f7e791
commit 5f4062438b

View file

@ -239,12 +239,13 @@ bool NetlinkEvent::parseIfAddrMessage(const struct nlmsghdr *nh) {
asprintf(&mParams[1], "INTERFACE=%s", ifname);
asprintf(&mParams[2], "FLAGS=%u", ifaddr->ifa_flags);
asprintf(&mParams[3], "SCOPE=%u", ifaddr->ifa_scope);
asprintf(&mParams[4], "IFINDEX=%u", ifaddr->ifa_index);
if (cacheinfo) {
asprintf(&mParams[4], "PREFERRED=%u", cacheinfo->ifa_prefered);
asprintf(&mParams[5], "VALID=%u", cacheinfo->ifa_valid);
asprintf(&mParams[6], "CSTAMP=%u", cacheinfo->cstamp);
asprintf(&mParams[7], "TSTAMP=%u", cacheinfo->tstamp);
asprintf(&mParams[5], "PREFERRED=%u", cacheinfo->ifa_prefered);
asprintf(&mParams[6], "VALID=%u", cacheinfo->ifa_valid);
asprintf(&mParams[7], "CSTAMP=%u", cacheinfo->cstamp);
asprintf(&mParams[8], "TSTAMP=%u", cacheinfo->tstamp);
}
return true;