diff options
author | Xiaohui Chen <xiaohuic@google.com> | 2015-10-20 13:53:45 -0700 |
---|---|---|
committer | Kevin Cernekee <cernekee@google.com> | 2015-10-20 13:55:33 -0700 |
commit | 690f18a5648e292c29f17b248644e7b887c1f52c (patch) | |
tree | b42b5bb25e732c20d56377d27bea23f5bc8465fe /services | |
parent | cfea184d6c0268b92ed55276d2b686962c8ee531 (diff) | |
download | frameworks_base-690f18a5648e292c29f17b248644e7b887c1f52c.zip frameworks_base-690f18a5648e292c29f17b248644e7b887c1f52c.tar.gz frameworks_base-690f18a5648e292c29f17b248644e7b887c1f52c.tar.bz2 |
ignore initial request to disable iptable chain
iptable child chains are disabled by default. Ignore the initial
disable request so netd won't throw errors when it cannot detach chains
that do not exist.
Bug: 22800189
Change-Id: I70b4b8b9e6a5dbffe32841941922b7fd92dcd3d6
Original-Change-Id: I9312dd558ba6d59dc6aa394afeb66a222daafcf9
[cernekee: backported from master branch]
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/NetworkManagementService.java | 6 | ||||
-rw-r--r-- | services/core/java/com/android/server/net/NetworkPolicyManagerService.java | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/NetworkManagementService.java b/services/core/java/com/android/server/NetworkManagementService.java index 433f707..ba9279c 100644 --- a/services/core/java/com/android/server/NetworkManagementService.java +++ b/services/core/java/com/android/server/NetworkManagementService.java @@ -2023,9 +2023,9 @@ public class NetworkManagementService extends INetworkManagementService.Stub public void setFirewallChainEnabled(int chain, boolean enable) { enforceSystemUid(); synchronized (mQuotaLock) { - if (mFirewallChainStates.indexOfKey(chain) >= 0 && - mFirewallChainStates.get(chain) == enable) { - // All is the same, nothing to do. + if (mFirewallChainStates.get(chain, false) == enable) { + // All is the same, nothing to do. This relies on the fact that netd has child + // chains default detached. return; } mFirewallChainStates.put(chain, enable); diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java index 88e86e7..bc8957f 100644 --- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java +++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java @@ -2511,9 +2511,9 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { * Add or remove a uid to the firewall blacklist for all network ifaces. */ private void enableFirewallChainLocked(int chain, boolean enable) { - if (mFirewallChainStates.indexOfKey(chain) >= 0 && - mFirewallChainStates.get(chain) == enable) { - // All is the same, nothing to do. + if (mFirewallChainStates.get(chain, false) == enable) { + // All is the same, nothing to do. This relies on the fact that netd has child + // chains default detached. return; } mFirewallChainStates.put(chain, enable); |