summaryrefslogtreecommitdiffstats
path: root/include/sysutils/NetlinkEvent.h
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Sigh, more vendors linking against hidden APIs."Vineeta Srivastava2015-03-201-13/+0
| | | | | | This reverts commit 31837298166e678d8e9c9fba1b30aea5abf1350f. Change-Id: I5c041d7438b64c4c258c414ca9a133075999e1b6
* Sigh, more vendors linking against hidden APIs.Jeff Sharkey2015-03-161-0/+13
| | | | | Bug: 19762346 Change-Id: I6c0823bf69e3f7e854ffea7b5483d09bb7359ff6
* Define enum class for NetlinkEvent actions.Jeff Sharkey2015-03-131-14/+18
| | | | | | | This lets us use it for switch statements, and gives us stronger type safety. Change-Id: Idb3ad7098657a09f13c95dc7070611d35ede66ae
* Extend to receive NFLOG packets.Jeff Sharkey2015-01-151-0/+1
| | | | | | | | | Packets captured and logged by the NFLOG target are unicast, so extend to catch and decode them. To avoid escaping issues, the raw contents are passed around as hex strings. Bug: 18335678 Change-Id: Ib7299500baa00080a1f000f9da843eb527363353
* Support parsing netlink route messages.Lorenzo Colitti2014-06-211-0/+3
| | | | | Bug: 9180552 Change-Id: I4a36d869ac692647fb226d0912285bdf2ffcb1fa
* Improvements to netlink event parsing.Lorenzo Colitti2014-06-211-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Accept that parseNetlinkMessage can only parse one netlink message, because its way of returning output is to modify its member variables (mAction, mParams, etc.). Currently, it loops through all the messages it finds, updating its member variables as it goes along, and always returns true at the end of the buffer. This has the following problems: 1. Since the function always returns true even when no messages were parsed, the caller has no way to know if parsing succeeded, and we get lots of "No subsystem found in netlink event" logs if the buffer did not contain any valid messages we were interested in. 2. If there are multiple messages in the buffer, all but the last message will be silently ignored. 3. If there are multiple messages and previous messages have more parameters than the last one, the resulting event will have a mixture of parameters from multiple messages. Instead of doing all this, change the contract to "parse the first valid message of interest in the buffer and return true, or return false if there were no such messages", and update the code and the comments accordingly. 2. Modify the caller (NetlinkListener) so it doesn't log an error when parseBinaryNetlinkMessage returns false, because this can now simply mean that we weren't interested in that particular message. parseBinaryNetlinkMessage already logs more informative errors. 3. Provide utility functions to check received message lengths and to convert message types to message names. 4. Simplify logging duplicate attributes. 5. Use the appropriate IFLA_xxx macros instead of rolling our own code to parse link state messages. 6. Move all the parsing code out to per-message-type parsing functions to order to simplify parseBinaryNetlinkMessage. Bug: 9180552 Change-Id: I6bbc2f7a104f618674dde2369c1fd5e93ea49430
* Support parsing RDNSS ND options from netlink.Lorenzo Colitti2013-11-011-1/+3
| | | | | | | | | | | | The RDNSS options (RFC 6106) used to configure DNS servers via router advertisements are passed from the kernel to userspace via RTM_NEWNDUSEROPT netlink messages. Add code to NetlinkEvent to parse them. Also fix a compiler warning and a couple of style issues. Bug: 9180552 Change-Id: I6c532c8f0ceef3afdc977a431a036df398013e1a
* Switch back to subsystem "net" for netlink events.Lorenzo Colitti2013-09-031-0/+2
| | | | | | | | | | | | | 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
* Parse IP address changes in NetlinkEvent.Lorenzo Colitti2013-08-141-0/+1
| | | | | | | | | | | | | This adds support for parsing RTM_NEWADDR and RTM_DELADDR netlink messages received on netd's netlink socket and formatting them them so NetlinkHandler can process them. Address changes are notified in subsystem "address". Interface changes, which used to be notified in subsystem "net", are now notified in subsystem "interface" to avoid confusion. Bug: 10232006 Change-Id: I93a50e8de17014e118a42f5cc0eb90a0cbfa73cc
* Revert "libsysutils: NetlinkEvent: add support for interface xt_IDLETIMER ↵JP Abgrall2012-04-261-2/+0
| | | | | | | | | events." This reverts commit 731d831e91d5d9f8b15ca95367977abe35967166. Now that the xt_IDLETIMER uses the KOBJECT_UEVENT netlink, this change is not needed anymore.
* libsysutils: NetlinkEvent: add support for interface xt_IDLETIMER events.Ashish Sharma2012-04-111-0/+2
| | | | | | | xt_IDLETIMER events are used to infer the interface (radio) state based on a inactivity timeout value. Change-Id: I755eb54a048ca1c6ce0c646564d61188d8241851
* Cleanup NetlinkListener and NetlinkEventMike J. Chen2011-06-231-1/+3
| | | | | | | | | | | | | To make it easier to be compatible with older existing code, use default parameters instead of separate functions for setting. Also, reintroduce the const usage that was not in the original changes by Stan. Also fix some indent spacing. Change-Id: Ice9ec7f0d5c4a0673037e2e04a764d88a98f68eb Signed-off-by: Mike J. Chen <mjchen@google.com>
* Revert "Revert "Add NETLINK_ROUTE processing to the netlink client code, so ↵Mike J. Chen2011-06-231-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | that Ethernet"" This reverts commit 1d504eeb50d980c222572629383bb76315f32ca0. Conflicts: libsysutils/src/NetlinkEvent.cpp Bring back the changes from Stan Chesnutt regarding adding NETLINK_ROUTE processing. The original commit message description was: Add NETLINK_ROUTE processing to the netlink client code, so that Ethernet physical-layer up/down events can be tracked. Upper layers will use these events to enable/disable Ethernet connectivity. The original change was reverted due to an incompatiblity with Motorola's ril.so binary. I'll submit a patch to workaround that incompatiblity separately. Change-Id: I4e97ac98833b10543e654c63ecae3b9b8c7db44f Signed-off-by: Mike J. Chen <mjchen@google.com>
* Revert "Add NETLINK_ROUTE processing to the netlink client code, so that ↵Wink Saville2011-01-091-7/+1
| | | | | | Ethernet" This reverts commit 8418ac8ba59bd140b5a2432c99501cc79debdefc.
* Add NETLINK_ROUTE processing to the netlink client code, so that EthernetStan Chesnutt2010-12-261-1/+7
| | | | | | | physical-layer up/down events can be tracked. Upper layers will use these events to enable/disable Ethernet connectivity. Change-Id: If07c30c4d79f26cf94eb5597be651ebbf9d072c6
* sysutils: Add dump() to NetlinkEventSan Mehat2009-12-241-0/+2
| | | | Signed-off-by: San Mehat <san@google.com>
* libsysutils: New C++ system convenience librarySan Mehat2009-05-061-0/+44
This library contains re-usable classes for common system level daemons. Initial consumers of this library are 'nexus' and 'vold2' Signed-off-by: San Mehat <san@google.com>