From 2d3f03d7fb5d955cd16d4152c8767c7974ebb54e Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Fri, 7 Feb 2014 03:52:12 -0800 Subject: [PATCH] DO NOT MERGE Sanitize WifiConfigs Do this both on input from apps (giving error) and between wifi and ConnectivityService (ignoring bad data). This means removing all addresses beyond the first and all routes but the first default and the implied direct-connect routes. We do this because the user can't monitor the others (no UI), their support wasn't intended, they allow redirection of all traffic without user knowledge and they allow circumvention of legacy VPNs. This should not move forward from JB as it breaks IPv6 and K has a more resilient VPN. Bug:12663469 Change-Id: I0d92db7efc30a1bb3e5b8c6e5595bdb9793a16f2 Conflicts: core/java/android/net/LinkProperties.java services/java/com/android/server/WifiService.java wifi/java/android/net/wifi/WifiStateMachine.java --- core/java/android/net/LinkProperties.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/core/java/android/net/LinkProperties.java b/core/java/android/net/LinkProperties.java index 75f8b5948b..dc9a54f8ea 100644 --- a/core/java/android/net/LinkProperties.java +++ b/core/java/android/net/LinkProperties.java @@ -144,6 +144,16 @@ public class LinkProperties implements Parcelable { return Collections.unmodifiableCollection(mLinkAddresses); } + /** + * Replaces the LinkAddresses on this link with the given collection of addresses + */ + public void setLinkAddresses(Collection addresses) { + mLinkAddresses.clear(); + for (LinkAddress address: addresses) { + addLinkAddress(address); + } + } + public void addDns(InetAddress dns) { if (dns != null) mDnses.add(dns); } @@ -198,6 +208,16 @@ public class LinkProperties implements Parcelable { return routes; } + /** + * Replaces the RouteInfos on this link with the given collection of RouteInfos. + */ + public void setRoutes(Collection routes) { + mRoutes.clear(); + for (RouteInfo route : routes) { + addRoute(route); + } + } + public void setHttpProxy(ProxyProperties proxy) { mHttpProxy = proxy; }