From b38293c11b66469091741bfbbe2e5a7046adc1a2 Mon Sep 17 00:00:00 2001 From: Erik Ekman Date: Tue, 9 Sep 2008 19:37:51 +0000 Subject: [PATCH] Stop client if server is restarted --- CHANGELOG | 1 + src/iodine.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 2e5ba33..057ef9a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -18,6 +18,7 @@ CHANGES: from Francois Revol. Still work to do to get tun device working. - Added capability to forward DNS queries outside tunnel domain to a nameserver on localhost. Use -b port to enable. + - iodine client now shuts down if it detects a server restart. 2008-08-06: 0.4.2 "Opened Zone" - Applied a few small patches from Maxim Bourmistrov and Gregor Herrmann diff --git a/src/iodine.c b/src/iodine.c index f70ff8e..7755f6a 100644 --- a/src/iodine.c +++ b/src/iodine.c @@ -226,6 +226,12 @@ tunnel_dns(int tun_fd, int dns_fd) if ((read = read_dns(dns_fd, in, sizeof(in))) <= 0) return -1; + if (read == 5 && strncmp("BADIP", in, 5) == 0) { + errx(3, "Not recognized by server. " + "Has it been restarted? Aborting"); + /* NOTREACHED */ + } + outlen = sizeof(out); inlen = read; if (uncompress((uint8_t*)out, &outlen, (uint8_t*)in, inlen) != Z_OK)