Setup interfaces for IPv6 tethering
Including:
- set the interface for router mode (accept_ra = 0)
- reset the interface for client mode (accept_ra = 1)
- InterfaceController::setAcceptIPv6Ra()
- InterfaceController::setAcceptIPv6Dad()
- make InterfaceController static
- refactor for more modern C++ usage here and there
- sporadic style guide fixes
Bug: 9580643
Change-Id: Ia557c8770e18c58b12ad16d982c63b6ebd525516
diff --git a/server/TetherController.h b/server/TetherController.h
index 0aa19f2..6035c25 100644
--- a/server/TetherController.h
+++ b/server/TetherController.h
@@ -23,18 +23,17 @@
#include <set>
#include <string>
-typedef std::list<char *> InterfaceCollection;
-typedef std::list<std::string> NetAddressCollection;
class TetherController {
- InterfaceCollection *mInterfaces;
+private:
+ std::list<std::string> mInterfaces;
// NetId to use for forwarded DNS queries. This may not be the default
// network, e.g., in the case where we are tethering to a DUN APN.
- unsigned mDnsNetId;
- NetAddressCollection *mDnsForwarders;
- pid_t mDaemonPid;
- int mDaemonFd;
- std::set<std::string> mForwardingRequests;
+ unsigned mDnsNetId;
+ std::list<std::string> mDnsForwarders;
+ pid_t mDaemonPid;
+ int mDaemonFd;
+ std::set<std::string> mForwardingRequests;
public:
TetherController();
@@ -50,14 +49,14 @@
unsigned getDnsNetId();
int setDnsForwarders(unsigned netId, char **servers, int numServers);
- NetAddressCollection *getDnsForwarders();
+ const std::list<std::string> &getDnsForwarders() const;
int tetherInterface(const char *interface);
int untetherInterface(const char *interface);
- InterfaceCollection *getTetheredInterfaceList();
+ const std::list<std::string> &getTetheredInterfaceList() const;
private:
- int applyDnsInterfaces();
+ bool applyDnsInterfaces();
bool setIpFwdEnabled();
};