summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorAaron Huang <huangaaron@google.com>2019-05-02 18:16:20 +0800
committerAaron Huang <huangaaron@google.com>2019-05-06 11:34:35 +0000
commit8e2681794b9a0b28a5c847cde83f99f9d23904fc (patch)
tree76df0e8233222aeb402bdf68e400ba754dad1602 /service
parentc0f020cfc1486880c7a80290ded61a9c3b13fad2 (diff)
Support NAT-T keepalive packet filter
Add NAT-T keepalive packet filter for dropping NAT-T keepalive packet in APF filter. Bug: 33530442 Test: atest FrameworksNetTests Change-Id: I8b5b9e13ad604384b6970d732639d7f6859df979
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/ClientModeImpl.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index 6ba2debe9..7c3ad802f 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -41,6 +41,7 @@ import android.net.KeepalivePacketData;
import android.net.LinkProperties;
import android.net.MacAddress;
import android.net.MatchAllNetworkSpecifier;
+import android.net.NattKeepalivePacketData;
import android.net.Network;
import android.net.NetworkAgent;
import android.net.NetworkCapabilities;
@@ -5223,9 +5224,18 @@ public class ClientModeImpl extends StateMachine {
case CMD_ADD_KEEPALIVE_PACKET_FILTER_TO_APF: {
if (mIpClient != null) {
final int slot = message.arg1;
- final TcpKeepalivePacketData pkt = (TcpKeepalivePacketData) message.obj;
try {
- mIpClient.addKeepalivePacketFilter(slot, pkt.toStableParcelable());
+ if (message.obj instanceof NattKeepalivePacketData) {
+ final NattKeepalivePacketData pkt =
+ (NattKeepalivePacketData) message.obj;
+ mIpClient.addNattKeepalivePacketFilter(slot,
+ pkt.toStableParcelable());
+ } else if (message.obj instanceof TcpKeepalivePacketData) {
+ final TcpKeepalivePacketData pkt =
+ (TcpKeepalivePacketData) message.obj;
+ mIpClient.addKeepalivePacketFilter(slot,
+ pkt.toStableParcelable());
+ }
} catch (RemoteException e) {
loge("Error adding Keepalive Packet Filter ", e);
}