diff options
author | Chia-chi Yeh <chiachi@android.com> | 2011-12-08 16:35:09 -0800 |
---|---|---|
committer | Chia-chi Yeh <chiachi@android.com> | 2011-12-08 16:35:09 -0800 |
commit | 35c31502e9811c7ecd430a89f2b3ae03ca7d277a (patch) | |
tree | 1d0673e48d39d162ce73f22b46d6ffff24588bbe | |
parent | 0269612ac00a0700997dda333faf0a3c33a388b8 (diff) | |
download | mtpd-ics-mr1-release.tar.gz |
mtpd: abort when any lower VPN layer dies.android-sdk-4.0.3_r1android-sdk-4.0.3-tools_r1android-cts-verifier-4.0_r1android-cts-verifier-4.0.3_r1android-cts-4.0.3_r2android-cts-4.0.3_r1android-4.0.4_r2.1android-4.0.4_r2android-4.0.4_r1.2android-4.0.4_r1.1android-4.0.4_r1android-4.0.3_r1.1android-4.0.3_r1ics-mr1-releaseics-mr1
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
-rw-r--r-- | mtpd.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -193,14 +193,19 @@ int main(int argc, char **argv) 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) { |