Merge "VPN: correct the netmask for IPv4."
diff --git a/services/jni/com_android_server_connectivity_Vpn.cpp b/services/jni/com_android_server_connectivity_Vpn.cpp
index a0ea92b..62d7636 100644
--- a/services/jni/com_android_server_connectivity_Vpn.cpp
+++ b/services/jni/com_android_server_connectivity_Vpn.cpp
@@ -244,7 +244,7 @@
break;
}
- in_addr_t mask = prefix ? (~0 << (32 - prefix)) : 1;
+ in_addr_t mask = prefix ? (~0 << (32 - prefix)) : 0x80000000;
*as_in_addr(&rt4.rt_genmask) = htonl(mask);
if (ioctl(inet4, SIOCADDRT, &rt4) && errno != EEXIST) {
count = (errno == EINVAL) ? BAD_ARGUMENT : SYSTEM_ERROR;
@@ -394,7 +394,7 @@
}
count = set_routes(name, routes);
if (count < 0) {
- throwException(env, count, "Cannot set address");
+ throwException(env, count, "Cannot set route");
count = -1;
}