diff options
| author | Paul Jensen <pauljensen@google.com> | 2016-03-18 12:22:09 -0400 |
|---|---|---|
| committer | Paul Jensen <pauljensen@google.com> | 2016-03-25 07:46:07 -0400 |
| commit | f21b4dc1d6e9cc3fc164828e9eba33445c0801d0 (patch) | |
| tree | 25b772056056c45606cf07c1f6eb724b334d5bcc /core/java | |
| parent | dfd5a949fbbba78793c261f5a0d585b27dc33851 (diff) | |
Move ApfFilter from ConnectivityService to IpManager
There's a few advantages to having ApfFilter in IpManager:
1. If things go wrong, crashing a particular transport is less bad then
crashing ConnectivityService. We also don't want to use
ConnectivityService as a dumping ground for transport-specific logic.
2. This makes implementing WifiManager.MulticastLock a lot simpler and
safer because enabling/disabling it doesn't have to go through the
NetworkAgent, which could risk various races (e.g. installing a filter
into the wrong WiFi network).
3. IpManager is the ultimate source for LinkProperties for a particular
transport and since ApfFilter uses the LinkProperties it's better to
have it closely paired with the IpManager. Likewise, ApfFilter needs
to know the APF capabilities of the transport, so having it in
the transport avoids having to parcel this information through the
NetworkAgent.
Bug: 26238573
Change-Id: I99b85f2b64972f0e7572170ec5d1926081aa3429
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/net/NetworkAgent.java | 21 | ||||
| -rw-r--r-- | core/java/android/net/NetworkMisc.java | 25 |
2 files changed, 0 insertions, 46 deletions
diff --git a/core/java/android/net/NetworkAgent.java b/core/java/android/net/NetworkAgent.java index 9e360e11bf8b..20c216826531 100644 --- a/core/java/android/net/NetworkAgent.java +++ b/core/java/android/net/NetworkAgent.java @@ -200,14 +200,6 @@ public abstract class NetworkAgent extends Handler { */ public static final int CMD_PREVENT_AUTOMATIC_RECONNECT = BASE + 15; - /** - * Sent by ConnectivityService to the NetworkAgent to install an APF program in the network - * chipset for use to filter packets. - * - * obj = byte[] containing the APF program bytecode. - */ - public static final int CMD_PUSH_APF_PROGRAM = BASE + 16; - public NetworkAgent(Looper looper, Context context, String logTag, NetworkInfo ni, NetworkCapabilities nc, LinkProperties lp, int score) { this(looper, context, logTag, ni, nc, lp, score, null); @@ -327,10 +319,6 @@ public abstract class NetworkAgent extends Handler { preventAutomaticReconnect(); break; } - case CMD_PUSH_APF_PROGRAM: { - installPacketFilter((byte[]) msg.obj); - break; - } } } @@ -506,15 +494,6 @@ public abstract class NetworkAgent extends Handler { protected void preventAutomaticReconnect() { } - /** - * Install a packet filter. - * @param filter an APF program to filter incoming packets. - * @return {@code true} if filter successfully installed, {@code false} otherwise. - */ - protected boolean installPacketFilter(byte[] filter) { - return false; - } - protected void log(String s) { Log.d(LOG_TAG, "NetworkAgent: " + s); } diff --git a/core/java/android/net/NetworkMisc.java b/core/java/android/net/NetworkMisc.java index 748699eff4cf..5511a248b6aa 100644 --- a/core/java/android/net/NetworkMisc.java +++ b/core/java/android/net/NetworkMisc.java @@ -56,22 +56,6 @@ public class NetworkMisc implements Parcelable { */ public String subscriberId; - /** - * Version of APF instruction set supported for packet filtering. 0 indicates no support for - * packet filtering using APF programs. - */ - public int apfVersionSupported; - - /** - * Maximum size of APF program allowed. - */ - public int maximumApfProgramSize; - - /** - * Format of packets passed to APF filter. Should be one of ARPHRD_* - */ - public int apfPacketFormat; - public NetworkMisc() { } @@ -81,9 +65,6 @@ public class NetworkMisc implements Parcelable { explicitlySelected = nm.explicitlySelected; acceptUnvalidated = nm.acceptUnvalidated; subscriberId = nm.subscriberId; - apfVersionSupported = nm.apfVersionSupported; - maximumApfProgramSize = nm.maximumApfProgramSize; - apfPacketFormat = nm.apfPacketFormat; } } @@ -98,9 +79,6 @@ public class NetworkMisc implements Parcelable { out.writeInt(explicitlySelected ? 1 : 0); out.writeInt(acceptUnvalidated ? 1 : 0); out.writeString(subscriberId); - out.writeInt(apfVersionSupported); - out.writeInt(maximumApfProgramSize); - out.writeInt(apfPacketFormat); } public static final Creator<NetworkMisc> CREATOR = new Creator<NetworkMisc>() { @@ -111,9 +89,6 @@ public class NetworkMisc implements Parcelable { networkMisc.explicitlySelected = in.readInt() != 0; networkMisc.acceptUnvalidated = in.readInt() != 0; networkMisc.subscriberId = in.readString(); - networkMisc.apfVersionSupported = in.readInt(); - networkMisc.maximumApfProgramSize = in.readInt(); - networkMisc.apfPacketFormat = in.readInt(); return networkMisc; } |
