const char ipv6_proc_path[] = "/proc/sys/net/ipv6/conf";
+const char ipv4_neigh_conf_dir[] = "/proc/sys/net/ipv4/neigh";
+
+const char ipv6_neigh_conf_dir[] = "/proc/sys/net/ipv6/neigh";
+
const char sys_net_path[] = "/sys/class/net";
const char wl_util_path[] = "/system/xbin/wlutil";
// Enable optimistic DAD for IPv6 addresses on all interfaces.
setIPv6OptimisticMode("1");
+
+ // Reduce the ARP/ND base reachable time from the default (30sec) to 15sec.
+ setBaseReachableTimeMs(15 * 1000);
}
InterfaceController::~InterfaceController() {
return writeValueToPath(sys_net_path, interface, "mtu", mtu);
}
+void InterfaceController::setBaseReachableTimeMs(unsigned int millis) {
+ std::string value(StringPrintf("%u", millis));
+ setOnAllInterfaces(ipv4_neigh_conf_dir, "base_reachable_time_ms", value.c_str());
+ setOnAllInterfaces(ipv6_neigh_conf_dir, "base_reachable_time_ms", value.c_str());
+}
+
void InterfaceController::setIPv6OptimisticMode(const char *value) {
setOnAllInterfaces(ipv6_proc_path, "optimistic_dad", value);
setOnAllInterfaces(ipv6_proc_path, "use_optimistic", value);