OSDN Git Service

[KA11] Verify fd ownership and allocate resource for NattKeepalive
authorjunyulai <junyulai@google.com>
Tue, 16 Apr 2019 11:32:32 +0000 (19:32 +0800)
committerjunyulai <junyulai@google.com>
Tue, 23 Apr 2019 02:47:19 +0000 (10:47 +0800)
commitcecd4a3d64a0fc6006c133ab2a35be44f5d6fb4b
treeaa5fdd54e71d8afd0c16aca993adcadab45a67f0
parent1f55cbf416a15e477d678663d38868b5d11d02e9
[KA11] Verify fd ownership and allocate resource for NattKeepalive

Since socket keepalive APIs for UDP encapsulation sockets are
public to generic app. In order to ensure the given fd is valid,
this change verifies the resource id inside the UDP
encapsulation socket by using methods provided by IpSecService.

Bug: 125517194
Fix: 123968920
Test: 1. atest FrameworksNetTests --generate-new-metrics 10
      2. atestcom.android.server.ConnectivityServiceTest \
         #testNattSocketKeepalives --generate-new-metrics 100
Change-Id: I408aacc19b364683854d15a095c34e72389a6e5b
services/core/java/com/android/server/ConnectivityService.java
services/core/java/com/android/server/connectivity/KeepaliveTracker.java
tests/net/java/com/android/server/ConnectivityServiceTest.java