diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2017-10-26 20:01:53 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2017-10-26 20:01:53 +0000 |
commit | cb160d358263b4cd5aca3d54521355a6737828a2 (patch) | |
tree | 2d24c746657f5ee9af2c6883090960c0e8b16ba3 | |
parent | 6748cd1da405363f1f092190a35d04a2e2165b1b (diff) | |
parent | a237dedb06fa6dba167841e494e3fc0e77f21941 (diff) | |
download | netd-oreo-m6-s3-release.tar.gz |
Snap for 4417144 from a237dedb06fa6dba167841e494e3fc0e77f21941 to oc-m2-releaseandroid-8.1.0_r8android-8.1.0_r52android-8.1.0_r50android-8.1.0_r47android-8.1.0_r46android-8.1.0_r43android-8.1.0_r41android-8.1.0_r36android-8.1.0_r35android-8.1.0_r33android-8.1.0_r30android-8.1.0_r26android-8.1.0_r25android-8.1.0_r20android-8.1.0_r2oreo-m7-releaseoreo-m6-s4-releaseoreo-m6-s3-releaseoreo-m6-s2-releaseoreo-m2-s5-releaseoreo-m2-s4-releaseoreo-m2-s3-releaseoreo-m2-s2-releaseoreo-m2-s1-releaseoreo-m2-release
Change-Id: Iea4ad51b195c2830b5d7908170590ddc318d571a
-rw-r--r-- | server/TetherController.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/server/TetherController.cpp b/server/TetherController.cpp index 1785ec71..43a20486 100644 --- a/server/TetherController.cpp +++ b/server/TetherController.cpp @@ -45,6 +45,7 @@ const char BP_TOOLS_MODE[] = "bp-tools"; const char IPV4_FORWARDING_PROC_FILE[] = "/proc/sys/net/ipv4/ip_forward"; const char IPV6_FORWARDING_PROC_FILE[] = "/proc/sys/net/ipv6/conf/all/forwarding"; const char SEPARATOR[] = "|"; +constexpr const char kTcpBeLiberal[] = "/proc/sys/net/netfilter/nf_conntrack_tcp_be_liberal"; bool writeToFile(const char* filename, const char* value) { int fd = open(filename, O_WRONLY | O_CLOEXEC); @@ -63,6 +64,11 @@ bool writeToFile(const char* filename, const char* value) { return true; } +// TODO: Consider altering TCP and UDP timeouts as well. +void configureForTethering(bool enabled) { + writeToFile(kTcpBeLiberal, enabled ? "1" : "0"); +} + bool configureForIPv6Router(const char *interface) { return (InterfaceController::setEnableIPv6(interface, 0) == 0) && (InterfaceController::setAcceptIPv6Ra(interface, 0) == 0) @@ -211,6 +217,7 @@ int TetherController::startTethering(int num_addrs, char **dhcp_ranges) { close(pipefd[0]); mDaemonPid = pid; mDaemonFd = pipefd[1]; + configureForTethering(true); applyDnsInterfaces(); ALOGD("Tethering services running"); } @@ -219,6 +226,7 @@ int TetherController::startTethering(int num_addrs, char **dhcp_ranges) { } int TetherController::stopTethering() { + configureForTethering(false); if (mDaemonPid == 0) { ALOGE("Tethering already stopped"); |