Merge "Switch back to subsystem "net" for netlink events."
This commit is contained in:
commit
71dd5ba464
2 changed files with 9 additions and 4 deletions
|
|
@ -34,6 +34,8 @@ public:
|
||||||
const static int NlActionChange;
|
const static int NlActionChange;
|
||||||
const static int NlActionLinkDown;
|
const static int NlActionLinkDown;
|
||||||
const static int NlActionLinkUp;
|
const static int NlActionLinkUp;
|
||||||
|
const static int NlActionAddressUpdated;
|
||||||
|
const static int NlActionAddressRemoved;
|
||||||
|
|
||||||
NetlinkEvent();
|
NetlinkEvent();
|
||||||
virtual ~NetlinkEvent();
|
virtual ~NetlinkEvent();
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,8 @@ const int NetlinkEvent::NlActionRemove = 2;
|
||||||
const int NetlinkEvent::NlActionChange = 3;
|
const int NetlinkEvent::NlActionChange = 3;
|
||||||
const int NetlinkEvent::NlActionLinkUp = 4;
|
const int NetlinkEvent::NlActionLinkUp = 4;
|
||||||
const int NetlinkEvent::NlActionLinkDown = 5;
|
const int NetlinkEvent::NlActionLinkDown = 5;
|
||||||
|
const int NetlinkEvent::NlActionAddressUpdated = 6;
|
||||||
|
const int NetlinkEvent::NlActionAddressRemoved = 7;
|
||||||
|
|
||||||
NetlinkEvent::NetlinkEvent() {
|
NetlinkEvent::NetlinkEvent() {
|
||||||
mAction = NlActionUnknown;
|
mAction = NlActionUnknown;
|
||||||
|
|
@ -131,11 +133,12 @@ bool NetlinkEvent::parseIfAddrMessage(int type, struct ifaddrmsg *ifaddr,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill in interface information.
|
// Fill in interface information.
|
||||||
mAction = (type == RTM_NEWADDR) ? NlActionAdd : NlActionRemove;
|
mAction = (type == RTM_NEWADDR) ? NlActionAddressUpdated :
|
||||||
mSubsystem = strdup("address");
|
NlActionAddressRemoved;
|
||||||
|
mSubsystem = strdup("net");
|
||||||
asprintf(&mParams[0], "ADDRESS=%s/%d", addrstr,
|
asprintf(&mParams[0], "ADDRESS=%s/%d", addrstr,
|
||||||
ifaddr->ifa_prefixlen);
|
ifaddr->ifa_prefixlen);
|
||||||
asprintf(&mParams[1], "IFACE=%s", ifname);
|
asprintf(&mParams[1], "INTERFACE=%s", ifname);
|
||||||
asprintf(&mParams[2], "FLAGS=%u", ifaddr->ifa_flags);
|
asprintf(&mParams[2], "FLAGS=%u", ifaddr->ifa_flags);
|
||||||
asprintf(&mParams[3], "SCOPE=%u", ifaddr->ifa_scope);
|
asprintf(&mParams[3], "SCOPE=%u", ifaddr->ifa_scope);
|
||||||
} else if (rta->rta_type == IFA_CACHEINFO) {
|
} else if (rta->rta_type == IFA_CACHEINFO) {
|
||||||
|
|
@ -205,7 +208,7 @@ bool NetlinkEvent::parseBinaryNetlinkMessage(char *buffer, int size) {
|
||||||
mParams[0] = strdup(buffer);
|
mParams[0] = strdup(buffer);
|
||||||
mAction = (ifi->ifi_flags & IFF_LOWER_UP) ?
|
mAction = (ifi->ifi_flags & IFF_LOWER_UP) ?
|
||||||
NlActionLinkUp : NlActionLinkDown;
|
NlActionLinkUp : NlActionLinkDown;
|
||||||
mSubsystem = strdup("interface");
|
mSubsystem = strdup("net");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue