3fb5f0db3ffe658fe039f0453c6bc0c46fd5441a |
|
01-Sep-2017 |
Hugo Benichi <hugobenichi@google.com> |
Nat464Xlat: correct racefree teardown This patch relays the NetworkBaseObserver notifications about nat 464xlat stacked interfaces onto the ConnectivityService handler. This allows to process interface up and down notifications in the same thread context and eliminates several races: - NPE risk due to race between fixupLinkProperties called on ConnectivityService thread and interfaceRemoved called on NetworkManagementService thread. - stale LinkProperties pointer reads in both NetworkBaseObserver callbacks not called on ConnectivityService handler. - removes the race between stop() and interfaceRemoved(). - removes superfluous LinkProperties notifications when stop() is called before the stacked interface goes up. The teardown procedure logic common to stop() and interfaceRemoved() is put into enterStoppedState() and enterIdleState(). This allows to distinguish and correctly handle the following teardown scenarios: - an IPv4 appears -> ConnectivityService calls Nat464Xlat#stop() -> Nat464Xlat calls stopClatd -> clatd stops -> if the stacked interface was up, it is removed -> Nat464Xlat#interfaceRemoved() is triggered and a LinkProperties update is sent. - network disconnects -> ConnectivityService calls Nat464Xlat#stop() -> Nat464Xlat calls stopClatd -> clatd stops -> if the stacked interface was up, it is removed -> Nat464Xlat#interfaceRemoved() is triggered and a LinkProperties update is sent. - clatd crashes or exit -> Nat464Xlat#interfaceRemoved() is triggered -> Nat464Xlat unregisters itself as a network observer -> ConnectivityService is updated about the stacked interface missing, and restarts Nat464Xlat if needed. Note that the first two scenarios have two cases: stop() can be called before the notification for the stacked interface going up (STARTED), or after (RUNNING). In the first case, Nat464Xlat must unregister immediately as a network observer to avoid leaks. This patch also: - removes/simplifies comments related to the threading model which are no obsolete. - extract clatd management logic from ConnectivityService into NetworkAgentInfo - add new unit tests where there was none before. Bug: 62918393 Bug: 62997041 Bug: 64571917 Bug: 65225023 Test: runtest frameworks-net Merged-In: I27221a8a60fd9760b567ed322cc79228df877e56 Merged-In: I8f07dfbe5ea8259ff9f5793503f534945e67ad74 Merged-In: I8612db5e5050690db8cf41dd04944b4c22da340c Merged-In: Icb2dc8229b5ea45e319233b588f2dbe39ea40d4c Merged-In: Ibafea69224e832a6316c17dbb9b2d62a233088ac (cherry picked from commit ef502887ec58886e9347afb841aa06cb0d13acea) Change-Id: I9d075048873b0e1c5ed45b5674ada3fb303c2bfb
/frameworks/base/services/core/java/com/android/server/connectivity/Nat464Xlat.java
|
3711910dca8a0104900e21a549a8fd99963a7ff0 |
|
31-Aug-2017 |
Hugo Benichi <hugobenichi@google.com> |
Revert "Nat464Xlat: interface notification handler on ConnectivityService" This reverts commit 72479c0373c7be75fb6bf752949a8f728911542f. Bug: 65225023 Change-Id: Id6c21682cafa86d87f66480237dd731b21f917c5
/frameworks/base/services/core/java/com/android/server/connectivity/Nat464Xlat.java
|
72479c0373c7be75fb6bf752949a8f728911542f |
|
05-Jul-2017 |
Hugo Benichi <hugobenichi@google.com> |
Nat464Xlat: interface notification handler on ConnectivityService This patch adds a layer of asynchonicity to the NetworkBaseObserver callbacks implemented by Nat464Xlat in order to allow these callbacks to run on the main ConnectivityService handler. This allows to run interfaceLinkStateChanged and interfaceRemoved callbacks in the same thread context as other Nat464Xlat methods and solves the following issues: - NPE risk due to race between fixupLinkProperties called on the ConnectivityService thread and interfaceRemoved called as a callback by NetworkManagementService. - stale LinkProperties reads in both callbacks not called on ConnectivityService handler. - removes the race between stop() and interfaceRemoved(). This patch also: - removes/simplifies comments related to the threading model which are no obsolete. - extract clatd management logic from ConnectivityService into NetworkAgentInfo Bug: 62997041 Bug: 64571917 Test: runtest frameworks-net manually connected to ipv6 network and went to test-ipv6.com Merged-In: I889d98e47423ff3d4746d6ed8015b265286e7c52 Merged-In: I2f002cd197e2eeaaadadd747a6b33d264cd34433 Merged-In: Id3ab064cf9f4417c0e8988fff4167b65b3c8c414 Merged-In: Ib224392c9a185f6bd79fd60cd5cb5549f2a7851e Merged-In: I9116a493ca1cbdf6a25664a1b0017aa6c9b38eb4 Merged-In: I12918d208364eef55067ae9d59fbc38477e1f1c6 (cherry picked from commit 771d5c2f0126ba692897c9716f4098ae6e3a870c) Change-Id: I34c4a0c32ce7c9b7bd7acf8f87b932e15c573bd8
/frameworks/base/services/core/java/com/android/server/connectivity/Nat464Xlat.java
|
883b6492d7fdf94f0ac3a22af62a11303309827b |
|
29-Jun-2017 |
Hugo Benichi <hugobenichi@google.com> |
Nat464Xlat: internal state guards cleanup + state enum This patch does some cleanup of Nat464Xlat internal state guards against the Nat464Xlat state Idle | Started | Running, which reduces code nesting. It also replaces introspection of internal state for distinguishing between different stages in 464xlat lifecycle with an enum explicitly introducing these three Idle | Started | Running states. Bug: 62997041 Bug: 64571917 Test: runtest frameworks-net manually connected to ipv6 network and went to test-ipv6.com Merged-In: I6efc9fed2420ca488731a2b9b9c3c025b16eca10 Merged-In: I188ac4c367db11cb33b67fe92df3a120e3c6fbce Merged-In: I7e2c5db8d537fb0ab47cde37158b7f04d7786942 Merged-In: Ic2246a97618c596dbdbf48cda39c2f5b66e3bfb6 Merged-In: Ib04b9a3d56e9daf61b299a30e24a3c8839819a00 Merged-In: Icc1558a0f0e7c299270f550897347458e2bd3188 (cherry pick from commit 4f6f139869ddadf6f9ed50967c106a10a2e8ce3f) Change-Id: Iebc7d153d8cd0b90d074d8d6eed821fbc3f1370d
/frameworks/base/services/core/java/com/android/server/connectivity/Nat464Xlat.java
|
6f62b73915296e59390e69b15160ccb7c031f733 |
|
27-Jun-2017 |
Hugo Benichi <hugobenichi@google.com> |
Nat464Xlat: clat management cleanup This patch does some minor refactoring of clat starting/stopping code: - remove unused LinkProperties arguments in updateClat - remove unused Context argument in Nat464Xlat ctor - introduce ensureClatIsStarted and ensureClatIsStopped methods and simplify updateClat - add clatd to NetworkAgentInfo toString() method - clarify some comments This changes prepare for moving BaseNetworkObserver callbacks to ConnectivityService. Bug: 62997041 Bug: 64571917 Test: runtest frameworks-net manually connected to IPv6 only network and went to test-ipv6.com Merged-In: Idb204784614cfe700f73255a7a7b78c5e9ee6eca Merged-In: Ic3808a1afe48efac745b1b378fb12cc5678918ec Merged-In: Ia769aef6ef8b258f44f8979003d271c96264f1b5 Merged-In: I1a19e6fbb0cb13262e90b171d861062469078fb6 Merged-In: I06661bd6bd1456ba34a3bbdb52c120ac01da9d61 Merged-In: Ifccff9f3cfccdb2cdddf2f07561f0787a48bc0f8 (cherry picked from commit b577d65825e623a9868664486482ed137b98b504) Change-Id: Ibb02888633df9643030336c4dbea6c569a47554c
/frameworks/base/services/core/java/com/android/server/connectivity/Nat464Xlat.java
|
853d741ce739e0562e8b5386b8165e3d560fe7d4 |
|
03-Mar-2016 |
Lorenzo Colitti <lorenzo@google.com> |
Support 464xlat on Ethernet. Bug: 26991160 Change-Id: I848c9e86e1ed337e95cfddda46723a9a1dcaed30
/frameworks/base/services/core/java/com/android/server/connectivity/Nat464Xlat.java
|
08c7116ab9cd04ad6dd3c04aa1017237e7f409ac |
|
28-Feb-2015 |
John Spurlock <jspurlock@google.com> |
Remove unused imports in frameworks/base. Change-Id: I031443de83f93eb57a98863001826671b18f3b17
/frameworks/base/services/core/java/com/android/server/connectivity/Nat464Xlat.java
|
7f6c0d7d2d5ad9e9f316300ce06f27d8492b05cd |
|
11-Nov-2014 |
Lorenzo Colitti <lorenzo@google.com> |
Populate 464xlat LinkProperties only when the interface comes up. Currently Nat464Xlat reads the clat IPv4 address and updates the clat LinkProperties when the interface is created. This causes a race condition: because clatd only sets the IPv4 address after creating the interface, it's possible that Nat464Xlat will read the address before clatd has set it, causing the framework to think that the clat IPv4 address is 0.0.0.0/32. This seems to be happening more frequently now, perhaps because clatd takes a bit longer to configure the IPv4 address now that it needs to check that the address is free before using it. Fix this by making Nat464Xlat listen for the interface coming up instead of listening for the interface being added. Bug: 12111730 Change-Id: Ic1c59b5b6dbb851b7431d1b06885f67803373bb9
/frameworks/base/services/core/java/com/android/server/connectivity/Nat464Xlat.java
|
dc6690867bbe839bbabddd9d7d5e4ec887a2bfee |
|
28-Oct-2014 |
Lorenzo Colitti <lorenzo@google.com> |
Enable 464xlat on wifi. Bug: 12111730 Change-Id: If6d118a3c6e163262b09cc2fb3e3d3f9a81986ec
/frameworks/base/services/core/java/com/android/server/connectivity/Nat464Xlat.java
|
e21a26b3ba78b0238f4ed4a09b43319a2320fbaa |
|
28-Oct-2014 |
Lorenzo Colitti <lorenzo@google.com> |
Add support for running 464xlat on wifi as well. 1. Add a command to NetworkManagementService to enable/disable IPv6 ND offload via netd. 2. Make Nat464Xlat enable offload if clatd successfully comes up on a wifi network (which means it detected a NAT64), and correspondingly re-enable offload when the clatd interface goes down. This change does not enable clatd on wifi yet, that requires an extra 2 lines to enable it. Bug: 12111730 Change-Id: I4318611762a37487c9a84f8c4867ec5aece98be8
/frameworks/base/services/core/java/com/android/server/connectivity/Nat464Xlat.java
|
954394653dad05838235f48244a4320893e0f0cf |
|
09-Oct-2014 |
Lorenzo Colitti <lorenzo@google.com> |
Support more than one clatd at a time. 1. Make Nat464Xlat a per-network object, one for every network requiring clat, instead of a ConnectivityService singleton. 2. Make the NetworkManagementService clatd commands take an interface. 3. When we attempt to start clatd on a network, store its Nat464Xlat object in the NetworkAgentInfo, so we have an authoritative way of knowing whether clat is running on a given network. 4. Rework Nat464Xlat, hopefully simplifying it. Bug: 12111730 Change-Id: I1fa5508ef020cd1c3d1c7a1f7b06370ac5fc2ae2
/frameworks/base/services/core/java/com/android/server/connectivity/Nat464Xlat.java
|
f3cab63ef2248aebf2c931cd1e84d5739791fa50 |
|
20-Oct-2014 |
Lorenzo Colitti <lorenzo@google.com> |
Change removeStackedLink to take an interface name. This simplifies callers. Also remove all "implementations" of addStackedLink and removeStackedLink except the one in LinkProperties, because they are unused. Bug: 12111730 Change-Id: Ie294b855facba4b1436299dcb3211b72d9ba448e
/frameworks/base/services/core/java/com/android/server/connectivity/Nat464Xlat.java
|
1df5fa55c5a5c1ba054b783ea639c99d57c357cf |
|
20-Sep-2014 |
Lorenzo Colitti <lorenzo@google.com> |
Only stop/start clatd if necessary. Previously we would restart clatd on every LinkProperties change, which now happens every time we switch radio technology (e.g., LTE to HSPA). We also would not stop it if the link got an IPv4 address. Bug: 15024258 Bug: 17186694 Bug: 17569702 Change-Id: I65cfcd5e7acec8ea1a12392a59dabd668c58490f
/frameworks/base/services/core/java/com/android/server/connectivity/Nat464Xlat.java
|
43b76dfddbfe2a27a0658dbca8632a9b1dc8d6ff |
|
16-May-2014 |
Lorenzo Colitti <lorenzo@google.com> |
Stop clatd when starting the Nat464Xlat service. If a runtime restart happens while clatd was running, we try to start clatd, which causes a fatal exception because netd returns a 400 error (clatd already started. Bug: 13450716 Bug: 15012035 Change-Id: I102a06d6193fb5f4a1ebe5ad52e5647ff72ca0da
/frameworks/base/services/core/java/com/android/server/connectivity/Nat464Xlat.java
|
3b75982e39ed9370153ae7f238f1d6041b9506ed |
|
13-May-2014 |
Paul Jensen <pauljensen@google.com> |
Get clatd/Nat464Xlat working with new NetworkAgents. Change-Id: I65dfb59ce519a42bdb872940d229039b5403fd92
/frameworks/base/services/core/java/com/android/server/connectivity/Nat464Xlat.java
|
9158825f9c41869689d6b1786d7c7aa8bdd524ce |
|
22-Nov-2013 |
Amith Yamasani <yamasani@google.com> |
Move some system services to separate directories Refactored the directory structure so that services can be optionally excluded. This is step 1. Will be followed by another change that makes it possible to remove services from the build. Change-Id: Ideacedfd34b5e213217ad3ff4ebb21c4a8e73f85
/frameworks/base/services/core/java/com/android/server/connectivity/Nat464Xlat.java
|