aboutsummaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2008-02-23 23:39:16 +0000
committerRoger Dingledine <arma@torproject.org>2008-02-23 23:39:16 +0000
commit31f72a3d8007096a59f8eb6be51c37d4c829c334 (patch)
tree3e77856b1c9ed4616613b5f541ec8e07527f0922 /src/or/dirserv.c
parent7feff8b481f2d57c114c44508da37cefe8dc00c0 (diff)
downloadtor-31f72a3d8007096a59f8eb6be51c37d4c829c334.tar.gz
tor-31f72a3d8007096a59f8eb6be51c37d4c829c334.zip
Servers that don't know their own IP address should go to the
authorities for their first directory fetch, even if their DirPort is off or if they don't know they're reachable yet. This will help them bootstrap better. Bugfix on 0.2.0.18-alpha; fixes bug 609. svn:r13688
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r--src/or/dirserv.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index cb3def9714..5570a3905a 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1118,12 +1118,15 @@ int
directory_fetches_from_authorities(or_options_t *options)
{
routerinfo_t *me;
+ uint32_t addr;
if (options->FetchDirInfoEarly)
return 1;
- if (options->DirPort == 0)
- return 0;
if (options->BridgeRelay == 1)
return 0;
+ if (server_mode(options) && router_pick_published_address(options, &addr)<0)
+ return 1; /* we don't know our IP address; ask an authority. */
+ if (options->DirPort == 0)
+ return 0;
if (!server_mode(options) || !advertised_server_mode())
return 0;
me = router_get_my_routerinfo();