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
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 baa126dc15)
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
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
- 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
* 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 d7ad4e409e)
Change-Id: I70ab37d5c22b02804aa3b4dfb26cc9b75291f8b6
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 a6e965578e)
Signed-off-by: Nick Kralevich <nnk@google.com>
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Change-Id: I716f89c01b4cb7af900045c7e41fac1492defb06
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 b185e90dcc]
Bug: 9180552
Change-Id: I6c532c8f0ceef3afdc977a431a036df398013e1a
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 f34861346d]
Bug: 10433320
Change-Id: Ibf30efb426949dfd02304cc1d9adb1c005a539a6
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 a4b4e9ad8e]
Bug: 10232006
Change-Id: I93a50e8de17014e118a42f5cc0eb90a0cbfa73cc
This avoids any overhead associated with accessing unaligned data
while processing netlink messages.
Change-Id: I1ea13051816ef46b6627594121d98cda130ac609
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
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
Needed to support tethering of multiple remote Bluetooth devices.
Change-Id: I9f736affd83226e8b2fa4f0faacd3654175dd8c9
Signed-off-by: Patrik Ryd <patrik.ryd@stericsson.com>
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
xt_IDLETIMER events are used to infer the interface (radio) state
based on a inactivity timeout value.
Change-Id: I755eb54a048ca1c6ce0c646564d61188d8241851
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 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
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
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
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>
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>
This reverts commit 1d504eeb50.
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>
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
+ Handle EINTR in accept(), write() and select()
+ Fix a memory leak when deleting the mClients list
+ Fix typo in SocketListener.h
Change-Id: Ie68bb3e2dbefe0dfdaa22a5cd06a42dbc4c0f8aa
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 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
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>