summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2017-03-17 13:15:14 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-03-17 13:15:15 +0000
commitde148c40d2b7d10d0f99726a62a7761ef2bf927d (patch)
tree191f0973c98b20754bf97b1afd3a8c5b84930af6
parent66c4c5b6b715f325a3f262f96148cbe2594aaed1 (diff)
parentb8e401eea37de5318c9b7e51489da5b815f8abb2 (diff)
downloadmtpd-de148c40d2b7d10d0f99726a62a7761ef2bf927d.tar.gz
Merge "Protect mtpd socket from VPN"
-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);
}