diff options
-rw-r--r-- | main.c | 3 | ||||
-rw-r--r-- | setup.c | 9 |
2 files changed, 12 insertions, 0 deletions
@@ -124,6 +124,7 @@ const char *android_hook(char **envp) #endif extern void setup(int argc, char **argv); +extern void shutdown_session(); static int monitors; static void (*callbacks[10])(int fd); @@ -188,6 +189,8 @@ int main(int argc, char **argv) for (i = 0; i < monitors; ++i) { if (pollfds[i].revents & POLLHUP) { do_plog(LLV_INFO, "Connection is closed\n", pollfds[i].fd); + shutdown_session(); + /* Wait for few seconds to consume late messages. */ sleep(5); exit(1); @@ -53,6 +53,7 @@ #include "privsep.h" #include "throttle.h" #include "misc.h" +#include "handler.h" static struct localconf localconf; static struct sainfo sainfo; @@ -670,3 +671,11 @@ int throttle_host(struct sockaddr *addr, int fail) { return 0; } + +void shutdown_session() +{ + flushph2(); + flushph1(); + isakmp_close(); + pfkey_close(localconf.sock_pfkey); +} |