summaryrefslogtreecommitdiffstats
path: root/include/sysutils
Commit message (Collapse)AuthorAgeFilesLines
* Exporting C++ headers from system/coreVijay Venkatraman2017-01-2411-766/+1
| | | | | | | | | | | | | | | | | | | | | | Moved headers from include/libutils and include/libsysutils to libutils/include and libsysutils/include respectively, so they can be exported via these libs. They needed to be moved since Soong does not allow export from external folder. Added symlink from old locations. They are needed since Soong includes system/core/include by default. Once all modules are cleaned up to explicitly add the required libs, the symlinks will be removed. Moved headers of libutils to libutils_headers. They should be used by modules for header-only inlines. Added libutils_headers as dependency of libutils. Split of C++ headers into those that have no dependency and those that have dependency on libutils.so will be handled in a later CL. Test: Add above libs to shared lib of local module Change-Id: I122db72056b26b1f39bad1d9a0c2a1c5efda3550
* Fix vold vulnerability in FrameworkListener am: 470484d2a2 am: e9e046df6c ↵Connor O'Brien2016-08-191-0/+1
|\ | | | | | | | | | | | | | | am: 109024f74a am: b906ad88b9 am: 2fadbb93a4 am: e04054d9bb am: 9745b11db1 Change-Id: I61f685976803f51db9ba85729554fc14efaa4b2c
| * Fix vold vulnerability in FrameworkListener am: 470484d2a2 am: e9e046df6c ↵Connor O'Brien2016-08-191-0/+1
| |\ | | | | | | | | | | | | | | | | | | | | | am: 109024f74a am: b906ad88b9 am: 2fadbb93a4 am: e04054d9bb Change-Id: Ia5f46e5b9622946ca0e44fbe7399729807d2d08a
| | * Fix vold vulnerability in FrameworkListener am: 470484d2a2 am: e9e046df6cConnor O'Brien2016-08-191-0/+1
| | |\ | | | | | | | | | | | | | | | | | | | | am: 109024f74a Change-Id: Ia6e8dca36bc28d442a6e374ecf033b79176f4b93
| | | * Fix vold vulnerability in FrameworkListener am: 470484d2a2Connor O'Brien2016-08-191-0/+1
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | am: e9e046df6c Change-Id: I8f2452782817ddf03051af08e70ba9d4c4fa578a
| | | | * Fix vold vulnerability in FrameworkListenerConnor O'Brien2016-08-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Modify FrameworkListener to ignore commands that exceed the maximum buffer length and send an error message. Bug: 29831647 Change-Id: I9e57d1648d55af2ca0191bb47868e375ecc26950 Signed-off-by: Connor O'Brien <connoro@google.com> (cherry picked from commit baa126dc158a40bc83c17c6d428c760e5b93fb1a)
| | | | * 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 "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-152-0/+2
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | logd: libsysutils: logd startup outside init environmentMark Salyzyn2014-04-171-0/+1
| | | | | | | | | | | | Change-Id: I3426b6c3eebdd0c8258e966dcaaaa2825d7a23d1
* | | set /proc/sys/net/unix/max_dgram_qlen to large valueMark Salyzyn2014-03-031-0/+1
|/ / | | | | | | | | | | | | | | - init: set /proc/sys/net/unix/max_dgram_qlen to 300 - libsysutils: Add listen backlog argument to startListener - logd: set listen backlog to 300 Change-Id: Id6d37d6c937ba2d221e76258d89c9516619caeec
* | libsysutils: SocketListener export releaseMark Salyzyn2014-01-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | * Foreground thread (legacy) closes connection by reporting false return value for onDataAvailable. * Background thread can choose instead to close the connection asynchronously by calling release, must return true for the onDataAvailable method. (cherry picked from commit d7ad4e409eaac53db3a9789060097b712850b337) Change-Id: I70ab37d5c22b02804aa3b4dfb26cc9b75291f8b6
* | libsysutils: Add iovec/runOnEachSocketMark Salyzyn2014-01-273-13/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SocketClient: * Replace sendDataLocked with sendDataLockedv which takes an iovec. * Add a version of sendData, sendDatav, which takes an iovec. * do not preserve iovec content through sendDatav SocketListener: * Add runOnEachSocket, which allows to to specify a SocketClientCommand to run individually on each socket. This allows you to do broadcast-like actions customized for each individual socket. * Client safe list reference counting for sendBroadcast & runOnEach Socket (cherry picked from commit a6e965578e44f8ae5f98de822ba5decec381d5fc) Signed-off-by: Nick Kralevich <nnk@google.com> Signed-off-by: Mark Salyzyn <salyzyn@google.com> Change-Id: I716f89c01b4cb7af900045c7e41fac1492defb06
* | Merge "Force alignment of data buffer used to process netlink messages"Elliott Hughes2013-12-141-1/+1
|\ \
| * | Force alignment of data buffer used to process netlink messagesChris Dearman2013-10-301-1/+1
| |/ | | | | | | | | | | | | This avoids any overhead associated with accessing unaligned data while processing netlink messages. Change-Id: I1ea13051816ef46b6627594121d98cda130ac609
* | Support parsing RDNSS ND options from netlink.Lorenzo Colitti2013-11-201-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. [Cherry-pick of b185e90dcc6ac111bff908edcc6d89fd6b37dc11] Bug: 9180552 Change-Id: I6c532c8f0ceef3afdc977a431a036df398013e1a
* | Switch back to subsystem "net" for netlink events.Lorenzo Colitti2013-11-201-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. [Cherry-pick of f34861346d5c207912075fba9874090e4c947869] Bug: 10433320 Change-Id: Ibf30efb426949dfd02304cc1d9adb1c005a539a6
* | Parse IP address changes in NetlinkEvent.Lorenzo Colitti2013-11-201-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. [Cherry-pick of a4b4e9ad8e35ab424e61d76ebe6654445fc61e63] Bug: 10232006 Change-Id: I93a50e8de17014e118a42f5cc0eb90a0cbfa73cc
* libsysutils: Increase command buffersize and command argsJosef Kindberg2012-11-121-1/+2
| | | | | | | Needed to support tethering of multiple remote Bluetooth devices. Change-Id: I9f736affd83226e8b2fa4f0faacd3654175dd8c9 Signed-off-by: Patrik Ryd <patrik.ryd@stericsson.com>
* 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.
* Add ability to quote responses as needed.Robert Greenwalt2012-04-201-0/+3
| | | | | | | | It's up to the protocol to know when quotes are required. In the future the response should probably all be binary blobs with lengths. bug:6353048 Change-Id: I3f9b48ab0f4e6746d75cdc9c0c84d33f38f63661
* 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
* Fix pointer arith.Robert Greenwalt2012-03-091-6/+4
| | | | | | | | | Sending 3digit code, null, binary-length and data. Current code sends 3digit code, space, null, binary-length, binary-data. The space should not be sent. Change-Id: I1df00a3e70805b39b6105966c7f3c613461a6858
* Add a utility function to send a code + binary msgSelim Gurun2012-03-071-1/+18
| | | | | | | | | Add a utility function to SocketClient to send a c-string code prepended to a binary message. This is necessary to be able to send a binary message while keeping compatible with underlying text-based protocol. Change-Id: Ifc6562003a687577d7deb50260533a5147ae4f97
* Merge "New NativeDaemonConnector protocol adds a seqnum."Robert Greenwalt2012-03-063-5/+27
|\
| * New NativeDaemonConnector protocol adds a seqnum.Robert Greenwalt2012-03-053-5/+27
| | | | | | | | | | | | | | | | | | | | Allows for one socket to be multiplexed for multiple requests. Doesn't use command sequence numbers for broadcasts - would make no sense. Doesn't alter current default behavior so OEM's using these classes won't notice a difference. bug:5864209 Change-Id: Ie3b19c4f81eea868569229a365c8cb7de249c2dd
* | remove dependency on utils/List.hMathias Agopian2012-03-054-6/+340
|/ | | | Change-Id: I9a1e996be645520d1d5a056337303a6e5ed646e9
* Revert "New NativeDaemonConnector protocol adds a seqnum."Guang Zhu2012-02-073-14/+3
| | | | | | | | Reverting because it seems to break `adb reboot` This reverts commit dc58e73071aa829a5038caf37211f6b3e2d7b275. Change-Id: Ib8cc4379254694398cbb7f3e7a64c20e1ed8c1ba
* New NativeDaemonConnector protocol adds a seqnum.Robert Greenwalt2012-02-073-3/+14
| | | | | | | Allows for one socket to be multiplexed for multiple requests. bug:5864209 Change-Id: I934c88da25d95e093371f455442bdf2f0ed7a4f4
* Fix SocketListener socket leak issue.Xianzhu Wang2011-09-291-2/+3
| | | | | | | | | | | | The problem was: if a socket is shared between SocketListener and another thread, only if the last reference is removed by SocketListener can the socket be closed, otherwise the socket will leak. This sometimes happens in netd's dnsproxyd. This change let the SocketClient own the socket and close the socket when the SocketClient is destructed. Change-Id: I2865fbfe9ee4d8b3e43d7e02919dbb2d261f70de
* Workaround Motorola ril.so incompatiblity with Netlink changesMike J. Chen2011-06-231-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | To workaround a binary incompatiblity with Motorola's ril.so, I had to temporarily provide the old constructor for NetlinkListener as well as a new contructor that takes an additional format argument. There's still a slight chance of a problem because the size of the NetlinkListener has changed with the addition of the mFormat member, but so far I've not seen any obvious problem with that incompatiblity. Another way we could have worked around the incompatiblity is to have netd (the main user of the new format argument to NetlinkListener) keep track of the format itself in it's NetlinkHandler (derived from NetlinkListener) and supply it's own version of onDataAvailable() that's almost 100% identical to NetlinkListener's except for the decode() call. That would allow us not to modify NetlinkListener at all. Worth considering but I think it's more properly divided right now and we just have to make Motorola fix their code (and ideally not use our private APIs). This change should be reverted when Motorola's has fixed their ril to either not use our private APIs or to use our updated ones. Change-Id: I255cca6908444e56cbbbed7eef1fa0cf1d8f0918 Signed-off-by: Mike J. Chen <mjchen@google.com>
* Cleanup NetlinkListener and NetlinkEventMike J. Chen2011-06-232-2/+5
| | | | | | | | | | | | | 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-232-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix potential race introduced in Icd7f5f03Brad Fitzpatrick2011-03-171-1/+1
| | | | | | | | | | | | Digit wrote: "You probably don't want to close the socket here without updating c->socket as well. Otherwise, another thread holding a handle to the client after the c->decRef() could end up sending a message to a different socket, if the file descriptor index is reused by another client in the meantime." Change-Id: Icdefb5ffc0c7607325d7db761e1f04e5d868bfb7
* SocketClient: add optional reference countingBrad Fitzpatrick2011-03-171-0/+11
| | | | | | | Needed to fix a race in netd. Bug: 3438459 Change-Id: Icd7f5f035510235f733a25c0621479d3e644b152
* libsysutils: Fix race condition in SocketListener thread.David 'Digit' Turner2011-01-191-1/+1
| | | | | | | | + Handle EINTR in accept(), write() and select() + Fix a memory leak when deleting the mClients list + Fix typo in SocketListener.h Change-Id: Ie68bb3e2dbefe0dfdaa22a5cd06a42dbc4c0f8aa
* Let SocketClient users write binary data to clients.Brad Fitzpatrick2010-10-271-0/+4
| | | | | | | | | | This is a dependency for the DNS proxy CLs. This CL also adds a new socket for the netd process to inherit which is owned by the inet group. (so only apps with the INTERNET permission can use the DNS proxy...) Change-Id: Ic3475c697913ba85805b4e49801b65e7a1d59289
* Fetch peer credentials for local socketsKenny Root2010-09-141-0/+13
| | | | | | | Fetch the PID, UID, and GID of the remote side of a local socket connection in case any users of this library class want to check it. Change-Id: Ia3230e6bc68ab6f93160df9f5996d2bf744b872c
* sysutils: Increase number of command arguments to 16Dmitry Shmidt2010-03-091-1/+1
| | | | | Change-Id: I0bba579634b334d24645c2af55ab3fab6da03fc6 Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
* sysutils: Add dump() to NetlinkEventSan Mehat2009-12-241-0/+2
| | | | Signed-off-by: San Mehat <san@google.com>
* merge from open-source masterJean-Baptiste Queru2009-10-141-0/+2
|\
| * libsysutils: Fix some bugs in NetlinkListener and NetlinkEventSan Mehat2009-10-101-0/+2
| | | | | | | | Signed-off-by: San Mehat <san@android.com>
* | nexus: Rollup update for nexusSan Mehat2009-07-101-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nexus: Change field separator from : to ' ' Signed-off-by: San Mehat <san@google.com> nexus: Add some prototypes for stuff to come Signed-off-by: San Mehat <san@google.com> nexus: Add some TODOs Signed-off-by: San Mehat <san@google.com> libsysutils: Put a proper token parser into the FrameworkListener which supports minimal \ escapes and quotes Signed-off-by: San Mehat <san@google.com> nexus: Fix a lot of bugs Signed-off-by: San Mehat <san@google.com> libsysutils: Remove some debugging Signed-off-by: San Mehat <san@google.com> nexus: Send broadcasts for supplicant state changes Signed-off-by: San Mehat <san@google.com> nexus: Plumb DHCP listener state changes to NetworkManager Signed-off-by: San Mehat <san@google.com> nexus: Make the SupplicantState strings more parsable Signed-off-by: San Mehat <san@google.com> nexus: Broadcast a message when dhcp state changes. Signed-off-by: San Mehat <san@google.com> nexus: Add a few new response codes Signed-off-by: San Mehat <san@google.com> nexus: Rename ErrorCode -> ResponseCode Signed-off-by: San Mehat <san@google.com> nexus: Add DHCP event broadcasting. Also adds the framework for tracking supplicant 'searching-for-AP' state Signed-off-by: San Mehat <san@google.com> nexus: REmove WifiScanner Signed-off-by: San Mehat <san@google.com> nexus: Change the way scanning works. scanmode can now be selected independantly of triggering a scan. Also adds rxfilter support Signed-off-by: San Mehat <san@google.com> nexus: Add support for configuring bluetooth coexistence scanning and modes Signed-off-by: San Mehat <san@google.com> nexus: use case insensitive match for property names Signed-off-by: San Mehat <san@google.com> nexus: Rollup of a bunch of stuff: - 'list' command now takes an argument to match against - InterfaceConfig has been moved into the Controller base (for now) - DhcpClient now has some rudimentry locking - process 'ADDRINFO' messages from dhcpcd - Drop tertiary dns Signed-off-by: San Mehat <san@google.com> nexus: Clean up some of the supplicant variable parsing and add 'wifi.current' Signed-off-by: San Mehat <san@google.com> nexus: Add driver-stop/start, initial suspend support Signed-off-by: San Mehat <san@google.com> nexus: Add Controller suspend/resume callbacks, as well as locking Signed-off-by: San Mehat <san@google.com> nexus: Make ARP probing configurable for DhcpClient Signed-off-by: San Mehat <san@google.com> nexus: Add linkspeed / rssi retrieval Signed-off-by: San Mehat <san@google.com> nexus: Add WifiStatusPoller to track RSSI/linkspeed when associated Signed-off-by: San Mehat <san@google.com> nexus: Disable some debugging and add 'wifi.netcount' property Signed-off-by: San Mehat <san@google.com> nexus: Replace the hackish property system with something more flexible with namespaces Signed-off-by: San Mehat <san@google.com> libsysutils: Fix a few bugs in SocketListener Signed-off-by: San Mehat <san@google.com> nexus: PropertyManager: Add array support Signed-off-by: San Mehat <san@google.com> nexus: Clean up properties Signed-off-by: San Mehat <san@google.com> nexus: WifiController: Change name of 'CurrentNetwork' property Signed-off-by: San Mehat <san@google.com>
* libsysutils: Move to a null terminated string protocol using space as a ↵San Mehat2009-06-152-2/+4
| | | | | | | | field separator. Also removes some debugging Signed-off-by: San Mehat <san@google.com>
* libsysutils: const correctness fixes + remove some debuggingSan Mehat2009-05-203-6/+6
| | | | Signed-off-by: San Mehat <san@google.com>