[tor-commits] [tor/master] prop224: Use LOG_PROTOCOL_WARN instead of log_warn(LD_PROTOCOL, ...) in hs_intropoint.c
nickm at torproject.org
nickm at torproject.org
Wed Dec 14 21:05:47 UTC 2016
commit a4eb17ed89d4761146280490e838cf850bc81296
Author: David Goulet <dgoulet at torproject.org>
Date: Wed Dec 14 10:39:33 2016 -0500
prop224: Use LOG_PROTOCOL_WARN instead of log_warn(LD_PROTOCOL, ...) in hs_intropoint.c
Signed-off-by: David Goulet <dgoulet at torproject.org>
---
src/or/hs_intropoint.c | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/src/or/hs_intropoint.c b/src/or/hs_intropoint.c
index b5f62aa..67355bc 100644
--- a/src/or/hs_intropoint.c
+++ b/src/or/hs_intropoint.c
@@ -11,6 +11,7 @@
#include "or.h"
#include "circuitlist.h"
#include "circuituse.h"
+#include "config.h"
#include "relay.h"
#include "rendmid.h"
#include "rephist.h"
@@ -70,7 +71,8 @@ verify_establish_intro_cell(const hs_cell_establish_intro_t *cell,
const uint8_t *sig_array = hs_cell_establish_intro_getconstarray_sig(cell);
if (hs_cell_establish_intro_getlen_sig(cell) != sizeof(sig_struct.sig)) {
- log_warn(LD_PROTOCOL, "ESTABLISH_INTRO sig len is invalid");
+ log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
+ "ESTABLISH_INTRO sig len is invalid");
return -1;
}
/* We are now sure that sig_len is of the right size. */
@@ -85,7 +87,8 @@ verify_establish_intro_cell(const hs_cell_establish_intro_t *cell,
ESTABLISH_INTRO_SIG_PREFIX,
&auth_key);
if (sig_mismatch) {
- log_warn(LD_PROTOCOL, "ESTABLISH_INTRO signature not as expected");
+ log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
+ "ESTABLISH_INTRO signature not as expected");
return -1;
}
}
@@ -98,7 +101,8 @@ verify_establish_intro_cell(const hs_cell_establish_intro_t *cell,
circuit_key_material, circuit_key_material_len,
msg, auth_msg_len);
if (tor_memneq(mac, cell->handshake_mac, sizeof(mac))) {
- log_warn(LD_PROTOCOL, "ESTABLISH_INTRO handshake_auth not as expected");
+ log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
+ "ESTABLISH_INTRO handshake_auth not as expected");
return -1;
}
}
@@ -192,8 +196,9 @@ handle_establish_intro(or_circuit_t *circ, const uint8_t *request,
ssize_t parsing_result = hs_cell_establish_intro_parse(&parsed_cell,
request, request_len);
if (parsing_result < 0) {
- log_warn(LD_PROTOCOL, "Rejecting %s ESTABLISH_INTRO cell.",
- parsing_result == -1 ? "invalid" : "truncated");
+ log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
+ "Rejecting %s ESTABLISH_INTRO cell.",
+ parsing_result == -1 ? "invalid" : "truncated");
goto err;
}
@@ -201,7 +206,8 @@ handle_establish_intro(or_circuit_t *circ, const uint8_t *request,
(uint8_t *) circ->rend_circ_nonce,
sizeof(circ->rend_circ_nonce));
if (cell_ok < 0) {
- log_warn(LD_PROTOCOL, "Failed to verify ESTABLISH_INTRO cell.");
+ log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
+ "Failed to verify ESTABLISH_INTRO cell.");
goto err;
}
@@ -233,12 +239,14 @@ hs_intro_circuit_is_suitable(const or_circuit_t *circ)
{
/* Basic circuit state sanity checks. */
if (circ->base_.purpose != CIRCUIT_PURPOSE_OR) {
- log_warn(LD_PROTOCOL, "Rejecting ESTABLISH_INTRO on non-OR circuit.");
+ log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
+ "Rejecting ESTABLISH_INTRO on non-OR circuit.");
return 0;
}
if (circ->base_.n_chan) {
- log_warn(LD_PROTOCOL, "Rejecting ESTABLISH_INTRO on non-edge circuit.");
+ log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
+ "Rejecting ESTABLISH_INTRO on non-edge circuit.");
return 0;
}
@@ -255,7 +263,7 @@ hs_intro_received_establish_intro(or_circuit_t *circ, const uint8_t *request,
tor_assert(request);
if (request_len == 0) {
- log_warn(LD_PROTOCOL, "Empty ESTABLISH_INTRO cell.");
+ log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, "Empty ESTABLISH_INTRO cell.");
goto err;
}
@@ -269,7 +277,8 @@ hs_intro_received_establish_intro(or_circuit_t *circ, const uint8_t *request,
case HS_INTRO_AUTH_KEY_TYPE_ED25519:
return handle_establish_intro(circ, request, request_len);
default:
- log_warn(LD_PROTOCOL, "Unrecognized AUTH_KEY_TYPE %u.", first_byte);
+ log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
+ "Unrecognized AUTH_KEY_TYPE %u.", first_byte);
goto err;
}
More information about the tor-commits
mailing list