mtpd: abort when any lower VPN layer dies.

Before processing any packets, we check the presence of an
"abort" file. If that exists, shut down our VPN layers. The
performance impact is negligible as control packets are rare.

Bug: 5714296
Change-Id: I076cc1afd7c7ef173bc93a6c4c105d08f8cc7686
diff --git a/mtpd.c b/mtpd.c
index f65043e..cff5712 100644
--- a/mtpd.c
+++ b/mtpd.c
@@ -193,14 +193,19 @@
             log_print(FATAL, "Poll() %s", strerror(errno));
             exit(SYSTEM_ERROR);
         }
-        timeout = pollfds[0].revents ?
-                the_protocol->process() : the_protocol->timeout();
         if (pollfds[1].revents) {
             break;
         }
         if (pollfds[2].revents) {
             interrupt(SIGTERM);
         }
+#ifdef ANDROID_CHANGES
+        if (!access("/data/misc/vpn/abort", F_OK)) {
+            interrupt(SIGTERM);
+        }
+#endif
+        timeout = pollfds[0].revents ?
+                the_protocol->process() : the_protocol->timeout();
     }
 
     if (timeout < 0) {