summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorenzo Colitti2013-09-02 10:25:14 -0500
committerLorenzo Colitti2013-09-02 10:25:14 -0500
commitf34861346d5c207912075fba9874090e4c947869 (patch)
tree83cc2d05800af825a00c7eda6c2c7a83b6d9ab01
parent5835ac9e31aea910adb6b9d2de1d63df771df45b (diff)
downloadplatform-system-core-f34861346d5c207912075fba9874090e4c947869.tar.gz
platform-system-core-f34861346d5c207912075fba9874090e4c947869.tar.xz
platform-system-core-f34861346d5c207912075fba9874090e4c947869.zip
Switch back to subsystem "net" for netlink events.
The change to enable address tracking via netlink incorrectly changed the subsystem of rtnetlink events from "net" to "interface". This broke interface add/delete notifications, which come from the kernel with subsystem "net". Switch back to "net" and deal with address tracking via new action codes instead of a new subsystem. Bug: 10433320 Change-Id: Ibf30efb426949dfd02304cc1d9adb1c005a539a6
-rw-r--r--include/sysutils/NetlinkEvent.h2
-rw-r--r--libsysutils/src/NetlinkEvent.cpp11
2 files changed, 9 insertions, 4 deletions
diff --git a/include/sysutils/NetlinkEvent.h b/include/sysutils/NetlinkEvent.h
index 2a734cb89..f3501cf75 100644
--- a/include/sysutils/NetlinkEvent.h
+++ b/include/sysutils/NetlinkEvent.h
@@ -34,6 +34,8 @@ public:
34 const static int NlActionChange; 34 const static int NlActionChange;
35 const static int NlActionLinkDown; 35 const static int NlActionLinkDown;
36 const static int NlActionLinkUp; 36 const static int NlActionLinkUp;
37 const static int NlActionAddressUpdated;
38 const static int NlActionAddressRemoved;
37 39
38 NetlinkEvent(); 40 NetlinkEvent();
39 virtual ~NetlinkEvent(); 41 virtual ~NetlinkEvent();
diff --git a/libsysutils/src/NetlinkEvent.cpp b/libsysutils/src/NetlinkEvent.cpp
index 01bec7772..aae2ae731 100644
--- a/libsysutils/src/NetlinkEvent.cpp
+++ b/libsysutils/src/NetlinkEvent.cpp
@@ -42,6 +42,8 @@ const int NetlinkEvent::NlActionRemove = 2;
42const int NetlinkEvent::NlActionChange = 3; 42const int NetlinkEvent::NlActionChange = 3;
43const int NetlinkEvent::NlActionLinkUp = 4; 43const int NetlinkEvent::NlActionLinkUp = 4;
44const int NetlinkEvent::NlActionLinkDown = 5; 44const int NetlinkEvent::NlActionLinkDown = 5;
45const int NetlinkEvent::NlActionAddressUpdated = 6;
46const int NetlinkEvent::NlActionAddressRemoved = 7;
45 47
46NetlinkEvent::NetlinkEvent() { 48NetlinkEvent::NetlinkEvent() {
47 mAction = NlActionUnknown; 49 mAction = NlActionUnknown;
@@ -131,11 +133,12 @@ bool NetlinkEvent::parseIfAddrMessage(int type, struct ifaddrmsg *ifaddr,
131 } 133 }
132 134
133 // Fill in interface information. 135 // Fill in interface information.
134 mAction = (type == RTM_NEWADDR) ? NlActionAdd : NlActionRemove; 136 mAction = (type == RTM_NEWADDR) ? NlActionAddressUpdated :
135 mSubsystem = strdup("address"); 137 NlActionAddressRemoved;
138 mSubsystem = strdup("net");
136 asprintf(&mParams[0], "ADDRESS=%s/%d", addrstr, 139 asprintf(&mParams[0], "ADDRESS=%s/%d", addrstr,
137 ifaddr->ifa_prefixlen); 140 ifaddr->ifa_prefixlen);
138 asprintf(&mParams[1], "IFACE=%s", ifname); 141 asprintf(&mParams[1], "INTERFACE=%s", ifname);
139 asprintf(&mParams[2], "FLAGS=%u", ifaddr->ifa_flags); 142 asprintf(&mParams[2], "FLAGS=%u", ifaddr->ifa_flags);
140 asprintf(&mParams[3], "SCOPE=%u", ifaddr->ifa_scope); 143 asprintf(&mParams[3], "SCOPE=%u", ifaddr->ifa_scope);
141 } else if (rta->rta_type == IFA_CACHEINFO) { 144 } else if (rta->rta_type == IFA_CACHEINFO) {
@@ -205,7 +208,7 @@ bool NetlinkEvent::parseBinaryNetlinkMessage(char *buffer, int size) {
205 mParams[0] = strdup(buffer); 208 mParams[0] = strdup(buffer);
206 mAction = (ifi->ifi_flags & IFF_LOWER_UP) ? 209 mAction = (ifi->ifi_flags & IFF_LOWER_UP) ?
207 NlActionLinkUp : NlActionLinkDown; 210 NlActionLinkUp : NlActionLinkDown;
208 mSubsystem = strdup("interface"); 211 mSubsystem = strdup("net");
209 break; 212 break;
210 } 213 }
211 214