Add tetherApplyDnsInterfaces() binder interface.
Bug: 9580643
(cherry picked from commit 212c405c296ed869eda927e683734aff80248872)
Change-Id: I0f636266bbaa8c39847ea1e0ffbfdea789b3de53
diff --git a/server/NetdNativeService.cpp b/server/NetdNativeService.cpp
index 5ee8202..10629ef 100644
--- a/server/NetdNativeService.cpp
+++ b/server/NetdNativeService.cpp
@@ -201,5 +201,12 @@
return binder::Status::ok();
}
+binder::Status NetdNativeService::tetherApplyDnsInterfaces(bool *ret) {
+ NETD_BIG_LOCK_RPC(CONNECTIVITY_INTERNAL);
+
+ *ret = gCtls->tetherCtrl.applyDnsInterfaces();
+ return binder::Status::ok();
+}
+
} // namespace net
} // namespace android
diff --git a/server/NetdNativeService.h b/server/NetdNativeService.h
index b5c8f69..c5d9114 100644
--- a/server/NetdNativeService.h
+++ b/server/NetdNativeService.h
@@ -47,6 +47,9 @@
binder::Status getResolverInfo(int32_t netId, std::vector<std::string>* servers,
std::vector<std::string>* domains, std::vector<int32_t>* params,
std::vector<int32_t>* stats) override;
+
+ // Tethering-related commands.
+ binder::Status tetherApplyDnsInterfaces(bool *ret) override;
};
} // namespace net
diff --git a/server/TetherController.h b/server/TetherController.h
index 6035c25..3769890 100644
--- a/server/TetherController.h
+++ b/server/TetherController.h
@@ -54,9 +54,9 @@
int tetherInterface(const char *interface);
int untetherInterface(const char *interface);
const std::list<std::string> &getTetheredInterfaceList() const;
+ bool applyDnsInterfaces();
private:
- bool applyDnsInterfaces();
bool setIpFwdEnabled();
};
diff --git a/server/binder/android/net/INetd.aidl b/server/binder/android/net/INetd.aidl
index 097f98a..1b901b8 100644
--- a/server/binder/android/net/INetd.aidl
+++ b/server/binder/android/net/INetd.aidl
@@ -145,4 +145,14 @@
*/
void getResolverInfo(int netId, out @utf8InCpp String[] servers,
out @utf8InCpp String[] domains, out int[] params, out int[] stats);
+
+ /**
+ * Instruct the tethering DNS server to reevaluated serving interfaces.
+ * This is needed to for the DNS server to observe changes in the set
+ * of potential listening IP addresses. (Listening on wildcard addresses
+ * can turn the device into an open resolver; b/7530468)
+ *
+ * TODO: Return something richer than just a boolean.
+ */
+ boolean tetherApplyDnsInterfaces();
}