diff options
| author | Lorenzo Colitti <lorenzo@google.com> | 2014-10-30 13:24:39 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-10-30 13:24:40 +0000 |
| commit | 2b8d1ead4ea2ff8cb5af1ce88033a8ea0d691402 (patch) | |
| tree | bdd10babd726ebcb96e372fb396fde8a37862034 /server/InterfaceController.cpp | |
| parent | 828f8b88c78e7d7c31b098768df403e4596a91d4 (diff) | |
| parent | 0ea8ff87012f6bda41b6d2b4629d4fd0fd6f4794 (diff) | |
Merge "Add a netd interface command to disable ND offload." into lmp-mr1-dev
Diffstat (limited to 'server/InterfaceController.cpp')
| -rw-r--r-- | server/InterfaceController.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/server/InterfaceController.cpp b/server/InterfaceController.cpp index 5ef04ae8..b7a4d0b4 100644 --- a/server/InterfaceController.cpp +++ b/server/InterfaceController.cpp @@ -18,6 +18,7 @@ #define LOG_TAG "InterfaceController" #include <cutils/log.h> +#include <logwrap/logwrap.h> #include "InterfaceController.h" #include "RouteController.h" @@ -26,6 +27,8 @@ const char ipv6_proc_path[] = "/proc/sys/net/ipv6/conf"; const char sys_net_path[] = "/sys/class/net"; +const char wl_util_path[] = "/system/xbin/wlutil"; + InterfaceController::InterfaceController() { // Initial IPv6 settings. // By default, accept_ra is set to 1 (accept RAs unless forwarding is on) on all interfaces. @@ -69,6 +72,29 @@ int InterfaceController::setIPv6PrivacyExtensions(const char *interface, const i return writeIPv6ProcPath(interface, "use_tempaddr", on ? "2" : "0"); } +// Enables or disables IPv6 ND offload. This is useful for 464xlat on wifi, IPv6 tethering, and +// generally implementing IPv6 neighbour discovery and duplicate address detection properly. +// TODO: This should be implemented in wpa_supplicant via driver commands instead. +int InterfaceController::setIPv6NdOffload(char* interface, const int on) { + // Only supported on Broadcom chipsets via wlutil for now. + if (access(wl_util_path, X_OK) == 0) { + const char *argv[] = { + wl_util_path, + "-a", + interface, + "ndoe", + on ? "1" : "0" + }; + int ret = android_fork_execvp(ARRAY_SIZE(argv), const_cast<char**>(argv), NULL, + false, false); + ALOGD("%s ND offload on %s: %d (%s)", + (on ? "enabling" : "disabling"), interface, ret, strerror(errno)); + return ret; + } else { + return 0; + } +} + int InterfaceController::isInterfaceName(const char *name) { return strcmp(name, ".") && strcmp(name, "..") && |
