summaryrefslogtreecommitdiff
path: root/server/TetherController.cpp
diff options
context:
space:
mode:
authorSreeram Ramachandran <sreeram@google.com>2014-07-15 16:20:28 -0700
committerSreeram Ramachandran <sreeram@google.com>2014-07-22 11:20:55 -0700
commit87475a1471373b72ffc9f81f17dfd7884723fa86 (patch)
treeeeafaad1905e7c55db35720ed79bc86e7ba62630 /server/TetherController.cpp
parent070b2d296de30e3dbc68c21f542acb1f2914d870 (diff)
Fix WiFi-Direct and Tethering.
A LocalNetwork object now always exists in the NetworkController, with a fixed NetId that's guaranteed not to collide with NetIds created by the framework. When routes are added on an interface tracked by the LocalNetwork, they are added to a fixed "local_network" table. When NAT is enabled, we add a special "iif -> oif" tethering rule. Bug: 15413694 Bug: 15413741 Change-Id: I36effc438d5ac193a77174493bf196cb68a5b97a
Diffstat (limited to 'server/TetherController.cpp')
-rw-r--r--server/TetherController.cpp28
1 files changed, 1 insertions, 27 deletions
diff --git a/server/TetherController.cpp b/server/TetherController.cpp
index 47b620db..fbee5a2f 100644
--- a/server/TetherController.cpp
+++ b/server/TetherController.cpp
@@ -33,10 +33,8 @@
#include "NetdConstants.h"
#include "TetherController.h"
-#include "NetworkController.h"
-TetherController::TetherController(NetworkController* networkController) :
- mNetworkController(networkController) {
+TetherController::TetherController() {
mInterfaces = new InterfaceCollection();
mDnsForwarders = new NetAddressCollection();
mDaemonFd = -1;
@@ -172,17 +170,6 @@ int TetherController::startTethering(int num_addrs, struct in_addr* addrs) {
ALOGD("Tethering services running");
}
- unsigned netId = mNetworkController->getNetIdForLocalNetwork();
- if (int ret = mNetworkController->createLocalNetwork(netId)) {
- return ret;
- }
- // If any interfaces have already been configured, add them to the local network now.
- for (InterfaceCollection::iterator it = mInterfaces->begin(); it != mInterfaces->end(); ++it) {
- if (int ret = mNetworkController->addInterfaceToNetwork(netId, *it)) {
- return ret;
- }
- }
-
return 0;
}
@@ -195,9 +182,6 @@ int TetherController::stopTethering() {
ALOGD("Stopping tethering services");
- // Ignore any error.
- (void) mNetworkController->destroyNetwork(mNetworkController->getNetIdForLocalNetwork());
-
kill(mDaemonPid, SIGTERM);
waitpid(mDaemonPid, NULL, 0);
mDaemonPid = 0;
@@ -307,10 +291,6 @@ int TetherController::tetherInterface(const char *interface) {
}
return -1;
} else {
- if (isTetheringStarted()) {
- unsigned netId = mNetworkController->getNetIdForLocalNetwork();
- return mNetworkController->addInterfaceToNetwork(netId, interface);
- }
return 0;
}
}
@@ -320,12 +300,6 @@ int TetherController::untetherInterface(const char *interface) {
ALOGD("untetherInterface(%s)", interface);
- if (isTetheringStarted()) {
- unsigned netId = mNetworkController->getNetIdForLocalNetwork();
- // Ignore any error.
- (void) mNetworkController->removeInterfaceFromNetwork(netId, interface);
- }
-
for (it = mInterfaces->begin(); it != mInterfaces->end(); ++it) {
if (!strcmp(interface, *it)) {
free(*it);