summaryrefslogtreecommitdiffstats
path: root/libsysutils
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2016-02-16 21:42:16 +0900
committerLorenzo Colitti <lorenzo@google.com>2016-02-16 23:12:26 +0900
commitef6454d3d3e54730de1a5b751d6c7b286d5a8575 (patch)
treec8a296b02aa26db77f31a558707543cf1b833367 /libsysutils
parent9136922045978385be99b0171c2c873aa6c2e186 (diff)
downloadsystem_core-ef6454d3d3e54730de1a5b751d6c7b286d5a8575.tar.gz
system_core-ef6454d3d3e54730de1a5b751d6c7b286d5a8575.tar.bz2
system_core-ef6454d3d3e54730de1a5b751d6c7b286d5a8575.zip
Tolerate RTM_DELADDR messages from deleted interfaces.
When an interface is deleted (which can happen, for example, to the tun interfaces used for VPN and 464xlat), the kernel sends RTM_DELADDR messages for all its IP addresses. Currently we ignore these because we cannot fetch the interface name. Instead, pass them up with an empty interface name so that NetlinkHandler can do something useful for them, such as destroy connections on the IP addresses that are being deleted. Bug: 26976388 Change-Id: I2ced7e389228f9d665d0a87d97bd3452c8c0c98b
Diffstat (limited to 'libsysutils')
-rw-r--r--libsysutils/src/NetlinkEvent.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/libsysutils/src/NetlinkEvent.cpp b/libsysutils/src/NetlinkEvent.cpp
index 23dcd6273..739fad7d0 100644
--- a/libsysutils/src/NetlinkEvent.cpp
+++ b/libsysutils/src/NetlinkEvent.cpp
@@ -159,7 +159,7 @@ bool NetlinkEvent::parseIfAddrMessage(const struct nlmsghdr *nh) {
struct ifaddrmsg *ifaddr = (struct ifaddrmsg *) NLMSG_DATA(nh);
struct ifa_cacheinfo *cacheinfo = NULL;
char addrstr[INET6_ADDRSTRLEN] = "";
- char ifname[IFNAMSIZ];
+ char ifname[IFNAMSIZ] = "";
if (!checkRtNetlinkLength(nh, sizeof(*ifaddr)))
return false;
@@ -207,8 +207,7 @@ bool NetlinkEvent::parseIfAddrMessage(const struct nlmsghdr *nh) {
// Find the interface name.
if (!if_indextoname(ifaddr->ifa_index, ifname)) {
- SLOGE("Unknown ifindex %d in %s", ifaddr->ifa_index, msgtype);
- return false;
+ SLOGD("Unknown ifindex %d in %s", ifaddr->ifa_index, msgtype);
}
} else if (rta->rta_type == IFA_CACHEINFO) {
@@ -235,8 +234,7 @@ bool NetlinkEvent::parseIfAddrMessage(const struct nlmsghdr *nh) {
mAction = (type == RTM_NEWADDR) ? Action::kAddressUpdated :
Action::kAddressRemoved;
mSubsystem = strdup("net");
- asprintf(&mParams[0], "ADDRESS=%s/%d", addrstr,
- ifaddr->ifa_prefixlen);
+ asprintf(&mParams[0], "ADDRESS=%s/%d", addrstr, ifaddr->ifa_prefixlen);
asprintf(&mParams[1], "INTERFACE=%s", ifname);
asprintf(&mParams[2], "FLAGS=%u", ifaddr->ifa_flags);
asprintf(&mParams[3], "SCOPE=%u", ifaddr->ifa_scope);