diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-01-06 05:42:31 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-01-06 05:42:31 +0000 |
commit | c8466c5919c68b43e2ec714b5bb57c70be330e54 (patch) | |
tree | 315deac802bef93b919edbd555c842102f71c496 /src/or/config.c | |
parent | 6b126ea040150661cd1419f0511e0c951d9b458e (diff) | |
download | tor-c8466c5919c68b43e2ec714b5bb57c70be330e54.tar.gz tor-c8466c5919c68b43e2ec714b5bb57c70be330e54.zip |
r11824@Kushana: nickm | 2007-01-03 17:15:28 -0500
control-spec: upcase arguments in status events; note unimplemented events individually
r11825@Kushana: nickm | 2007-01-03 17:41:43 -0500
Implement EXTERNAL IP server status event.
r11826@Kushana: nickm | 2007-01-03 17:47:10 -0500
Implement BAD_SERVER_DESCRIPTOR server status event.
r11827@Kushana: nickm | 2007-01-03 18:01:56 -0500
Implement SOCKS_UNKNOWN_PROTOCOL and DANGEROUS_SOCKS client events.
r11828@Kushana: nickm | 2007-01-03 18:23:22 -0500
Implement BUG controller events. Also, flush ERR-level status events just like ERR-level log messages.
r11829@Kushana: nickm | 2007-01-03 23:37:27 -0500
Yet more status events: CLOCK_SKEW, GOOD/ACCEPTED_SERVER_DESCRIPTOR, {CHECKING_}REACHABILITY_{SUCCEEDED|FAILED}
r11833@Kushana: nickm | 2007-01-05 16:56:37 -0500
Note some unimplementedness in control-spec.txt
svn:r9279
Diffstat (limited to 'src/or/config.c')
-rw-r--r-- | src/or/config.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/or/config.c b/src/or/config.c index e975e73801..fa3ff9641b 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -1801,6 +1801,7 @@ resolve_my_address(int warn_severity, or_options_t *options, char hostname[256]; int explicit_ip=1; int explicit_hostname=1; + int from_interface=0; char tmpbuf[INET_NTOA_BUF_LEN]; const char *address = options->Address; int notice_severity = warn_severity <= LOG_NOTICE ? @@ -1843,6 +1844,7 @@ resolve_my_address(int warn_severity, or_options_t *options, "Could not get local interface IP address. Failing."); return -1; } + from_interface = 1; in.s_addr = htonl(interface_ip); tor_inet_ntoa(&in,tmpbuf,sizeof(tmpbuf)); log_fn(notice_severity, LD_CONFIG, "Learned IP address '%s' for " @@ -1872,6 +1874,7 @@ resolve_my_address(int warn_severity, or_options_t *options, "Interface IP address '%s' is a private address too. " "Ignoring.", tmpbuf); } else { + from_interface = 1; in.s_addr = htonl(interface_ip); tor_inet_ntoa(&in,tmpbuf,sizeof(tmpbuf)); log_fn(notice_severity, LD_CONFIG, @@ -1914,6 +1917,24 @@ resolve_my_address(int warn_severity, or_options_t *options, log_notice(LD_NET, "Your IP address seems to have changed. Updating."); ip_address_changed(0); } + if (last_resolved_addr != *addr_out) { + const char *method; + const char *h = hostname; + if (explicit_ip) { + method = "CONFIGURED"; + h = NULL; + } else if (explicit_hostname) { + method = "RESOLVED"; + } else if (from_interface) { + method = "INTERFACE"; + h = NULL; + } else { + method = "GETHOSTNAME"; + } + control_event_server_status(LOG_NOTICE, + "EXTERNAL_ADDRESS ADDRESS=%s METHOD=%s %s%s", + tmpbuf, method, h?"HOSTNAME=":"", h); + } last_resolved_addr = *addr_out; if (hostname_out) *hostname_out = tor_strdup(hostname); |