OSDN Git Service

Nat464Xlat: interface notification handler on ConnectivityService
authorHugo Benichi <hugobenichi@google.com>
Wed, 5 Jul 2017 02:08:48 +0000 (11:08 +0900)
committerHugo Benichi <hugobenichi@google.com>
Tue, 29 Aug 2017 06:12:32 +0000 (15:12 +0900)
commit72479c0373c7be75fb6bf752949a8f728911542f
treef985c9198fc8829d31e43574fd9d54c5d81f4bbd
parent883b6492d7fdf94f0ac3a22af62a11303309827b
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
services/core/java/com/android/server/ConnectivityService.java
services/core/java/com/android/server/connectivity/Nat464Xlat.java
services/core/java/com/android/server/connectivity/NetworkAgentInfo.java