Log find_rp_for_intro_() failures at LOG_PROTOCOL_WARN.

Closes ticket 18761.

Also fix a whitespace issue.
This commit is contained in:
Nick Mathewson 2016-04-26 20:46:44 -04:00
parent de08f2d96b
commit b59d79134e
2 changed files with 13 additions and 5 deletions

3
changes/bug18761 Normal file
View File

@ -0,0 +1,3 @@
o Minor feature (logging):
- When rejecting a misformed INTRODUCE2 cell, only log at PROTOCOL_WARN
severity. Closes ticket 18761.

View File

@ -1445,6 +1445,7 @@ rend_service_receive_introduction(origin_circuit_t *circuit,
int status = 0, result; int status = 0, result;
const or_options_t *options = get_options(); const or_options_t *options = get_options();
char *err_msg = NULL; char *err_msg = NULL;
int err_msg_severity = LOG_WARN;
const char *stage_descr = NULL; const char *stage_descr = NULL;
int reason = END_CIRC_REASON_TORPROTOCOL; int reason = END_CIRC_REASON_TORPROTOCOL;
/* Service/circuit/key stuff we can learn before parsing */ /* Service/circuit/key stuff we can learn before parsing */
@ -1596,8 +1597,10 @@ rend_service_receive_introduction(origin_circuit_t *circuit,
/* Find the rendezvous point */ /* Find the rendezvous point */
rp = find_rp_for_intro(parsed_req, &err_msg); rp = find_rp_for_intro(parsed_req, &err_msg);
if (!rp) if (!rp) {
err_msg_severity = LOG_PROTOCOL_WARN;
goto log_error; goto log_error;
}
/* Check if we'd refuse to talk to this router */ /* Check if we'd refuse to talk to this router */
if (options->StrictNodes && if (options->StrictNodes &&
@ -1735,7 +1738,7 @@ rend_service_receive_introduction(origin_circuit_t *circuit,
} }
} }
log_warn(LD_REND, "%s on circ %u", err_msg, log_fn(err_msg_severity, LD_REND, "%s on circ %u", err_msg,
(unsigned)circuit->base_.n_circ_id); (unsigned)circuit->base_.n_circ_id);
err: err:
status = -1; status = -1;
@ -1797,7 +1800,7 @@ find_rp_for_intro(const rend_intro_cell_t *intro,
if (!rp) { if (!rp) {
if (err_msg_out) { if (err_msg_out) {
tor_asprintf(&err_msg, tor_asprintf(&err_msg,
"Could build extend_info_t for router %s named " "Couldn't build extend_info_t for router %s named "
"in INTRODUCE2 cell", "in INTRODUCE2 cell",
escaped_safe_str_client(rp_nickname)); escaped_safe_str_client(rp_nickname));
} }
@ -1833,8 +1836,10 @@ find_rp_for_intro(const rend_intro_cell_t *intro,
goto done; goto done;
err: err:
if (err_msg_out) *err_msg_out = err_msg; if (err_msg_out)
else tor_free(err_msg); *err_msg_out = err_msg;
else
tor_free(err_msg);
done: done:
return rp; return rp;