121 Commits

Author SHA1 Message Date
Hugo Benichi
67530d6585 Add volatile qualifier to boolean variable
DHCP receive thread was spinning on a boolean variable to know when to
stop. That variable had no volatile qualifier, potentially preventing
the thread from stopping at all. Without a volatile qualifier, the reads
and writes in halt() could be reordered in such a way that the running
thread is interrupted before mStopped is set t true. Also, the optimizer
could decide to hoist mStopped in a register inside the running thread,
preventing the loop from exiting.

Change-Id: I5b30c1247808114f0e5b46e230978ee7ea18ab8e
2016-04-13 11:16:51 +09:00
Lorenzo Colitti
059e2bb376 More APF debuggability.
1. Decode RDNSS options.
2. Keep track of how many times the program was updated.
3. Remove the leading / from the IPv4 address.

Change-Id: Ida0518a94ea7d952c82c8181b09044eff907b714
2016-04-08 23:09:25 +09:00
Lorenzo Colitti
19e84f7b75 Merge changes Ibb63f6b4,Ib64559a5 into nyc-dev
* changes:
  Clean up netd state when tethering fails.
  Clear LinkProperties on interface removed.
2016-04-05 13:35:09 +00:00
Lorenzo Colitti
a3d5948c37 Clear LinkProperties on interface removed.
When an interface is removed, all netlink events for that
interface are lost, because netd will no longer be able to
resolve the ifindex in the netlink event to an interface name,
and it only communicates to the framework events that include an
interface name.

This can cause us to end up with stale IP addresses if, for
example, wlan0 is removed because we switch wifi back from AP
mode to STA mode when exiting tethering. The presence of stale
IPv4 addresses can in turn lead us to miss a provisioning
notification because we already think we have an IPv4 address.

Change-Id: Ib64559a5a4fa261f483760b69fa7996314e7cc17
2016-04-05 20:28:57 +09:00
Erik Kline
5db3f10e9a Merge "Move from on464XlatChange() to setNeighborDiscoveryOffload()" into nyc-dev 2016-04-05 03:55:42 +00:00
Lorenzo Colitti
cd404a2fc3 Merge "Add APF code to drop ARP IPv4 requests not for us" into nyc-dev 2016-04-05 02:46:39 +00:00
Erik Kline
5c2e9224a7 Move from on464XlatChange() to setNeighborDiscoveryOffload()
Bug: 26238390
Change-Id: I0f971fbf04e44cb61017653f944d71e1f6d128b4
2016-04-05 11:39:14 +09:00
Paul Jensen
a8458c0363 Add APF code to drop ARP IPv4 requests not for us
The WiFi chipset's ARP offload may handle this when the
AP is asleep, but when the AP is awake and the chipset is in
wake-on-wifi mode use APF to filter these packets.

Bug: 27477163
Change-Id: I180c08bd7301a1af9c3f728ff3cba06ca4e1022d
2016-04-05 01:42:34 +00:00
Paul Jensen
10d70bff61 Merge "Fix potential ApfFilter bugs by careful ByteBuffer use" into nyc-dev 2016-04-05 00:23:37 +00:00
Paul Jensen
10594942c6 Merge "Plumb WiFi multicast filter through to ApfFilter" into nyc-dev 2016-04-05 00:22:22 +00:00
Lorenzo Colitti
77fdf23d6f Honour the DHCP MTU option.
Bug: 25590369
Bug: 27719279
Change-Id: I473b5ec9c13f0d74e1ddd55e9d4abcff374a83ef
2016-03-31 23:51:32 +09:00
Paul Jensen
2e074db972 Plumb WiFi multicast filter through to ApfFilter
Use APF to implement WifiManager.MulticastLock, if APF isn't available
fallback to the present behavior of using DRIVER RXFILTER. Since we
don't know whether APF is supported until we're connected, postpone
enabling/disabling the multicast filter until then; this should be
fine as there isn't much need to filter packets if there aren't any
packets going by since we're not connected.

Bug: 26238573
Change-Id: I862c053f1c8c3a41de50c2951cf14b3ca6923a2a
2016-03-30 11:12:51 +00:00
Pierre Imai
bc786b7475 Merge "Move connectivity events to frameworks/base." into nyc-dev 2016-03-30 01:16:59 +00:00
Paul Jensen
1c71cb3e72 Fix potential ApfFilter bugs by careful ByteBuffer use
Avoid adjusting ApfFilter.Ra.mPacket's postion() and limit()
in matches(). This avoids potential bugs in other parts of
the code that previously relied on limit() being reset.
Also for good measure change some limit() calls to capacity()
as it's more final.

Change-Id: I466e87ce6838f68654b24f2c9543a6cd547d3f87
2016-03-29 12:03:34 -04:00
Pierre Imai
bc9cc50947 Move connectivity events to frameworks/base.
Fixes a crash in bluetooth' DhcpClient due to Class(not)Loader.

Change-Id: I318c033aa8782c27a243104f85950adbf07d03a6
BUG: 27885860
BUG: 25691077
2016-03-29 22:07:09 +09:00
Lorenzo Colitti
37127f8620 Add a toString method to ApfCapabilities.
Change-Id: I505b90b7cd818cb3477990ec6b41b16db46d1c08
2016-03-28 17:33:30 +09:00
Lorenzo Colitti
5812e64850 Rename IpManager#dumpApf to #dump and change its signature.
Also give it a bit of indentation.

Bug: 26991160
Change-Id: I8a85276e76e15f452075931747552b486598f0e9
2016-03-28 17:32:19 +09:00
Paul Jensen
f21b4dc1d6 Move ApfFilter from ConnectivityService to IpManager
There's a few advantages to having ApfFilter in IpManager:
1. If things go wrong, crashing a particular transport is less bad then
   crashing ConnectivityService.  We also don't want to use
   ConnectivityService as a dumping ground for transport-specific logic.
2. This makes implementing WifiManager.MulticastLock a lot simpler and
   safer because enabling/disabling it doesn't have to go through the
   NetworkAgent, which could risk various races (e.g. installing a filter
   into the wrong WiFi network).
3. IpManager is the ultimate source for LinkProperties for a particular
   transport and since ApfFilter uses the LinkProperties it's better to
   have it closely paired with the IpManager. Likewise, ApfFilter needs
   to know the APF capabilities of the transport, so having it in
   the transport avoids having to parcel this information through the
   NetworkAgent.

Bug: 26238573
Change-Id: I99b85f2b64972f0e7572170ec5d1926081aa3429
2016-03-25 07:46:07 -04:00
Erik Kline
a5265e47d8 Merge "Request vendor info option (43) to get metered hint" into nyc-dev 2016-03-25 07:08:00 +00:00
Pierre Imai
55618be44c Add initial connectivity metrics handling.
Adds initial support for IP connectivity metrics collection (DHCP
client, IP reachability monitor, network monitor, connectivity
service).

Change-Id: If9a0455f2a34aa9abea90f9c1b38e4d895dc1a72
2016-03-25 13:21:41 +09:00
Erik Kline
1d511ab13d Request vendor info option (43) to get metered hint
Bug: 26241591
Change-Id: I688029826a79f9cbf0116fb197f82026980788af
2016-03-25 11:55:19 +09:00
Lorenzo Colitti
f55c9c1781 Don't crash if we get a DHCP packet with the wrong port.
This should only happen if we get a packet in the small time
window between binding the packet socket and programming the
BPF filter on it.

Bug: 26696823
Change-Id: I481f1bc74bbaeb9646d96e1841d2a69acdb47d62
2016-03-09 16:16:45 +09:00
Joe Onorato
f188d41fa2 Turn down the logging a little bit and don't do a log wrapper function.
Change-Id: I109f04c2c2299f26e21b076df3a935ce2d356bdf
2016-03-04 12:21:30 -08:00
Erik Kline
24f7d5e655 Add 464xlat notification callback
am: 8d6edc3270

* commit '8d6edc3270616b119645fbdf8752c0ea37de0731':
  Add 464xlat notification callback
2016-03-02 08:37:06 +00:00
Erik Kline
8d6edc3270 Add 464xlat notification callback
Bug: 26238390
Bug: 26991160
Change-Id: I556e779c642d19cd8d26637dd98055157d005f77
2016-03-02 16:50:46 +09:00
Erik Kline
e5a5f84fef Add constructor with more inputs for dependency injection.
am: b9df11099f

* commit 'b9df11099f16ca816a69e06f1327eb1f86723578':
  Add constructor with more inputs for dependency injection.
2016-03-01 06:10:40 +00:00
Erik Kline
b9df11099f Add constructor with more inputs for dependency injection.
Bug: 26991160
Bug: 27406552
Change-Id: If4a0a2f1afb1da4ad59df9eb31c540047c84659b
2016-03-01 14:58:30 +09:00
Erik Kline
13daed9fea Add WaitForProvisioningCallback
am: 111d55658b

* commit '111d55658bce1bcc3eb61b4aeaa4d8a256165b02':
  Add WaitForProvisioningCallback
2016-02-22 04:29:37 +00:00
Erik Kline
69ce6a0fc5 Support setting TCP buffer sizes and HTTP Proxy config
am: d0e843b8ef

* commit 'd0e843b8ef4218ba8f69a8a53b3eeaf21e667deb':
  Support setting TCP buffer sizes and HTTP Proxy config
2016-02-22 04:11:28 +00:00
Erik Kline
111d55658b Add WaitForProvisioningCallback
This centralizes code that is shared by both bluetooth and ethernet
transport layers.

Bug: 26991160
Change-Id: I8e2dd8580c29c86394119768e3a5529850b4b859
2016-02-22 13:02:02 +09:00
Erik Kline
d0e843b8ef Support setting TCP buffer sizes and HTTP Proxy config
This allows IpManager to send callback recipients a more satisfying
LinkProperties.

Bug: 26991160
Change-Id: I2eb60dc633e5be38dad9410a1096d0095ddf57a0
2016-02-22 12:50:44 +09:00
Lorenzo Colitti
a2a9ab947f Add a MessageUtils class to convert int constants to strings.
am: d2457a3ee3

* commit 'd2457a3ee39ea55ed8e302bd93feede793cb5055':
  Add a MessageUtils class to convert int constants to strings.
2016-02-19 05:01:56 +00:00
Lorenzo Colitti
d2457a3ee3 Add a MessageUtils class to convert int constants to strings.
This class uses reflection to find accessible static integer
members in a specified list of classes and returns a SparseArray
mapping the integers to their names. This will allow us to
replace various 400-line switch statements with a simple
array access.

Change-Id: I3607e6389a423cde0bd83270c00b3c863ae1bb29
2016-02-19 10:26:55 +09:00
Erik Kline
7651b21fe9 {,Base}DhcpStateMachine is no more
am: efa4209fe0

* commit 'efa4209fe022d007f48edc3c4feaef00a9865cb5':
  {,Base}DhcpStateMachine is no more
2016-02-18 04:38:38 +00:00
Erik Kline
efa4209fe0 {,Base}DhcpStateMachine is no more
Bug: 26991160
Change-Id: I21f8c30627bf2a7fbcd5b4d5f1f1ad1a2dda759b
2016-02-18 12:56:45 +09:00
Erik Kline
907b255ebf Remove references to BaseDhcpStateMachine and DhcpStateMachine
am: 29a215268d

* commit '29a215268dfa18f5023dc3c06b33db68e91ae316':
  Remove references to BaseDhcpStateMachine and DhcpStateMachine
2016-02-17 13:06:49 +00:00
Erik Kline
29a215268d Remove references to BaseDhcpStateMachine and DhcpStateMachine
Bug: 26991160
Change-Id: I3742780a4e5121c163d9d1380951e25edaba19f3
2016-02-17 21:44:25 +09:00
Erik Kline
5c78685d56 Add IpManager#shutdown() to terminate the state machine.
am: b1ee39540e

* commit 'b1ee39540ead2e4ee74d4dba9ee1b84211766221':
  Add IpManager#shutdown() to terminate the state machine.
2016-02-17 12:20:19 +00:00
Erik Kline
b1ee39540e Add IpManager#shutdown() to terminate the state machine.
Additionally, remove IpManager.Callback#usingIpReachabilityMonitor()
now that this is now longer used.

Bug: 26991160
Change-Id: I9a17497c82238a9fb37a20d01aeca7bc4913ae2c
2016-02-17 20:54:10 +09:00
Erik Kline
209fd91dae Add IpManager.ProvisioningRequest class
am: 93b1a36e31

* commit '93b1a36e31b42c5b33a0164f2832ab9aa12d9a00':
  Add IpManager.ProvisioningRequest class
2016-02-16 10:15:09 +00:00
Erik Kline
93b1a36e31 Add IpManager.ProvisioningRequest class
This class captures provisioning request parameters to be passed to
IpManager#startProvisioning().

Bug: 26991160
Change-Id: I56652bbc4b9ae6cfca3f225a8d99cdfc01bb54d9
2016-02-16 18:11:47 +09:00
Erik Kline
09bf13574e Duplicate DhcpStateMachine public constants into DhcpClient
This is so we can ultimately delete DhcpStateMachine altogether.

Bug: 24837343
Bug: 26991160
Change-Id: If116639e5f72c97cfc67f748dc5f6433dccd9cf0
2016-02-12 19:02:39 +09:00
Erik Kline
3b74289fdf Duplicate DhcpStateMachine public constants into DhcpClient
This is so we can ultimately delete DhcpStateMachine altogether.

Bug: 24837343
Bug: 26991160
Change-Id: If116639e5f72c97cfc67f748dc5f6433dccd9cf0
2016-02-12 17:10:15 +09:00
Erik Kline
16e1e55271 Use IpManager.ifname as the tag in log messages.
am: ef1f39abff

* commit 'ef1f39abff088789853e8747418310534cf2127e':
  Use IpManager.ifname as the tag in log messages.
2016-02-11 13:27:27 +00:00
Erik Kline
ef1f39abff Use IpManager.ifname as the tag in log messages.
Bug: 26991160
Change-Id: Idc9231819298b65da3cc3baa88f1f0cd18ab6df7
2016-02-11 21:07:07 +09:00
Erik Kline
db338c2e90 Merge "Incorporate historical WifiStateMachine notions of provisioning." into mm-wireless-dev
am: f94dc18746

* commit 'f94dc18746d93e98d2e48cdd25b799aa20a142ab':
  Incorporate historical WifiStateMachine notions of provisioning.
2016-02-10 22:13:31 +00:00
Erik Kline
990fc4968d Incorporate historical WifiStateMachine notions of provisioning.
Also: considerably expand logging capabilities.

Bug: 26991160
Change-Id: I36c3c1d2158ffd178e8ce163b8799d62938f39c7
2016-02-11 03:21:48 +09:00
Paul Jensen
8514a8131f Merge "Android packet filtering program interpreter test & program generator" into mm-wireless-dev
am: 44307adcf3

* commit '44307adcf371bacad4de6925a9207bdbfdc6f874':
  Android packet filtering program interpreter test & program generator
2016-02-03 17:12:47 +00:00
Paul Jensen
44307adcf3 Merge "Android packet filtering program interpreter test & program generator" into mm-wireless-dev 2016-02-03 16:48:43 +00:00
Paul Jensen
d38fb7662d Android packet filtering program interpreter test & program generator
Change-Id: I17951bd6320b9eb3b6c43f2ae37f62c2025705c1
2016-02-03 10:19:13 -05:00