From 5f4062438b22eea57d7ab04ac7e50829587157af Mon Sep 17 00:00:00 2001 From: Rubin Xu Date: Wed, 16 May 2018 23:35:41 +0100 Subject: [PATCH] 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 3668291d8ece81ce1eccdee150588c2d71cae723) --- libsysutils/src/NetlinkEvent.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libsysutils/src/NetlinkEvent.cpp b/libsysutils/src/NetlinkEvent.cpp index 35a30639b..f0c66ec17 100644 --- a/libsysutils/src/NetlinkEvent.cpp +++ b/libsysutils/src/NetlinkEvent.cpp @@ -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;