summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Lee <rgl@google.com>2017-03-17 13:21:36 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-03-17 13:21:36 +0000
commitcd787c027b6b1bf58c51c3b0887af6730f858efe (patch)
tree191f0973c98b20754bf97b1afd3a8c5b84930af6
parent4532572d2c815c7af2660dda9eee05eda09e31a1 (diff)
parente80d1cfd58936fced61f096c7ab57393c2d4de98 (diff)
downloadmtpd-cd787c027b6b1bf58c51c3b0887af6730f858efe.tar.gz
Merge "Protect mtpd socket from VPN" am: de148c40d2
am: e80d1cfd58 Change-Id: I9648e9b3caee84267ae30d86fc99cf7c5ed5c1b5
-rw-r--r--Android.bp1
-rw-r--r--mtpd.c5
2 files changed, 6 insertions, 0 deletions
diff --git a/Android.bp b/Android.bp
index 7af119f..b865eec 100644
--- a/Android.bp
+++ b/Android.bp
@@ -23,6 +23,7 @@ cc_binary {
"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 @@ void create_socket(int family, int type, char *server, char *port)
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);
}