diff options
author | Roger Dingledine <arma@torproject.org> | 2004-08-16 11:43:18 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-08-16 11:43:18 +0000 |
commit | 0a6e27208b53089d7f171fd131b3eb6cb3fd0901 (patch) | |
tree | a76bb3bda12d7933ddcfe40a1c09e765e6ee6b26 /src/or/router.c | |
parent | c90ff6f8b39b1f4dc95c5aac585291bdfbbb9d58 (diff) | |
download | tor-0a6e27208b53089d7f171fd131b3eb6cb3fd0901.tar.gz tor-0a6e27208b53089d7f171fd131b3eb6cb3fd0901.zip |
o Handle servers with dynamic IP addresses: don't replace
options->Address with the resolved one at startup.
o detect our address right before we make a routerinfo each time.
o external IP vs bind-IP. Already done, just use options->Address.
o OutboundBindAddress config option, to bind to a specific
IP address for outgoing connect()s.
svn:r2241
Diffstat (limited to 'src/or/router.c')
-rw-r--r-- | src/or/router.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/or/router.c b/src/or/router.c index 972b8f8f19..440e404282 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -510,17 +510,20 @@ const char *router_get_my_descriptor(void) { */ int router_rebuild_descriptor(void) { routerinfo_t *ri; - struct in_addr addr; + uint32_t addr; char platform[256]; - if (!tor_inet_aton(options.Address, &addr)) { - log_fn(LOG_ERR, "options.Address didn't hold an IP."); + struct in_addr in; + + if(resolve_my_address(options.Address, &addr) < 0) { + log_fn(LOG_WARN,"options.Address didn't resolve into an IP."); return -1; } ri = tor_malloc_zero(sizeof(routerinfo_t)); - ri->address = tor_strdup(options.Address); + in.s_addr = htonl(addr); + ri->address = tor_strdup(inet_ntoa(in)); ri->nickname = tor_strdup(options.Nickname); - ri->addr = (uint32_t) ntohl(addr.s_addr); + ri->addr = addr; ri->or_port = options.ORPort; ri->socks_port = options.SocksPort; ri->dir_port = options.DirPort; |