summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-10-25 21:46:21 +0000
committerNick Mathewson <nickm@torproject.org>2006-10-25 21:46:21 +0000
commit3fbb292bfff2765c4e541763e4e40e068e55e4ab (patch)
treed08410be5b47a1a5558a053458ee54b846e6ad67
parent5c670a186c1f45a2ddfcab00c065f994d8a888f7 (diff)
downloadtor-3fbb292bfff2765c4e541763e4e40e068e55e4ab.tar.gz
tor-3fbb292bfff2765c4e541763e4e40e068e55e4ab.zip
r9389@Kushana: nickm | 2006-10-25 17:46:16 -0400
Add a CLEARDNSCACHE signal to clear the client-side DNS cache. svn:r8829
-rw-r--r--ChangeLog2
-rw-r--r--doc/control-spec.txt7
-rw-r--r--src/or/control.c2
-rw-r--r--src/or/main.c6
-rw-r--r--src/or/or.h1
5 files changed, 16 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 0e0734b152..293a0a9e1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -30,6 +30,8 @@ Changes in version 0.1.2.3-alpha - 2006-10-??
has changed.
- Add a GETINFO events/names and GETINFO features/names so controllers
can tell which events and features are supported.
+ - A new CLEARDNSCACHE signal to allow controllers to clear the
+ client-side DNS cache without expiring circuits.
o Security bugfixes:
- When the user sends a NEWNYM signal, clear the client-side DNS
diff --git a/doc/control-spec.txt b/doc/control-spec.txt
index 2231027699..798d10ef3e 100644
--- a/doc/control-spec.txt
+++ b/doc/control-spec.txt
@@ -242,7 +242,8 @@ $Id$
"SIGNAL" SP Signal CRLF
Signal = "RELOAD" / "SHUTDOWN" / "DUMP" / "DEBUG" / "HALT" /
- "HUP" / "INT" / "USR1" / "USR2" / "TERM" / "NEWNYM"
+ "HUP" / "INT" / "USR1" / "USR2" / "TERM" / "NEWNYM" /
+ "CLEARDNSCACHE"
The meaning of the signals are:
@@ -254,8 +255,10 @@ $Id$
circuits. (like USR1)
DEBUG -- Debug: switch all open logs to loglevel debug. (like USR2)
HALT -- Immediate shutdown: clean up and exit now. (like TERM)
+ CLEARDNSCACHE -- Forget the client-side cached IPs for all hostnames.
NEWNYM -- Switch to clean circuits, so new application requests
- don't share any circuits with old ones.
+ don't share any circuits with old ones. Also clears
+ the client-side DNS cache.
The server responds with "250 OK" if the signal is recognized (or simply
closes the socket if it was asked to close immediately), or "552
diff --git a/src/or/control.c b/src/or/control.c
index 60a233211d..036323d2b4 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -1283,6 +1283,8 @@ handle_control_signal(control_connection_t *conn, uint32_t len,
sig = SIGTERM;
else if (!strcasecmp(s, "NEWNYM"))
sig = SIGNEWNYM;
+ else if (!strcasecmp(s, "CLEARDNSCACHE"))
+ sig = SIGCLEARDNSCACHE;
else {
connection_printf_to_buf(conn, "552 Unrecognized signal code \"%s\"\r\n",
s);
diff --git a/src/or/main.c b/src/or/main.c
index 0dafa54050..c580eb243a 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -1260,6 +1260,9 @@ control_signal_act(int the_signal)
case SIGNEWNYM:
signal_callback(0,0,(void*)(uintptr_t)SIGNEWNYM);
break;
+ case SIGCLEARDNSCACHE:
+ signal_callback(0,0,(void*)(uintptr_t)SIGCLEARDNSCACHE);
+ break;
default:
log_warn(LD_BUG, "Unrecognized signal number %d.", the_signal);
break;
@@ -1320,6 +1323,9 @@ signal_callback(int fd, short events, void *arg)
circuit_expire_all_dirty_circs();
addressmap_clear_transient();
break;
+ case SIGCLEARDNSCACHE:
+ addressmap_clear_transient();
+ break;
}
}
diff --git a/src/or/or.h b/src/or/or.h
index 9036ef0192..bdae373601 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -147,6 +147,7 @@
/* Controller signals start at a high number so we don't
* conflict with system-defined signals. */
#define SIGNEWNYM 129
+#define SIGCLEARDNSCACHE 130
#if (SIZEOF_CELL_T != 0)
/* On Irix, stdlib.h defines a cell_t type, so we need to make sure