Merge "Protect mtpd socket from VPN"
am: de148c40d2
Change-Id: I2696608a26b7390c57a54a31e28a44484b7ba7ae
diff --git a/Android.bp b/Android.bp
index 7af119f..b865eec 100644
--- a/Android.bp
+++ b/Android.bp
@@ -23,6 +23,7 @@
"libcrypto",
"libcutils",
"liblog",
+ "libnetd_client",
],
cflags: ["-DANDROID_CHANGES"],
init_rc: ["mtpd.rc"],
diff --git a/mtpd.c b/mtpd.c
index c005567..ae0a1e6 100644
--- a/mtpd.c
+++ b/mtpd.c
@@ -35,6 +35,7 @@
#endif
#include "mtpd.h"
+#include "NetdClient.h"
int the_socket = -1;
@@ -295,6 +296,10 @@
exit(NETWORK_ERROR);
}
+#ifdef ANDROID_CHANGES
+ protectFromVpn(the_socket);
+#endif
+
fcntl(the_socket, F_SETFD, FD_CLOEXEC);
log_print(INFO, "Connection established (socket = %d)", the_socket);
}