Add full support for UIDs in VPNs.
Major:
+ Implement the functions mentioned in http://go/android-multinetwork-routing
correctly, including handling accept(), connect(), setNetworkForSocket()
and protect() and supporting functions like canUserSelectNetwork().
+ Eliminate the old code path of getting/setting UID ranges through
SecondaryTableController (which is currently unused) and mUidMap.
Minor:
+ Rename some methods/variables for clarity and consistency.
+ Moved some methods in .cpp files to match declaration order in the .h files.
Bug: 15409918
Change-Id: Ic6ce3646c58cf645db0d9a53cbeefdd7ffafff93
diff --git a/server/VirtualNetwork.h b/server/VirtualNetwork.h
index 54b4926..92a1b0e 100644
--- a/server/VirtualNetwork.h
+++ b/server/VirtualNetwork.h
@@ -22,18 +22,21 @@
class VirtualNetwork : public Network {
public:
- explicit VirtualNetwork(unsigned netId);
+ VirtualNetwork(unsigned netId, bool hasDns);
virtual ~VirtualNetwork();
+ bool getHasDns() const;
+ bool appliesToUser(uid_t uid) const;
+
int addUsers(const UidRanges& uidRanges) WARN_UNUSED_RESULT;
int removeUsers(const UidRanges& uidRanges) WARN_UNUSED_RESULT;
- Type getType() const override;
-
private:
+ Type getType() const override;
int addInterface(const std::string& interface) override WARN_UNUSED_RESULT;
int removeInterface(const std::string& interface) override WARN_UNUSED_RESULT;
+ const bool mHasDns;
UidRanges mUidRanges;
};