diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-05-09 04:31:00 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-05-09 04:31:00 +0000 |
commit | 13126eeb0fa16f98bffae378f3f570112f99da8d (patch) | |
tree | 6b304a5181173b415fa47823482da60fccdc99ad /src | |
parent | c8ad2fc0031a3705708a5f1cdf9518f391df4d80 (diff) | |
download | tor-13126eeb0fa16f98bffae378f3f570112f99da8d.tar tor-13126eeb0fa16f98bffae378f3f570112f99da8d.tar.gz |
Patch from goodell for task 131: Do not die on internal address if we are not publishing.
svn:r4186
Diffstat (limited to 'src')
-rw-r--r-- | src/or/config.c | 8 | ||||
-rw-r--r-- | src/or/or.h | 2 | ||||
-rw-r--r-- | src/or/router.c | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/src/or/config.c b/src/or/config.c index 5ec19d15f..4ba20c602 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -952,7 +952,7 @@ print_usage(void) * in <b>addr</b>. */ int -resolve_my_address(const char *address, uint32_t *addr) +resolve_my_address(or_options_t *options, uint32_t *addr) { struct in_addr in; struct hostent *rent; @@ -960,6 +960,7 @@ resolve_my_address(const char *address, uint32_t *addr) int explicit_ip=1; char tmpbuf[INET_NTOA_BUF_LEN]; static uint32_t old_addr=0; + const char *address = options->Address; tor_assert(addr); @@ -1001,7 +1002,8 @@ resolve_my_address(const char *address, uint32_t *addr) log_fn(LOG_WARN,"Address '%s' resolves to private IP '%s'. " "Please set the Address config option to be the IP you want to use.", hostname, tmpbuf); - return -1; + if(!options->NoPublish) + return -1; } log_fn(LOG_DEBUG, "Resolved Address to %s.", tmpbuf); @@ -1299,7 +1301,7 @@ options_validate(or_options_t *options) if (server_mode(options)) { /* confirm that our address isn't broken, so we can complain now */ uint32_t tmp; - if (resolve_my_address(options->Address, &tmp) < 0) + if (resolve_my_address(options, &tmp) < 0) result = -1; } diff --git a/src/or/or.h b/src/or/or.h index 146897a38..8a19b7359 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1249,7 +1249,7 @@ const char *safe_str(const char *address); int config_get_lines(char *string, struct config_line_t **result); void config_free_lines(struct config_line_t *front); int config_trial_assign(struct config_line_t *list, int reset); -int resolve_my_address(const char *address, uint32_t *addr); +int resolve_my_address(or_options_t *options, uint32_t *addr); void options_init(or_options_t *options); int init_from_config(int argc, char **argv); int config_init_logs(or_options_t *options, int validate_only); diff --git a/src/or/router.c b/src/or/router.c index 1ec4665b8..f97e30f46 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -672,7 +672,7 @@ int router_rebuild_descriptor(int force) { if (!desc_is_dirty && !force) return 0; - if (resolve_my_address(options->Address, &addr) < 0) { + if (resolve_my_address(options, &addr) < 0) { log_fn(LOG_WARN,"options->Address didn't resolve into an IP."); return -1; } |