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>
Mon, 28 Aug 2017 23:55:18 +0000 (08:55 +0900)
commit771d5c2f0126ba692897c9716f4098ae6e3a870c
treeae1f6fd3633fb96da9f063cb99e218423b2c589d
parent4f6f139869ddadf6f9ed50967c106a10a2e8ce3f
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
Change-Id: I889d98e47423ff3d4746d6ed8015b265286e7c52
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