diff options
author | teor <teor2345@gmail.com> | 2016-08-16 14:39:46 +1000 |
---|---|---|
committer | teor <teor2345@gmail.com> | 2016-08-16 14:39:46 +1000 |
commit | 4b4389280e397e4c79c0ceea97094d8593419d7b (patch) | |
tree | 3901693b061d2177e29b61a3a13e133f65c64641 /src/or/router.c | |
parent | 427663428bf91dca0dfa2ede151cdb7eb9007408 (diff) | |
download | tor-4b4389280e397e4c79c0ceea97094d8593419d7b.tar.gz tor-4b4389280e397e4c79c0ceea97094d8593419d7b.zip |
Check parameters to router_check_descriptor_address_port_consistency
Diffstat (limited to 'src/or/router.c')
-rw-r--r-- | src/or/router.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/or/router.c b/src/or/router.c index db800b8f76..8fed36c8ff 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -1903,7 +1903,10 @@ static void router_check_descriptor_address_port_consistency(uint32_t ipv4h_desc_addr, int listener_type) { - /* The first configured Port, which may be the magic constant CFG_AUTO_PORT. + assert(listener_type == CONN_TYPE_OR_LISTENER || + listener_type == CONN_TYPE_DIR_LISTENER); + + /* The first advertised Port may be the magic constant CFG_AUTO_PORT. */ int port_v4_cfg = get_first_advertised_port_by_type_af(listener_type, AF_INET); @@ -1913,6 +1916,10 @@ router_check_descriptor_address_port_consistency(uint32_t ipv4h_desc_addr, const tor_addr_t *port_addr = get_first_advertised_addr_by_type_af( listener_type, AF_INET); + /* If we're building a descriptor with no advertised address, + * something is terribly wrong. */ + assert(port_addr); + tor_addr_t desc_addr; char port_addr_str[TOR_ADDR_BUF_LEN]; char desc_addr_str[TOR_ADDR_BUF_LEN]; |