netd: Netlink: Use KOBJECT_UEVENT instead of IDLETIMER
The initial idletimer support required using NETLINK_IDLETIMER
netlink socket type.
Instead we now just re-use the existing KOBJECT_UEVENT socket.
Change-Id: I951f2f29182c7cf7f29a054a0eabc88dc25f6d1f
diff --git a/NetlinkHandler.cpp b/NetlinkHandler.cpp
index a4f039c..9a0a844 100644
--- a/NetlinkHandler.cpp
+++ b/NetlinkHandler.cpp
@@ -52,6 +52,8 @@
return;
}
+ ALOGV("subsystem %s", subsys);
+
if (!strcmp(subsys, "net")) {
int action = evt->getAction();
const char *iface = evt->findParam("INTERFACE");
@@ -68,19 +70,19 @@
} else if (action == evt->NlActionLinkDown) {
notifyInterfaceLinkChanged(iface, false);
}
+
} else if (!strcmp(subsys, "qlog")) {
const char *alertName = evt->findParam("ALERT_NAME");
const char *iface = evt->findParam("INTERFACE");
notifyQuotaLimitReached(alertName, iface);
- } else if (!strcmp(subsys, "idletimer")) {
+
+ } else if (!strcmp(subsys, "xt_idletimer")) {
int action = evt->getAction();
const char *iface = evt->findParam("INTERFACE");
+ const char *state = evt->findParam("STATE");
+ if (state)
+ notifyInterfaceActivity(iface, !strcmp("active", state));
- if (action == evt->NlActionIfaceActive) {
- notifyInterfaceActivity(iface, true);
- } else if (action == evt->NlActionIfaceIdle) {
- notifyInterfaceActivity(iface, false);
- }
}
}
@@ -129,8 +131,8 @@
void NetlinkHandler::notifyInterfaceActivity(const char *name, bool isActive) {
char msg[255];
- snprintf(msg, sizeof(msg), "Iface %s %s", isActive ? "active" : "idle", name);
-
+ snprintf(msg, sizeof(msg), "Iface %s %s", name, isActive ? "active" : "idle");
+ ALOGV("Broadcasting interface activity msg: %s", msg);
mNm->getBroadcaster()->sendBroadcast(isActive ? ResponseCode::InterfaceActive
: ResponseCode::InterfaceIdle,
msg, false);