diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-12-24 02:45:27 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-12-24 02:45:27 +0000 |
commit | 4d948281c37569dd94496686cc8c3c3f81f65ffd (patch) | |
tree | 0ca5dc14682a401febbc696418572fd03c23afd3 /src/or/config.c | |
parent | 488b4726a76c62313518e380576aec530ea44b48 (diff) | |
download | tor-4d948281c37569dd94496686cc8c3c3f81f65ffd.tar.gz tor-4d948281c37569dd94496686cc8c3c3f81f65ffd.zip |
r11676@Kushana: nickm | 2006-12-23 20:42:17 -0500
Add an orport option to dirserver lines so that clients can tell where to connect to open an encrypted tunnel to a dirserver even before they have its descriptor.
svn:r9171
Diffstat (limited to 'src/or/config.c')
-rw-r--r-- | src/or/config.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/or/config.c b/src/or/config.c index a5cefe3d2a..962ea761c9 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -3329,7 +3329,7 @@ parse_dir_server_line(const char *line, int validate_only) smartlist_t *items = NULL; int r; char *addrport=NULL, *address=NULL, *nickname=NULL, *fingerprint=NULL; - uint16_t port; + uint16_t dir_port = 0, or_port = 0; char digest[DIGEST_LEN]; int is_v1_authority = 0, is_hidserv_authority = 0, is_not_hidserv_authority = 0, is_v2_authority = 1; @@ -3359,6 +3359,12 @@ parse_dir_server_line(const char *line, int validate_only) is_not_hidserv_authority = 1; } else if (!strcasecmp(flag, "no-v2")) { is_v2_authority = 0; + } else if (!strcasecmpstart(flag, "orport=")) { + int ok; + flag += strlen("orport="); + or_port = tor_parse_long(flag, 10, 1, 65535, &ok, NULL); + if (!ok) + log_warn(LD_CONFIG, "Invalid orport '%s' on DirServer line.", flag); } else { log_warn(LD_CONFIG, "Unrecognized flag '%s' on DirServer line", flag); @@ -3375,11 +3381,11 @@ parse_dir_server_line(const char *line, int validate_only) goto err; } addrport = smartlist_get(items, 0); - if (parse_addr_port(LOG_WARN, addrport, &address, NULL, &port)<0) { + if (parse_addr_port(LOG_WARN, addrport, &address, NULL, &dir_port)<0) { log_warn(LD_CONFIG, "Error parsing DirServer address '%s'", addrport); goto err; } - if (!port) { + if (!dir_port) { log_warn(LD_CONFIG, "Missing port in DirServer address '%s'",addrport); goto err; } @@ -3396,9 +3402,11 @@ parse_dir_server_line(const char *line, int validate_only) } if (!validate_only) { - log_debug(LD_DIR, "Trusted dirserver at %s:%d (%s)", address, (int)port, + log_debug(LD_DIR, "Trusted dirserver at %s:%d (%s)", address, + (int)dir_port, (char*)smartlist_get(items,1)); - add_trusted_dir_server(nickname, address, port, digest, is_v1_authority, + add_trusted_dir_server(nickname, address, dir_port, or_port, digest, + is_v1_authority, is_v2_authority, is_hidserv_authority); } |