Loading core/java/android/net/ConnectivityManager.java +25 −1 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,9 @@ import android.annotation.SdkConstant.SdkConstantType; import android.os.Binder; import android.os.Binder; import android.os.RemoteException; import android.os.RemoteException; import java.net.InetAddress; import java.net.UnknownHostException; /** /** * Class that answers queries about the state of network connectivity. It also * Class that answers queries about the state of network connectivity. It also * notifies applications when network connectivity changes. Get an instance * notifies applications when network connectivity changes. Get an instance Loading Loading @@ -309,8 +312,29 @@ public class ConnectivityManager * @return {@code true} on success, {@code false} on failure * @return {@code true} on success, {@code false} on failure */ */ public boolean requestRouteToHost(int networkType, int hostAddress) { public boolean requestRouteToHost(int networkType, int hostAddress) { InetAddress inetAddress = NetworkUtils.intToInetAddress(hostAddress); if (inetAddress == null) { return false; } return requestRouteToHostAddress(networkType, inetAddress); } /** * Ensure that a network route exists to deliver traffic to the specified * host via the specified network interface. An attempt to add a route that * already exists is ignored, but treated as successful. * @param networkType the type of the network over which traffic to the specified * host is to be routed * @param hostAddress the IP address of the host to which the route is desired * @return {@code true} on success, {@code false} on failure * @hide */ public boolean requestRouteToHostAddress(int networkType, InetAddress hostAddress) { byte[] address = hostAddress.getAddress(); try { try { return mService.requestRouteToHost(networkType, hostAddress); return mService.requestRouteToHostAddress(networkType, address); } catch (RemoteException e) { } catch (RemoteException e) { return false; return false; } } Loading core/java/android/net/IConnectivityManager.aidl +2 −0 Original line number Original line Diff line number Diff line Loading @@ -47,6 +47,8 @@ interface IConnectivityManager boolean requestRouteToHost(int networkType, int hostAddress); boolean requestRouteToHost(int networkType, int hostAddress); boolean requestRouteToHostAddress(int networkType, in byte[] hostAddress); boolean getBackgroundDataSetting(); boolean getBackgroundDataSetting(); void setBackgroundDataSetting(boolean allowBackgroundData); void setBackgroundDataSetting(boolean allowBackgroundData); Loading core/java/android/net/MobileDataStateTracker.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.net; package android.net; import java.net.InetAddress; import android.content.BroadcastReceiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.Intent; Loading core/java/android/net/NetworkUtils.java +91 −48 Original line number Original line Diff line number Diff line Loading @@ -17,50 +17,44 @@ package android.net; package android.net; import java.net.InetAddress; import java.net.InetAddress; import java.net.Inet4Address; import java.net.Inet6Address; import java.net.UnknownHostException; import java.net.UnknownHostException; import android.util.Log; /** /** * Native methods for managing network interfaces. * Native methods for managing network interfaces. * * * {@hide} * {@hide} */ */ public class NetworkUtils { public class NetworkUtils { private static final String TAG = "NetworkUtils"; /** Bring the named network interface up. */ /** Bring the named network interface up. */ public native static int enableInterface(String interfaceName); public native static int enableInterface(String interfaceName); /** Bring the named network interface down. */ /** Bring the named network interface down. */ public native static int disableInterface(String interfaceName); public native static int disableInterface(String interfaceName); /** Add a route to the specified host via the named interface. */ /** public static int addHostRoute(String interfaceName, InetAddress hostaddr) { * Add a route to the routing table. int v4Int = v4StringToInt(hostaddr.getHostAddress()); * if (v4Int != 0) { * @param interfaceName the interface to route through. return addHostRouteNative(interfaceName, v4Int); * @param dst the network or host to route to. May be IPv4 or IPv6, e.g. } else { * "0.0.0.0" or "2001:4860::". return -1; * @param prefixLength the prefix length of the route. } * @param gw the gateway to use, e.g., "192.168.251.1". If null, } * indicates a directly-connected route. private native static int addHostRouteNative(String interfaceName, int hostaddr); */ public native static int addRoute(String interfaceName, String dst, /** Add a default route for the named interface. */ int prefixLength, String gw); public static int setDefaultRoute(String interfaceName, InetAddress gwayAddr) { int v4Int = v4StringToInt(gwayAddr.getHostAddress()); if (v4Int != 0) { return setDefaultRouteNative(interfaceName, v4Int); } else { return -1; } } private native static int setDefaultRouteNative(String interfaceName, int hostaddr); /** Return the gateway address for the default route for the named interface. */ /** Return the gateway address for the default route for the named interface. */ public static InetAddress getDefaultRoute(String interfaceName) { public static InetAddress getDefaultRoute(String interfaceName) { int addr = getDefaultRouteNative(interfaceName); int addr = getDefaultRouteNative(interfaceName); try { return intToInetAddress(addr); return InetAddress.getByAddress(v4IntToArray(addr)); } catch (UnknownHostException e) { return null; } } } private native static int getDefaultRouteNative(String interfaceName); private native static int getDefaultRouteNative(String interfaceName); Loading Loading @@ -129,30 +123,79 @@ public class NetworkUtils { private native static boolean configureNative( private native static boolean configureNative( String interfaceName, int ipAddress, int netmask, int gateway, int dns1, int dns2); String interfaceName, int ipAddress, int netmask, int gateway, int dns1, int dns2); // The following two functions are glue to tie the old int-based address scheme /** // to the new InetAddress scheme. They should go away when we go fully to InetAddress * Convert a IPv4 address from an integer to an InetAddress. // TODO - remove when we switch fully to InetAddress * @param hostAddr is an Int corresponding to the IPv4 address in network byte order public static byte[] v4IntToArray(int addr) { * @return the IP address as an {@code InetAddress}, returns null if byte[] addrBytes = new byte[4]; * unable to convert or if the int is an invalid address. addrBytes[0] = (byte)(addr & 0xff); */ addrBytes[1] = (byte)((addr >> 8) & 0xff); public static InetAddress intToInetAddress(int hostAddress) { addrBytes[2] = (byte)((addr >> 16) & 0xff); InetAddress inetAddress; addrBytes[3] = (byte)((addr >> 24) & 0xff); byte[] addressBytes = { (byte)(0xff & hostAddress), return addrBytes; (byte)(0xff & (hostAddress >> 8)), } (byte)(0xff & (hostAddress >> 16)), (byte)(0xff & (hostAddress >> 24)) }; public static int v4StringToInt(String str) { int result = 0; String[] array = str.split("\\."); if (array.length != 4) return 0; try { try { result = Integer.parseInt(array[3]); inetAddress = InetAddress.getByAddress(addressBytes); result = (result << 8) + Integer.parseInt(array[2]); } catch(UnknownHostException e) { result = (result << 8) + Integer.parseInt(array[1]); return null; result = (result << 8) + Integer.parseInt(array[0]); } } catch (NumberFormatException e) { return 0; return inetAddress; } /** * Add a default route through the specified gateway. * @param interfaceName interface on which the route should be added * @param gw the IP address of the gateway to which the route is desired, * @return {@code true} on success, {@code false} on failure */ public static boolean addDefaultRoute(String interfaceName, InetAddress gw) { String dstStr; String gwStr = gw.getHostAddress(); if (gw instanceof Inet4Address) { dstStr = "0.0.0.0"; } else if (gw instanceof Inet6Address) { dstStr = "::"; } else { Log.w(TAG, "addDefaultRoute failure: address is neither IPv4 nor IPv6" + "(" + gwStr + ")"); return false; } return addRoute(interfaceName, dstStr, 0, gwStr) == 0; } /** * Add a host route. * @param interfaceName interface on which the route should be added * @param dst the IP address of the host to which the route is desired, * this should not be null. * @param gw the IP address of the gateway to which the route is desired, * if null, indicates a directly-connected route. * @return {@code true} on success, {@code false} on failure */ public static boolean addHostRoute(String interfaceName, InetAddress dst, InetAddress gw) { if (dst == null) { Log.w(TAG, "addHostRoute: dst should not be null"); return false; } int prefixLength; String dstStr = dst.getHostAddress(); String gwStr = (gw != null) ? gw.getHostAddress() : null; if (dst instanceof Inet4Address) { prefixLength = 32; } else if (dst instanceof Inet6Address) { prefixLength = 128; } else { Log.w(TAG, "addHostRoute failure: address is neither IPv4 nor IPv6" + "(" + dst + ")"); return false; } } return result; return addRoute(interfaceName, dstStr, prefixLength, gwStr) == 0; } } } } core/jni/android_net_NetUtils.cpp +17 −17 Original line number Original line Diff line number Diff line Loading @@ -25,9 +25,8 @@ extern "C" { extern "C" { int ifc_enable(const char *ifname); int ifc_enable(const char *ifname); int ifc_disable(const char *ifname); int ifc_disable(const char *ifname); int ifc_add_host_route(const char *ifname, uint32_t addr); int ifc_add_route(const char *ifname, const char *destStr, uint32_t prefixLen, const char *gwStr); int ifc_remove_host_routes(const char *ifname); int ifc_remove_host_routes(const char *ifname); int ifc_set_default_route(const char *ifname, uint32_t gateway); int ifc_get_default_route(const char *ifname); int ifc_get_default_route(const char *ifname); int ifc_remove_default_route(const char *ifname); int ifc_remove_default_route(const char *ifname); int ifc_reset_connections(const char *ifname); int ifc_reset_connections(const char *ifname); Loading Loading @@ -87,13 +86,23 @@ static jint android_net_utils_disableInterface(JNIEnv* env, jobject clazz, jstri return (jint)result; return (jint)result; } } static jint android_net_utils_addHostRoute(JNIEnv* env, jobject clazz, jstring ifname, jint addr) static jint android_net_utils_addRoute(JNIEnv* env, jobject clazz, jstring ifname, jstring dst, jint prefixLength, jstring gw) { { int result; int result; const char *nameStr = env->GetStringUTFChars(ifname, NULL); const char *nameStr = env->GetStringUTFChars(ifname, NULL); result = ::ifc_add_host_route(nameStr, addr); const char *dstStr = env->GetStringUTFChars(dst, NULL); const char *gwStr = NULL; if (gw != NULL) { gwStr = env->GetStringUTFChars(gw, NULL); } result = ::ifc_add_route(nameStr, dstStr, prefixLength, gwStr); env->ReleaseStringUTFChars(ifname, nameStr); env->ReleaseStringUTFChars(ifname, nameStr); env->ReleaseStringUTFChars(dst, dstStr); if (gw != NULL) { env->ReleaseStringUTFChars(gw, gwStr); } return (jint)result; return (jint)result; } } Loading @@ -107,16 +116,6 @@ static jint android_net_utils_removeHostRoutes(JNIEnv* env, jobject clazz, jstri return (jint)result; return (jint)result; } } static jint android_net_utils_setDefaultRoute(JNIEnv* env, jobject clazz, jstring ifname, jint gateway) { int result; const char *nameStr = env->GetStringUTFChars(ifname, NULL); result = ::ifc_set_default_route(nameStr, gateway); env->ReleaseStringUTFChars(ifname, nameStr); return (jint)result; } static jint android_net_utils_getDefaultRoute(JNIEnv* env, jobject clazz, jstring ifname) static jint android_net_utils_getDefaultRoute(JNIEnv* env, jobject clazz, jstring ifname) { { int result; int result; Loading Loading @@ -222,10 +221,11 @@ static JNINativeMethod gNetworkUtilMethods[] = { { "enableInterface", "(Ljava/lang/String;)I", (void *)android_net_utils_enableInterface }, { "enableInterface", "(Ljava/lang/String;)I", (void *)android_net_utils_enableInterface }, { "disableInterface", "(Ljava/lang/String;)I", (void *)android_net_utils_disableInterface }, { "disableInterface", "(Ljava/lang/String;)I", (void *)android_net_utils_disableInterface }, { "addHostRouteNative", "(Ljava/lang/String;I)I", (void *)android_net_utils_addHostRoute }, { "addRoute", "(Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;)I", (void *)android_net_utils_addRoute }, { "removeHostRoutes", "(Ljava/lang/String;)I", (void *)android_net_utils_removeHostRoutes }, { "removeHostRoutes", "(Ljava/lang/String;)I", (void *)android_net_utils_removeHostRoutes }, { "setDefaultRouteNative", "(Ljava/lang/String;I)I", (void *)android_net_utils_setDefaultRoute }, { "getDefaultRouteNative", "(Ljava/lang/String;)I", { "getDefaultRouteNative", "(Ljava/lang/String;)I", (void *)android_net_utils_getDefaultRoute }, (void *)android_net_utils_getDefaultRoute }, { "removeDefaultRoute", "(Ljava/lang/String;)I", (void *)android_net_utils_removeDefaultRoute }, { "removeDefaultRoute", "(Ljava/lang/String;)I", (void *)android_net_utils_removeDefaultRoute }, { "resetConnections", "(Ljava/lang/String;)I", (void *)android_net_utils_resetConnections }, { "resetConnections", "(Ljava/lang/String;)I", (void *)android_net_utils_resetConnections }, { "runDhcp", "(Ljava/lang/String;Landroid/net/DhcpInfo;)Z", (void *)android_net_utils_runDhcp }, { "runDhcp", "(Ljava/lang/String;Landroid/net/DhcpInfo;)Z", (void *)android_net_utils_runDhcp }, Loading Loading
core/java/android/net/ConnectivityManager.java +25 −1 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,9 @@ import android.annotation.SdkConstant.SdkConstantType; import android.os.Binder; import android.os.Binder; import android.os.RemoteException; import android.os.RemoteException; import java.net.InetAddress; import java.net.UnknownHostException; /** /** * Class that answers queries about the state of network connectivity. It also * Class that answers queries about the state of network connectivity. It also * notifies applications when network connectivity changes. Get an instance * notifies applications when network connectivity changes. Get an instance Loading Loading @@ -309,8 +312,29 @@ public class ConnectivityManager * @return {@code true} on success, {@code false} on failure * @return {@code true} on success, {@code false} on failure */ */ public boolean requestRouteToHost(int networkType, int hostAddress) { public boolean requestRouteToHost(int networkType, int hostAddress) { InetAddress inetAddress = NetworkUtils.intToInetAddress(hostAddress); if (inetAddress == null) { return false; } return requestRouteToHostAddress(networkType, inetAddress); } /** * Ensure that a network route exists to deliver traffic to the specified * host via the specified network interface. An attempt to add a route that * already exists is ignored, but treated as successful. * @param networkType the type of the network over which traffic to the specified * host is to be routed * @param hostAddress the IP address of the host to which the route is desired * @return {@code true} on success, {@code false} on failure * @hide */ public boolean requestRouteToHostAddress(int networkType, InetAddress hostAddress) { byte[] address = hostAddress.getAddress(); try { try { return mService.requestRouteToHost(networkType, hostAddress); return mService.requestRouteToHostAddress(networkType, address); } catch (RemoteException e) { } catch (RemoteException e) { return false; return false; } } Loading
core/java/android/net/IConnectivityManager.aidl +2 −0 Original line number Original line Diff line number Diff line Loading @@ -47,6 +47,8 @@ interface IConnectivityManager boolean requestRouteToHost(int networkType, int hostAddress); boolean requestRouteToHost(int networkType, int hostAddress); boolean requestRouteToHostAddress(int networkType, in byte[] hostAddress); boolean getBackgroundDataSetting(); boolean getBackgroundDataSetting(); void setBackgroundDataSetting(boolean allowBackgroundData); void setBackgroundDataSetting(boolean allowBackgroundData); Loading
core/java/android/net/MobileDataStateTracker.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.net; package android.net; import java.net.InetAddress; import android.content.BroadcastReceiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.Intent; Loading
core/java/android/net/NetworkUtils.java +91 −48 Original line number Original line Diff line number Diff line Loading @@ -17,50 +17,44 @@ package android.net; package android.net; import java.net.InetAddress; import java.net.InetAddress; import java.net.Inet4Address; import java.net.Inet6Address; import java.net.UnknownHostException; import java.net.UnknownHostException; import android.util.Log; /** /** * Native methods for managing network interfaces. * Native methods for managing network interfaces. * * * {@hide} * {@hide} */ */ public class NetworkUtils { public class NetworkUtils { private static final String TAG = "NetworkUtils"; /** Bring the named network interface up. */ /** Bring the named network interface up. */ public native static int enableInterface(String interfaceName); public native static int enableInterface(String interfaceName); /** Bring the named network interface down. */ /** Bring the named network interface down. */ public native static int disableInterface(String interfaceName); public native static int disableInterface(String interfaceName); /** Add a route to the specified host via the named interface. */ /** public static int addHostRoute(String interfaceName, InetAddress hostaddr) { * Add a route to the routing table. int v4Int = v4StringToInt(hostaddr.getHostAddress()); * if (v4Int != 0) { * @param interfaceName the interface to route through. return addHostRouteNative(interfaceName, v4Int); * @param dst the network or host to route to. May be IPv4 or IPv6, e.g. } else { * "0.0.0.0" or "2001:4860::". return -1; * @param prefixLength the prefix length of the route. } * @param gw the gateway to use, e.g., "192.168.251.1". If null, } * indicates a directly-connected route. private native static int addHostRouteNative(String interfaceName, int hostaddr); */ public native static int addRoute(String interfaceName, String dst, /** Add a default route for the named interface. */ int prefixLength, String gw); public static int setDefaultRoute(String interfaceName, InetAddress gwayAddr) { int v4Int = v4StringToInt(gwayAddr.getHostAddress()); if (v4Int != 0) { return setDefaultRouteNative(interfaceName, v4Int); } else { return -1; } } private native static int setDefaultRouteNative(String interfaceName, int hostaddr); /** Return the gateway address for the default route for the named interface. */ /** Return the gateway address for the default route for the named interface. */ public static InetAddress getDefaultRoute(String interfaceName) { public static InetAddress getDefaultRoute(String interfaceName) { int addr = getDefaultRouteNative(interfaceName); int addr = getDefaultRouteNative(interfaceName); try { return intToInetAddress(addr); return InetAddress.getByAddress(v4IntToArray(addr)); } catch (UnknownHostException e) { return null; } } } private native static int getDefaultRouteNative(String interfaceName); private native static int getDefaultRouteNative(String interfaceName); Loading Loading @@ -129,30 +123,79 @@ public class NetworkUtils { private native static boolean configureNative( private native static boolean configureNative( String interfaceName, int ipAddress, int netmask, int gateway, int dns1, int dns2); String interfaceName, int ipAddress, int netmask, int gateway, int dns1, int dns2); // The following two functions are glue to tie the old int-based address scheme /** // to the new InetAddress scheme. They should go away when we go fully to InetAddress * Convert a IPv4 address from an integer to an InetAddress. // TODO - remove when we switch fully to InetAddress * @param hostAddr is an Int corresponding to the IPv4 address in network byte order public static byte[] v4IntToArray(int addr) { * @return the IP address as an {@code InetAddress}, returns null if byte[] addrBytes = new byte[4]; * unable to convert or if the int is an invalid address. addrBytes[0] = (byte)(addr & 0xff); */ addrBytes[1] = (byte)((addr >> 8) & 0xff); public static InetAddress intToInetAddress(int hostAddress) { addrBytes[2] = (byte)((addr >> 16) & 0xff); InetAddress inetAddress; addrBytes[3] = (byte)((addr >> 24) & 0xff); byte[] addressBytes = { (byte)(0xff & hostAddress), return addrBytes; (byte)(0xff & (hostAddress >> 8)), } (byte)(0xff & (hostAddress >> 16)), (byte)(0xff & (hostAddress >> 24)) }; public static int v4StringToInt(String str) { int result = 0; String[] array = str.split("\\."); if (array.length != 4) return 0; try { try { result = Integer.parseInt(array[3]); inetAddress = InetAddress.getByAddress(addressBytes); result = (result << 8) + Integer.parseInt(array[2]); } catch(UnknownHostException e) { result = (result << 8) + Integer.parseInt(array[1]); return null; result = (result << 8) + Integer.parseInt(array[0]); } } catch (NumberFormatException e) { return 0; return inetAddress; } /** * Add a default route through the specified gateway. * @param interfaceName interface on which the route should be added * @param gw the IP address of the gateway to which the route is desired, * @return {@code true} on success, {@code false} on failure */ public static boolean addDefaultRoute(String interfaceName, InetAddress gw) { String dstStr; String gwStr = gw.getHostAddress(); if (gw instanceof Inet4Address) { dstStr = "0.0.0.0"; } else if (gw instanceof Inet6Address) { dstStr = "::"; } else { Log.w(TAG, "addDefaultRoute failure: address is neither IPv4 nor IPv6" + "(" + gwStr + ")"); return false; } return addRoute(interfaceName, dstStr, 0, gwStr) == 0; } /** * Add a host route. * @param interfaceName interface on which the route should be added * @param dst the IP address of the host to which the route is desired, * this should not be null. * @param gw the IP address of the gateway to which the route is desired, * if null, indicates a directly-connected route. * @return {@code true} on success, {@code false} on failure */ public static boolean addHostRoute(String interfaceName, InetAddress dst, InetAddress gw) { if (dst == null) { Log.w(TAG, "addHostRoute: dst should not be null"); return false; } int prefixLength; String dstStr = dst.getHostAddress(); String gwStr = (gw != null) ? gw.getHostAddress() : null; if (dst instanceof Inet4Address) { prefixLength = 32; } else if (dst instanceof Inet6Address) { prefixLength = 128; } else { Log.w(TAG, "addHostRoute failure: address is neither IPv4 nor IPv6" + "(" + dst + ")"); return false; } } return result; return addRoute(interfaceName, dstStr, prefixLength, gwStr) == 0; } } } }
core/jni/android_net_NetUtils.cpp +17 −17 Original line number Original line Diff line number Diff line Loading @@ -25,9 +25,8 @@ extern "C" { extern "C" { int ifc_enable(const char *ifname); int ifc_enable(const char *ifname); int ifc_disable(const char *ifname); int ifc_disable(const char *ifname); int ifc_add_host_route(const char *ifname, uint32_t addr); int ifc_add_route(const char *ifname, const char *destStr, uint32_t prefixLen, const char *gwStr); int ifc_remove_host_routes(const char *ifname); int ifc_remove_host_routes(const char *ifname); int ifc_set_default_route(const char *ifname, uint32_t gateway); int ifc_get_default_route(const char *ifname); int ifc_get_default_route(const char *ifname); int ifc_remove_default_route(const char *ifname); int ifc_remove_default_route(const char *ifname); int ifc_reset_connections(const char *ifname); int ifc_reset_connections(const char *ifname); Loading Loading @@ -87,13 +86,23 @@ static jint android_net_utils_disableInterface(JNIEnv* env, jobject clazz, jstri return (jint)result; return (jint)result; } } static jint android_net_utils_addHostRoute(JNIEnv* env, jobject clazz, jstring ifname, jint addr) static jint android_net_utils_addRoute(JNIEnv* env, jobject clazz, jstring ifname, jstring dst, jint prefixLength, jstring gw) { { int result; int result; const char *nameStr = env->GetStringUTFChars(ifname, NULL); const char *nameStr = env->GetStringUTFChars(ifname, NULL); result = ::ifc_add_host_route(nameStr, addr); const char *dstStr = env->GetStringUTFChars(dst, NULL); const char *gwStr = NULL; if (gw != NULL) { gwStr = env->GetStringUTFChars(gw, NULL); } result = ::ifc_add_route(nameStr, dstStr, prefixLength, gwStr); env->ReleaseStringUTFChars(ifname, nameStr); env->ReleaseStringUTFChars(ifname, nameStr); env->ReleaseStringUTFChars(dst, dstStr); if (gw != NULL) { env->ReleaseStringUTFChars(gw, gwStr); } return (jint)result; return (jint)result; } } Loading @@ -107,16 +116,6 @@ static jint android_net_utils_removeHostRoutes(JNIEnv* env, jobject clazz, jstri return (jint)result; return (jint)result; } } static jint android_net_utils_setDefaultRoute(JNIEnv* env, jobject clazz, jstring ifname, jint gateway) { int result; const char *nameStr = env->GetStringUTFChars(ifname, NULL); result = ::ifc_set_default_route(nameStr, gateway); env->ReleaseStringUTFChars(ifname, nameStr); return (jint)result; } static jint android_net_utils_getDefaultRoute(JNIEnv* env, jobject clazz, jstring ifname) static jint android_net_utils_getDefaultRoute(JNIEnv* env, jobject clazz, jstring ifname) { { int result; int result; Loading Loading @@ -222,10 +221,11 @@ static JNINativeMethod gNetworkUtilMethods[] = { { "enableInterface", "(Ljava/lang/String;)I", (void *)android_net_utils_enableInterface }, { "enableInterface", "(Ljava/lang/String;)I", (void *)android_net_utils_enableInterface }, { "disableInterface", "(Ljava/lang/String;)I", (void *)android_net_utils_disableInterface }, { "disableInterface", "(Ljava/lang/String;)I", (void *)android_net_utils_disableInterface }, { "addHostRouteNative", "(Ljava/lang/String;I)I", (void *)android_net_utils_addHostRoute }, { "addRoute", "(Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;)I", (void *)android_net_utils_addRoute }, { "removeHostRoutes", "(Ljava/lang/String;)I", (void *)android_net_utils_removeHostRoutes }, { "removeHostRoutes", "(Ljava/lang/String;)I", (void *)android_net_utils_removeHostRoutes }, { "setDefaultRouteNative", "(Ljava/lang/String;I)I", (void *)android_net_utils_setDefaultRoute }, { "getDefaultRouteNative", "(Ljava/lang/String;)I", { "getDefaultRouteNative", "(Ljava/lang/String;)I", (void *)android_net_utils_getDefaultRoute }, (void *)android_net_utils_getDefaultRoute }, { "removeDefaultRoute", "(Ljava/lang/String;)I", (void *)android_net_utils_removeDefaultRoute }, { "removeDefaultRoute", "(Ljava/lang/String;)I", (void *)android_net_utils_removeDefaultRoute }, { "resetConnections", "(Ljava/lang/String;)I", (void *)android_net_utils_resetConnections }, { "resetConnections", "(Ljava/lang/String;)I", (void *)android_net_utils_resetConnections }, { "runDhcp", "(Ljava/lang/String;Landroid/net/DhcpInfo;)Z", (void *)android_net_utils_runDhcp }, { "runDhcp", "(Ljava/lang/String;Landroid/net/DhcpInfo;)Z", (void *)android_net_utils_runDhcp }, Loading