Add NDK API for getprocdns, setprocdns
The API allows callers to control the default network that is used for
DNS hostname resolution.
Test: atest CtsNetTestCases
Tests in change I00143cafcd3eb1d71e8d5c7ea9c839a99dc6f4ce
Bug: 171540887
Merged-In: I70d8113ae49cd1e0910a6dbc5929b6a157c44f42
Change-Id: I66ad7d2389307fb2991fd5ce09b7d3985719106d
diff --git a/include/android/multinetwork.h b/include/android/multinetwork.h
index fa77593..509ee0e 100644
--- a/include/android/multinetwork.h
+++ b/include/android/multinetwork.h
@@ -102,6 +102,28 @@
*/
int android_getprocnetwork(net_handle_t *network) __INTRODUCED_IN(31);
+/**
+ * Binds domain name resolutions performed by this process to |network|.
+ * android_setprocnetwork takes precedence over this setting.
+ *
+ * To clear a previous process binding, invoke with NETWORK_UNSPECIFIED.
+ * On success 0 is returned. On error -1 is returned, and errno is set.
+ *
+ * Available since API level 31.
+ */
+int android_setprocdns(net_handle_t network) __INTRODUCED_IN(31);
+
+/**
+ * Gets the |network| to which domain name resolutions are bound on the
+ * current process.
+ *
+ * Returns 0 on success, or -1 setting errno to EINVAL if a null pointer is
+ * passed in.
+ *
+ * Available since API level 31.
+ */
+int android_getprocdns(net_handle_t *network) __INTRODUCED_IN(31);
+
/**
* Perform hostname resolution via the DNS servers associated with |network|.