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/UidRanges.h b/server/UidRanges.h
index 88685b4..044a8f9 100644
--- a/server/UidRanges.h
+++ b/server/UidRanges.h
@@ -23,7 +23,10 @@
class UidRanges {
public:
- const std::vector<std::pair<uid_t, uid_t>>& getRanges() const;
+ typedef std::pair<uid_t, uid_t> Range;
+
+ bool hasUid(uid_t uid) const;
+ const std::vector<Range>& getRanges() const;
bool parseFrom(int argc, char* argv[]);
@@ -31,7 +34,7 @@
void remove(const UidRanges& other);
private:
- std::vector<std::pair<uid_t, uid_t>> mRanges;
+ std::vector<Range> mRanges;
};
#endif // NETD_SERVER_UID_RANGES_H