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
diff --git a/server/NetworkController.h b/server/NetworkController.h
index 479af5e..f0b42c4 100644
--- a/server/NetworkController.h
+++ b/server/NetworkController.h
@@ -40,6 +40,8 @@
*/
class NetworkController {
public:
+ static const int LOCAL_NET_ID = 9;
+
NetworkController();
unsigned getDefaultNetwork() const;
@@ -53,10 +55,6 @@
unsigned getNetworkForInterface(const char* interface) const;
bool isVirtualNetwork(unsigned netId) const;
- // TODO: Remove this hack.
- unsigned getNetIdForLocalNetwork() const;
-
- int createLocalNetwork(unsigned netId) WARN_UNUSED_RESULT;
int createPhysicalNetwork(unsigned netId, Permission permission) WARN_UNUSED_RESULT;
int createVirtualNetwork(unsigned netId, bool hasDns) WARN_UNUSED_RESULT;
int destroyNetwork(unsigned netId) WARN_UNUSED_RESULT;