Commit Graph

564 Commits

Author SHA1 Message Date
Lorenzo Colitti
f851d0347e Don't crash if the interface disappears just after appearing.
If the interface disappears between interfaceAdded() and
setInterfaceUp, we'll crash with an IllegalStateException in
NetworkManagementService#setInterfaceConfig.

Ignore the error instead. This should be safe because we don't
modify any state unless our calls succeed.

(cherry picked from commit 17f4e4a027)

Bug: 62870779
Test: builds aosp_bullhead-eng
Test: builds marlin-eng
Test: exception is logged and device doesn't crash when unplugging USB ethernet adapter while it's being initialized
Change-Id: If8c2375f7fffe25a9fa79dc4f1981c745384a276
2017-06-23 13:54:27 +09:00
Lorenzo Colitti
b131ddc5fd Don't crash if the interface disappears just after appearing.
am: 17f4e4a027

Change-Id: I9f591c6d3136ebdab13051c30f02888320e2b309
2017-06-23 04:50:13 +00:00
Lorenzo Colitti
17f4e4a027 Don't crash if the interface disappears just after appearing.
If the interface disappears between interfaceAdded() and
setInterfaceUp, we'll crash with an IllegalStateException in
NetworkManagementService#setInterfaceConfig.

Ignore the error instead. This should be safe because we don't
modify any state unless our calls succeed.

Bug: 62870779
Test: builds aosp_bullhead-eng
Change-Id: If8c2375f7fffe25a9fa79dc4f1981c745384a276
2017-06-23 01:41:47 +09:00
Lorenzo Colitti
8555952a34 Make Ethernet more robust. am: 62d5e744c3 am: 042561637c am: 315c859e8a
am: e0d41d9626

Change-Id: I05e3f094afaa45e282b0433eba8190088ae198b0
2017-06-19 06:23:57 +00:00
Lorenzo Colitti
e0d41d9626 Make Ethernet more robust. am: 62d5e744c3 am: 042561637c
am: 315c859e8a

Change-Id: I5b41e68577950ba16557427e552e6d03d983dba0
2017-06-19 06:18:52 +00:00
Lorenzo Colitti
315c859e8a Make Ethernet more robust. am: 62d5e744c3
am: 042561637c

Change-Id: I134d6c7d9769eca8bb157d9833181df09e8e8e38
2017-06-19 06:13:47 +00:00
Lorenzo Colitti
042561637c Make Ethernet more robust.
am: 62d5e744c3

Change-Id: I290626b64fa6009b7365a2f7957ddb0776777683
2017-06-19 06:04:17 +00:00
Lorenzo Colitti
62d5e744c3 Make Ethernet more robust.
1. Remove the IP provisioning thread and just attempt
   provisioning indefinitely whenever we have an interface.
2. Make all methods run on the passed-in handler thread. This
   makes it easier to verify correctness by code inspection.
3. Remove the code that changes the factory score depending on
   whether we're tracking an interface and have link. This is
   unnecessary complexity, as there is no penalty to accepting a
   request even if we don't have an interface.
4. Remove code duplication and only have one codepath for
   stopping layer 3.

Tested the following are tested with this CL:
- Booting with an interface connected.
- Disconnecting/reconnecting the Ethernet cable repeatedly,
  particularly at inconvenient times (e.g., during provisioning).
- Similarly, disconnecting/reconnecting USB Ethernet interfaces.
- Falling back to another Ethernet interface if the currently
  tracked Ethernet interface is unplugged.
- Disconnecting and restarting provisioning when provisioning is
  lost (e.g., if the default route is deleted).
- Crashing the system server causes Ethernet to reconnect on
  restart.
- The above while running watch -n 0.1 adb shell dumpsys ethernet

(cherry picked from commit 9effed6f9e)

Bug: 62308954
Test: tested on marlin with USB ethernet adapters, as described
Test: smoketested on aosp_bullhead
Change-Id: Ie3041f1d453d15c81eee81adfc8593269c499d79
2017-06-19 12:31:42 +09:00
Lorenzo Colitti
26fd808c6b Merge "Make Ethernet more robust. am: 9effed6f9e am: 00f803738d" into oc-dr1-dev-plus-aosp
am: c9eddcde9c

Change-Id: I5e05dd306ae651aa75735d887c2a74e5f2fe4f6d
2017-06-09 07:38:38 +00:00
Lorenzo Colitti
e68d804b28 Make Ethernet more robust. am: 9effed6f9e am: 00f803738d
am: 11238e8984

Change-Id: I9cf638511ada7a0672d0b9a268d3ea082f162961
2017-06-09 07:38:29 +00:00
Android Build Merger (Role)
c9eddcde9c Merge "Make Ethernet more robust. am: 9effed6f9e am: 00f803738d" into oc-dr1-dev-plus-aosp 2017-06-09 07:34:37 +00:00
Lorenzo Colitti
92995a88e0 Make Ethernet more robust. am: 9effed6f9e
am: 00f803738d

Change-Id: I4dd010c8e49ac2d603f7ed617209bdc3759680fd
2017-06-09 07:34:32 +00:00
Lorenzo Colitti
11238e8984 Make Ethernet more robust. am: 9effed6f9e
am: 00f803738d

Change-Id: I03f9b28561e0fb1fd1c5e388820e02748c8580b3
2017-06-09 07:34:29 +00:00
Lorenzo Colitti
00f803738d Make Ethernet more robust.
am: 9effed6f9e

Change-Id: I1c531a142706d3cbe0da3adf810887cc221944ed
2017-06-09 07:32:59 +00:00
Lorenzo Colitti
9effed6f9e Make Ethernet more robust.
1. Remove the IP provisioning thread and just attempt
   provisioning indefinitely whenever we have an interface.
2. Make all methods run on the passed-in handler thread. This
   makes it easier to verify correctness by code inspection.
3. Remove the code that changes the factory score depending on
   whether we're tracking an interface and have link. This is
   unnecessary complexity, as there is no penalty to accepting a
   request even if we don't have an interface.
4. Remove code duplication and only have one codepath for
   stopping layer 3.

Tested the following are tested with this CL:
- Booting with an interface connected.
- Disconnecting/reconnecting the Ethernet cable repeatedly,
  particularly at inconvenient times (e.g., during provisioning).
- Similarly, disconnecting/reconnecting USB Ethernet interfaces.
- Falling back to another Ethernet interface if the currently
  tracked Ethernet interface is unplugged.
- Disconnecting and restarting provisioning when provisioning is
  lost (e.g., if the default route is deleted).
- Crashing the system server causes Ethernet to reconnect on
  restart.
- The above while running watch -n 0.1 adb shell dumpsys ethernet

Bug: 62308954
Test: tested on marlin with USB ethernet adapters, as described
Change-Id: Iad12a52a903bfaccf7e245dfe499652c752c31e9
2017-06-09 14:01:29 +09:00
Lorenzo Colitti
4c2a7142ff Merge "Disable the IpManager timeout on Ethernet. am: 0587321554 am: 8bb0952a05" into nyc-mr1-dev-plus-aosp
am: d40615e24e

* commit 'd40615e24ec0532a04ac76f45f2061f61a0e7ba1':

Change-Id: Ib7fbcd926f1a128d86e7710e7e1f7f800afa695a
2016-04-29 13:41:32 +00:00
Lorenzo Colitti
a7b9e2fdb5 Disable the IpManager timeout on Ethernet. am: 0587321554 am: 8facc75476
am: 5a1fe20b16

* commit '5a1fe20b16c0e7030b03c47136cccd9d62b1b966':
  Disable the IpManager timeout on Ethernet.

Change-Id: Idcc944d0edeedf648349e5268fddd724fe9d65bd
2016-04-29 13:41:32 +00:00
Android Build Merger (Role)
d40615e24e Merge "Disable the IpManager timeout on Ethernet. am: 0587321554 am: 8bb0952a05" into nyc-mr1-dev-plus-aosp 2016-04-29 13:39:14 +00:00
Lorenzo Colitti
5a1fe20b16 Disable the IpManager timeout on Ethernet. am: 0587321554
am: 8facc75476

* commit '8facc754767f09f15b7f99c82990c80df40d7014':
  Disable the IpManager timeout on Ethernet.

Change-Id: I46ab6959dce02c5f5da3324d7c4ed59303dcd1cb
2016-04-29 13:39:06 +00:00
Lorenzo Colitti
9b49b7f8b2 Disable the IpManager timeout on Ethernet. am: 0587321554
am: 8bb0952a05

* commit '8bb0952a059c20a47ea0747346f8afb896a6ab9d':
  Disable the IpManager timeout on Ethernet.

Change-Id: I698a59f0b897422b88c4f09f8116a6eab3c14701
2016-04-29 13:39:06 +00:00
Lorenzo Colitti
8facc75476 Disable the IpManager timeout on Ethernet.
am: 0587321554

* commit '0587321554850c1e9d0aab66116ec8a41b367647':
  Disable the IpManager timeout on Ethernet.

Change-Id: I33e0c1243534db348a0b6a8f8ce1a71b68d0ff91
2016-04-29 13:36:42 +00:00
Lorenzo Colitti
8bb0952a05 Disable the IpManager timeout on Ethernet.
am: 0587321554

* commit '0587321554850c1e9d0aab66116ec8a41b367647':
  Disable the IpManager timeout on Ethernet.

Change-Id: Ic578ba62b3900060e75da19c1dd29a0a69abfdbf
2016-04-29 13:36:41 +00:00
Lorenzo Colitti
0587321554 Disable the IpManager timeout on Ethernet.
This fixes a longstanding bug where after a DHCP timeout, we
would never restart the DHCP client and get an IP address until
the link bounced.

Also, two minor improvements:

1. Dump IpManager info when dump() is called.
2. When onLinkPropertiesChange is called, also update
   mLinkProperties. We were already sending the updated
   LinkProperties to the NetworkAgent, so this is really only
   useful for dump(), but it's just one line and safe because
   onLinkPropertiesChange already grabs the lock.

Bug: 17733693
Change-Id: I42c3319cb4bc151c547ed721baf5e83f97e23862
2016-04-29 19:57:43 +09:00
Erik Kline
5774ef5328 Use more IpManager features
- WaitForProvisioningCallback
    - setHttpProxy
    - setTcpBufferSizes

Bug: 26991160
Change-Id: I5e02039a35006f0466fb40c43805f0443cd758c2
2016-02-22 17:41:12 +09:00
Erik Kline
1cb0138ad3 Use IpManager on Ethernet
Bug: 17733693
Bug: 26991160
Change-Id: Idaee8c64bf452e58b93031d8d7ad666edb0c82ae
2016-02-17 22:19:22 +09:00
Lorenzo Colitti
189063ffb0 Stop requiring CHANGE_NETWORK_STATE to change Ethernet config.
Requiring CHANGE_NETWORK_STATE is pointless, since immediately
after doing that we require CONNECTIVITY_INTERNAL, which is
a system-only permission.

Bug: 23597341
Change-Id: If4c8ecbb319e547c2c81d2dcc3c7bbb63e0bc2af
2015-10-15 16:59:07 +09:00
Lorenzo Colitti
baabe41348 Don't crash on startup if we can't fetch the interface list.
The intent of the code was to catch exceptions, but it wasn't
actually doing that because when a netd command fails we get an
IllegalStateException, not a RemoteException.

Bug: 23581852
Change-Id: I66c7c33bdc7b0d0de4fa5cd92dff054797cf860f
2015-09-08 16:21:52 +09:00
Billy Lau
824a0a5050 Bug: 21588539 Move CHANGE_NETWORK_STATE to be in SYSTEM_SETTINGS
Replaced the method where we used to enforce static permission
CHANGE_NETWORK_STATE to method calls that also check for WRITE_SETTINGS.
This is due to the merging of CHANGE_NETWORK_STATE permission with
WRITE_SETTINGS in M.

Change-Id: I104ac41733663b4f6b5cd30e7314574ec4acdc07
2015-08-07 19:00:49 +01:00
Lorenzo Colitti
9830ae6d92 Stop DHCP if it times out.
This was not necessary in L, but it is necessary after
https://partner-android-review.googlesource.com/#/c/205415/ .

Bug: 22936203
Change-Id: I24a96c33e5bb375f36217a1c2cec2076eb5ac8b4
2015-08-04 14:54:10 +09:00
Bill Yi
c438fea3b8 am d169788a: am 007c7de4: Merge commit \'f4740f2d370b6458126942156245b2d39ec223f9\' into HEAD
* commit 'd169788a3c54663cf3ee6ab895ddff1c623f29e2':
2015-02-20 00:30:57 +00:00
Bill Yi
d169788a3c am 007c7de4: Merge commit \'f4740f2d370b6458126942156245b2d39ec223f9\' into HEAD
* commit '007c7de43faf4e0c67cfed82ca45f08e531a8dc1':
2015-02-20 00:23:03 +00:00
Bill Yi
007c7de43f Merge commit 'f4740f2d370b6458126942156245b2d39ec223f9' into HEAD 2015-02-19 14:31:46 -08:00
Pierre Couillaud
0a000a1235 am b1d214c5: am 566e12ad: eth: make sure dhcp is stopped before bringing up interface.
* commit 'b1d214c5a52dabb86e8ad7ec8dcb35db35ce15f1':
  eth: make sure dhcp is stopped before bringing up interface.
2015-02-16 08:08:06 +00:00
Pierre Couillaud
b1d214c5a5 am 566e12ad: eth: make sure dhcp is stopped before bringing up interface.
* commit '566e12ad11445a4b90d615fd823b53a2c1eba9be':
  eth: make sure dhcp is stopped before bringing up interface.
2015-02-16 07:58:48 +00:00
Pierre Couillaud
566e12ad11 eth: make sure dhcp is stopped before bringing up interface.
Signed-off-by: Pierre Couillaud <pierre@broadcom.com>
Signed-off-by: Blair Prescott <blairp@broadcom.com>
2015-02-11 11:31:22 -08:00
Jaewan Kim
202bc978fd am f4740f2d: Add an API to check availability of Ethernet interface.
* commit 'f4740f2d370b6458126942156245b2d39ec223f9':
  Add an API to check availability of Ethernet interface.
2014-11-21 12:18:09 +00:00
Jaewan Kim
f4740f2d37 Add an API to check availability of Ethernet interface.
Bug: 18045481
Change-Id: I3fb517c3e7fa807e2937fda92026301e312be986
2014-11-19 11:13:41 +09:00
Lorenzo Colitti
9beaf89d78 am 272be52c: Clear all Ethernet state when our interface goes away.
* commit '272be52cb7c1d61a40ac5f03084c43059bc6476e':
  Clear all Ethernet state when our interface goes away.
2014-10-02 02:00:12 +00:00
Lorenzo Colitti
272be52cb7 Clear all Ethernet state when our interface goes away.
Previously we did not stop DHCP or try to force a disconnect.
This made it impossible to reconnect by unplugging and
replugging an USB Ethernet adapter.

Bug: 17736828
Change-Id: Idd8576a96b063b5ca726ee9149800bdcb0f62bd1
2014-10-01 13:52:40 +09:00
Robert Greenwalt
f989264b68 am cf0f619a: Don\'t accept score below 0.
* commit 'cf0f619a5080670415693ca772e079a494aaf7f7':
  Don't accept score below 0.
2014-09-11 14:16:56 +00:00
Robert Greenwalt
cf0f619a50 Don't accept score below 0.
Network Factories are allowed to go below, but networks need to be
constrained.  Allowing the network to go below 0 meant that -1 could
sometimes leak through and foul the logic.

bug:17361330
Change-Id: Ife34ca0f9c233dd3c3df80f6fea580af43afcdeb
2014-09-10 10:06:32 -07:00
Robert Greenwalt
778f4ba51d am eee07beb: Use config resource for tcp buffer size
* commit 'eee07beb9239175a5a428701013b87ffb88b7d96':
  Use config resource for tcp buffer size
2014-08-22 22:45:54 +00:00
Robert Greenwalt
eee07beb92 Use config resource for tcp buffer size
bug:16549611
Change-Id: I48426f6b746e4bd9729bdd529d81b163ff5112a9
2014-08-21 16:28:18 -07:00
Lorenzo Colitti
7cc6ee1d27 am 1affc58c: Actually provide useful output in Ethernet service dump.
* commit '1affc58cb6aeda4c566a530b17d47eca1bf68ff7':
  Actually provide useful output in Ethernet service dump.
2014-08-20 16:31:18 +00:00
Lorenzo Colitti
1affc58cb6 Actually provide useful output in Ethernet service dump.
Bug: 17133859
Change-Id: Ic8424004e48712e4dd906d5bb6a48ce7d38ff9d8
2014-08-19 20:03:35 -07:00
Lorenzo Colitti
171f267a04 am c0cfe2ee: Stop using LinkProperties for static configuration.
* commit 'c0cfe2ee04622e16e4623ffe1612e5afbbaf41ae':
  Stop using LinkProperties for static configuration.
2014-08-19 19:44:57 +00:00
Lorenzo Colitti
c0cfe2ee04 Stop using LinkProperties for static configuration.
Also make static IP configuration more robust (e.g., tear down
our NetworkAgent when we switch between static and DHCP).

Bug: 16114392
Bug: 16893413
Change-Id: Ib33f35c004e30b6067bb20235ffa43c247d174df
2014-08-19 11:57:35 -07:00
Robert Greenwalt
4bf8d13fe5 am 84502f53: Add tcp buffer size data for ethernet
* commit '84502f530060beb56334a9455f95d1b6172b1f5f':
  Add tcp buffer size data for ethernet
2014-08-17 23:22:22 +00:00
Robert Greenwalt
84502f5300 Add tcp buffer size data for ethernet
bug: 16549611
Change-Id: I61d29bb88b9e58c50e03c39570f3ebb7712e4f37
2014-08-15 15:10:05 -07:00
Robert Greenwalt
8590410713 am 62e8e4d3: (-s ours) DO NOT MERGE Don\'t tear down based on NetworkFactory input.
* commit '62e8e4d3d5c345ec0a239eb8985e042176c35743':
  DO NOT MERGE Don't tear down based on NetworkFactory input.
2014-07-22 17:53:19 +00:00