Commit graph

31 commits

Author SHA1 Message Date
Josef Kindberg
6d358ae44c libsysutils: Increase command buffersize and command args
Needed to support tethering of multiple remote Bluetooth devices.

Change-Id: I9f736affd83226e8b2fa4f0faacd3654175dd8c9
Signed-off-by: Patrik Ryd <patrik.ryd@stericsson.com>
2012-11-12 14:40:21 +01:00
JP Abgrall
b982bce73b Revert "libsysutils: NetlinkEvent: add support for interface xt_IDLETIMER events."
This reverts commit 731d831e91.

Now that the xt_IDLETIMER uses the KOBJECT_UEVENT netlink, this
change is not needed anymore.
2012-04-26 23:52:58 -07:00
Robert Greenwalt
594947793c Add ability to quote responses as needed.
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
2012-04-20 17:41:42 -07:00
Ashish Sharma
731d831e91 libsysutils: NetlinkEvent: add support for interface xt_IDLETIMER events.
xt_IDLETIMER events are used to infer the interface (radio) state
based on a inactivity timeout value.

Change-Id: I755eb54a048ca1c6ce0c646564d61188d8241851
2012-04-11 17:24:46 -07:00
Robert Greenwalt
7599bfcf13 Fix pointer arith.
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
2012-03-09 11:55:51 -08:00
Selim Gurun
7bf4c45f84 Add a utility function to send a code + binary msg
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
2012-03-07 16:19:52 -08:00
Robert Greenwalt
78f6bcf853 Merge "New NativeDaemonConnector protocol adds a seqnum." 2012-03-06 11:30:13 -08:00
Mathias Agopian
b7286aa02e remove dependency on utils/List.h
Change-Id: I9a1e996be645520d1d5a056337303a6e5ed646e9
2012-03-05 17:08:19 -08:00
Robert Greenwalt
8702bb17f4 New NativeDaemonConnector protocol adds a seqnum.
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
2012-03-05 11:44:43 -08:00
Guang Zhu
a8185a622e Revert "New NativeDaemonConnector protocol adds a seqnum."
Reverting because it seems to break `adb reboot`

This reverts commit dc58e73071.

Change-Id: Ib8cc4379254694398cbb7f3e7a64c20e1ed8c1ba
2012-02-07 19:26:54 -08:00
Robert Greenwalt
dc58e73071 New NativeDaemonConnector protocol adds a seqnum.
Allows for one socket to be multiplexed for multiple requests.
bug:5864209

Change-Id: I934c88da25d95e093371f455442bdf2f0ed7a4f4
2012-02-07 16:00:07 -08:00
Xianzhu Wang
4520246d35 Fix SocketListener socket leak issue.
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
2011-09-29 13:42:32 +08:00
Mike J. Chen
2a56688da9 Workaround Motorola ril.so incompatiblity with Netlink changes
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>
2011-06-23 18:59:45 -07:00
Mike J. Chen
17260b1468 Cleanup NetlinkListener and NetlinkEvent
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>
2011-06-23 18:59:45 -07:00
Mike J. Chen
ec16b9d47c Revert "Revert "Add NETLINK_ROUTE processing to the netlink client code, so that Ethernet""
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>
2011-06-23 18:59:45 -07:00
Brad Fitzpatrick
4be4e69f01 Fix potential race introduced in Icd7f5f03
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
2011-03-17 17:14:46 -07:00
Brad Fitzpatrick
648ebad883 SocketClient: add optional reference counting
Needed to fix a race in netd.

Bug: 3438459
Change-Id: Icd7f5f035510235f733a25c0621479d3e644b152
2011-03-17 15:50:02 -07:00
David 'Digit' Turner
cf9e1003ce libsysutils: Fix race condition in SocketListener thread.
+ Handle EINTR in accept(), write() and select()
+ Fix a memory leak when deleting the mClients list
+ Fix typo in SocketListener.h

Change-Id: Ie68bb3e2dbefe0dfdaa22a5cd06a42dbc4c0f8aa
2011-01-19 02:18:40 +01:00
Brad Fitzpatrick
8c5669f9f9 Let SocketClient users write binary data to clients.
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
2010-10-27 10:27:34 -07:00
Kenny Root
30abb7234d Fetch peer credentials for local sockets
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
2010-09-14 14:35:10 -07:00
Dmitry Shmidt
1159d7f800 sysutils: Increase number of command arguments to 16
Change-Id: I0bba579634b334d24645c2af55ab3fab6da03fc6
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2010-03-09 10:46:29 -08:00
San Mehat
d674413ff4 sysutils: Add dump() to NetlinkEvent
Signed-off-by: San Mehat <san@google.com>
2009-12-24 07:20:36 -08:00
Jean-Baptiste Queru
b029e92428 merge from open-source master 2009-10-14 08:19:24 -07:00
San Mehat
ebfe3db361 libsysutils: Fix some bugs in NetlinkListener and NetlinkEvent
Signed-off-by: San Mehat <san@android.com>
2009-10-10 17:39:10 -07:00
San Mehat
c4a895b709 nexus: Rollup update for nexus
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>
2009-07-10 14:23:51 -07:00
San Mehat
c73a3a5771 libsysutils: Move to a null terminated string protocol using space as a field separator.
Also removes some debugging

Signed-off-by: San Mehat <san@google.com>
2009-06-15 14:06:03 -07:00
San Mehat
db01754579 libsysutils: const correctness fixes + remove some debugging
Signed-off-by: San Mehat <san@google.com>
2009-05-20 17:16:05 -07:00
San Mehat
c41d1c8074 libsysutils: Introduce 'ServiceManager', for starting/stopping init services
Signed-off-by: San Mehat <san@google.com>
2009-05-15 10:40:23 -07:00
San Mehat
d768066ef5 libsysutils: Tweak SocketListener and friends
Signed-off-by: San Mehat <san@google.com>
2009-05-12 14:02:32 -07:00
San Mehat
fa644ffe94 libsysutils: Add multiple client support and fix some bugs 2009-05-10 09:26:42 -07:00
San Mehat
168415b822 libsysutils: New C++ system convenience library
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>
2009-05-06 15:12:02 -07:00