aboutsummaryrefslogtreecommitdiff
path: root/src/feature/hs/hs_common.c
diff options
context:
space:
mode:
authorNeel Chauhan <neel@neelc.org>2018-11-04 20:08:57 -0500
committerteor <teor@torproject.org>2019-04-24 17:28:38 +1000
commitb65f8c419a4eb2608beecbf31af0b5bdc6cc38ec (patch)
tree73f0a49ba7bb80cc23f802b8a79e7136c9dd7bc7 /src/feature/hs/hs_common.c
parent26183476575abf0f8daccc2f4ca8be4ba0e2a5de (diff)
downloadtor-b65f8c419a4eb2608beecbf31af0b5bdc6cc38ec.tar.gz
tor-b65f8c419a4eb2608beecbf31af0b5bdc6cc38ec.zip
Add firewall_choose_address_ls() and hs_get_extend_info_from_lspecs() tests
Diffstat (limited to 'src/feature/hs/hs_common.c')
-rw-r--r--src/feature/hs/hs_common.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/feature/hs/hs_common.c b/src/feature/hs/hs_common.c
index ca7e991b75..9b24129b63 100644
--- a/src/feature/hs/hs_common.c
+++ b/src/feature/hs/hs_common.c
@@ -1697,7 +1697,15 @@ hs_get_extend_info_from_lspecs(const smartlist_t *lspecs,
tor_addr_make_null(&ap.addr, AF_UNSPEC);
ap.port = 0;
- tor_assert(lspecs);
+ if (lspecs == NULL) {
+ log_warn(LD_BUG, "Specified link specifiers is null");
+ goto done;
+ }
+
+ if (onion_key == NULL) {
+ log_warn(LD_BUG, "Specified onion key is null");
+ goto done;
+ }
if (smartlist_len(lspecs) == 0) {
log_fn(LOG_PROTOCOL_WARN, LD_REND, "Empty link specifier list.");
@@ -1744,8 +1752,14 @@ hs_get_extend_info_from_lspecs(const smartlist_t *lspecs,
fascist_firewall_choose_address_ls(lspecs, 0, &ap);
/* Legacy ID is mandatory, and we require an IP address. */
- if (!tor_addr_port_is_valid_ap(&ap, 0) || !have_legacy_id) {
- /* If we're missing the legacy ID or the IP address, return NULL. */
+ if (!tor_addr_port_is_valid_ap(&ap, 0)) {
+ /* If we're missing the IP address, log a warning and return NULL. */
+ log_info(LD_NET, "Unreachable or invalid IP address in link state");
+ goto done;
+ }
+ if (!have_legacy_id) {
+ /* If we're missing the legacy ID, log a warning and return NULL. */
+ log_warn(LD_PROTOCOL, "Missing Legacy ID in link state");
goto done;
}