Loading core/java/android/os/INetworkManagementService.aidl +0 −6 Original line number Diff line number Diff line Loading @@ -96,12 +96,6 @@ interface INetworkManagementService */ void setInterfaceIpv6NdOffload(String iface, boolean enable); /** * Retrieves the network routes currently configured on the specified * interface */ RouteInfo[] getRoutes(String iface); /** * Add the specified route to the interface. */ Loading services/core/java/com/android/server/NetworkManagementService.java +0 −75 Original line number Diff line number Diff line Loading @@ -1148,81 +1148,6 @@ public class NetworkManagementService extends INetworkManagementService.Stub return list; } @Override public RouteInfo[] getRoutes(String interfaceName) { mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG); ArrayList<RouteInfo> routes = new ArrayList<RouteInfo>(); // v4 routes listed as: // iface dest-addr gateway-addr flags refcnt use metric netmask mtu window IRTT for (String s : readRouteList("/proc/net/route")) { String[] fields = s.split("\t"); if (fields.length > 7) { String iface = fields[0]; if (interfaceName.equals(iface)) { String dest = fields[1]; String gate = fields[2]; String flags = fields[3]; // future use? String mask = fields[7]; try { // address stored as a hex string, ex: 0014A8C0 InetAddress destAddr = NetworkUtils.intToInetAddress((int)Long.parseLong(dest, 16)); int prefixLength = NetworkUtils.netmaskIntToPrefixLength( (int)Long.parseLong(mask, 16)); LinkAddress linkAddress = new LinkAddress(destAddr, prefixLength); // address stored as a hex string, ex 0014A8C0 InetAddress gatewayAddr = NetworkUtils.intToInetAddress((int)Long.parseLong(gate, 16)); RouteInfo route = new RouteInfo(linkAddress, gatewayAddr); routes.add(route); } catch (Exception e) { Log.e(TAG, "Error parsing route " + s + " : " + e); continue; } } } } // v6 routes listed as: // dest-addr prefixlength ?? ?? gateway-addr ?? ?? ?? ?? iface for (String s : readRouteList("/proc/net/ipv6_route")) { String[]fields = s.split("\\s+"); if (fields.length > 9) { String iface = fields[9].trim(); if (interfaceName.equals(iface)) { String dest = fields[0]; String prefix = fields[1]; String gate = fields[4]; try { // prefix length stored as a hex string, ex 40 int prefixLength = Integer.parseInt(prefix, 16); // address stored as a 32 char hex string // ex fe800000000000000000000000000000 InetAddress destAddr = NetworkUtils.hexToInet6Address(dest); LinkAddress linkAddress = new LinkAddress(destAddr, prefixLength); InetAddress gateAddr = NetworkUtils.hexToInet6Address(gate); RouteInfo route = new RouteInfo(linkAddress, gateAddr); routes.add(route); } catch (Exception e) { Log.e(TAG, "Error parsing route " + s + " : " + e); continue; } } } } return routes.toArray(new RouteInfo[routes.size()]); } @Override public void setMtu(String iface, int mtu) { mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG); Loading Loading
core/java/android/os/INetworkManagementService.aidl +0 −6 Original line number Diff line number Diff line Loading @@ -96,12 +96,6 @@ interface INetworkManagementService */ void setInterfaceIpv6NdOffload(String iface, boolean enable); /** * Retrieves the network routes currently configured on the specified * interface */ RouteInfo[] getRoutes(String iface); /** * Add the specified route to the interface. */ Loading
services/core/java/com/android/server/NetworkManagementService.java +0 −75 Original line number Diff line number Diff line Loading @@ -1148,81 +1148,6 @@ public class NetworkManagementService extends INetworkManagementService.Stub return list; } @Override public RouteInfo[] getRoutes(String interfaceName) { mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG); ArrayList<RouteInfo> routes = new ArrayList<RouteInfo>(); // v4 routes listed as: // iface dest-addr gateway-addr flags refcnt use metric netmask mtu window IRTT for (String s : readRouteList("/proc/net/route")) { String[] fields = s.split("\t"); if (fields.length > 7) { String iface = fields[0]; if (interfaceName.equals(iface)) { String dest = fields[1]; String gate = fields[2]; String flags = fields[3]; // future use? String mask = fields[7]; try { // address stored as a hex string, ex: 0014A8C0 InetAddress destAddr = NetworkUtils.intToInetAddress((int)Long.parseLong(dest, 16)); int prefixLength = NetworkUtils.netmaskIntToPrefixLength( (int)Long.parseLong(mask, 16)); LinkAddress linkAddress = new LinkAddress(destAddr, prefixLength); // address stored as a hex string, ex 0014A8C0 InetAddress gatewayAddr = NetworkUtils.intToInetAddress((int)Long.parseLong(gate, 16)); RouteInfo route = new RouteInfo(linkAddress, gatewayAddr); routes.add(route); } catch (Exception e) { Log.e(TAG, "Error parsing route " + s + " : " + e); continue; } } } } // v6 routes listed as: // dest-addr prefixlength ?? ?? gateway-addr ?? ?? ?? ?? iface for (String s : readRouteList("/proc/net/ipv6_route")) { String[]fields = s.split("\\s+"); if (fields.length > 9) { String iface = fields[9].trim(); if (interfaceName.equals(iface)) { String dest = fields[0]; String prefix = fields[1]; String gate = fields[4]; try { // prefix length stored as a hex string, ex 40 int prefixLength = Integer.parseInt(prefix, 16); // address stored as a 32 char hex string // ex fe800000000000000000000000000000 InetAddress destAddr = NetworkUtils.hexToInet6Address(dest); LinkAddress linkAddress = new LinkAddress(destAddr, prefixLength); InetAddress gateAddr = NetworkUtils.hexToInet6Address(gate); RouteInfo route = new RouteInfo(linkAddress, gateAddr); routes.add(route); } catch (Exception e) { Log.e(TAG, "Error parsing route " + s + " : " + e); continue; } } } } return routes.toArray(new RouteInfo[routes.size()]); } @Override public void setMtu(String iface, int mtu) { mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG); Loading