@@ -1975,8 +1975,7 @@ private void reassessPidDns(int myPid, boolean doBump)
19751975 Integer pid = (Integer )pids .get (j );
19761976 if (pid .intValue () == myPid ) {
19771977 Collection <InetAddress > dnses = p .getDnses ();
1978- String proto = determineProto (p );
1979- writePidDns (dnses , myPid , proto );
1978+ writePidDns (dnses , myPid );
19801979 if (doBump ) {
19811980 bumpDns ();
19821981 }
@@ -1986,9 +1985,6 @@ private void reassessPidDns(int myPid, boolean doBump)
19861985 }
19871986 }
19881987 // nothing found - delete
1989- if (SystemProperties .get ("net.dnsproto." + myPid ).length () != 0 ) {
1990- SystemProperties .set ("net.dnsproto." + myPid , "" );
1991- }
19921988 for (int i = 1 ; ; i ++) {
19931989 String prop = "net.dns" + i + "." + myPid ;
19941990 if (SystemProperties .get (prop ).length () == 0 ) {
@@ -2002,7 +1998,7 @@ private void reassessPidDns(int myPid, boolean doBump)
20021998 }
20031999
20042000 // return true if results in a change
2005- private boolean writePidDns (Collection <InetAddress > dnses , int pid , String proto ) {
2001+ private boolean writePidDns (Collection <InetAddress > dnses , int pid ) {
20062002 int j = 1 ;
20072003 boolean changed = false ;
20082004 for (InetAddress dns : dnses ) {
@@ -2012,11 +2008,6 @@ private boolean writePidDns(Collection <InetAddress> dnses, int pid, String prot
20122008 SystemProperties .set ("net.dns" + j ++ + "." + pid , dns .getHostAddress ());
20132009 }
20142010 }
2015- if (dnses .size () > 0 && (changed || !proto .equals (SystemProperties .get ("net.dnsproto." +
2016- pid )))) {
2017- changed = true ;
2018- SystemProperties .set ("net.dnsproto." + pid , proto );
2019- }
20202011 return changed ;
20212012 }
20222013
@@ -2047,7 +2038,7 @@ private void bumpDns() {
20472038
20482039 // Caller must grab mDnsLock.
20492040 private boolean updateDns (String network , String iface ,
2050- Collection <InetAddress > dnses , String domains , String proto ) {
2041+ Collection <InetAddress > dnses , String domains ) {
20512042 boolean changed = false ;
20522043 int last = 0 ;
20532044 if (dnses .size () == 0 && mDefaultDns != null ) {
@@ -2083,11 +2074,6 @@ private boolean updateDns(String network, String iface,
20832074 }
20842075 mNumDnsEntries = last ;
20852076
2086- if (changed || !proto .equals (SystemProperties .get ("net.dnsproto" ))) {
2087- changed = true ;
2088- SystemProperties .set ("net.dnsproto" , proto );
2089- }
2090-
20912077 if (changed ) {
20922078 try {
20932079 mNetd .setDnsServersForInterface (iface , NetworkUtils .makeStrings (dnses ));
@@ -2111,14 +2097,11 @@ private void handleDnsConfigurationChange(int netType) {
21112097 if (p == null ) return ;
21122098 Collection <InetAddress > dnses = p .getDnses ();
21132099 boolean changed = false ;
2114- String proto = determineProto (p );
2115-
21162100 if (mNetConfigs [netType ].isDefault ()) {
21172101 String network = nt .getNetworkInfo ().getTypeName ();
21182102 synchronized (mDnsLock ) {
21192103 if (!mDnsOverridden ) {
2120- changed = updateDns (network , p .getInterfaceName (), dnses , "" ,
2121- proto );
2104+ changed = updateDns (network , p .getInterfaceName (), dnses , "" );
21222105 }
21232106 }
21242107 } else {
@@ -2132,35 +2115,13 @@ private void handleDnsConfigurationChange(int netType) {
21322115 List pids = mNetRequestersPids [netType ];
21332116 for (int y =0 ; y < pids .size (); y ++) {
21342117 Integer pid = (Integer )pids .get (y );
2135- changed = writePidDns (dnses , pid .intValue (), proto );
2118+ changed = writePidDns (dnses , pid .intValue ());
21362119 }
21372120 }
21382121 if (changed ) bumpDns ();
21392122 }
21402123 }
21412124
2142- private String determineProto (LinkProperties p ) {
2143- boolean v4 = false ;
2144- boolean v6 = false ;
2145- for (RouteInfo r : p .getRoutes ()) {
2146- if (r .getDestination ().getAddress () instanceof Inet6Address ) {
2147- v6 = true ;
2148- } else {
2149- v4 = true ;
2150- }
2151- }
2152- // secondary connections often don't have routes and we infer routes
2153- // to the dns servers. Look at the dns addrs too
2154- for (InetAddress i : p .getDnses ()) {
2155- if (i instanceof Inet6Address ) {
2156- v6 = true ;
2157- } else {
2158- v4 = true ;
2159- }
2160- }
2161- return (v4 ? "v4" : "" ) + (v6 ? "v6" : "" );
2162- }
2163-
21642125 private int getRestoreDefaultNetworkDelay (int networkType ) {
21652126 String restoreDefaultNetworkDelayStr = SystemProperties .get (
21662127 NETWORK_RESTORE_DELAY_PROP_NAME );
@@ -2882,7 +2843,7 @@ public void override(List<String> dnsServers, List<String> searchDomains) {
28822843 // Apply DNS changes.
28832844 boolean changed = false ;
28842845 synchronized (mDnsLock ) {
2885- changed = updateDns ("VPN" , "VPN" , addresses , domains , "v4" );
2846+ changed = updateDns ("VPN" , "VPN" , addresses , domains );
28862847 mDnsOverridden = true ;
28872848 }
28882849 if (changed ) {
0 commit comments