diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-08-18 13:19:43 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-08-18 13:21:40 -0400 |
commit | 1196ed7cc4fc202e43ca102a73befe62aa65767d (patch) | |
tree | 792eaef2e5ee343b97361d70bb989016302ff4db /src/or/relay.c | |
parent | b45f0f8fb9b11effcd48159c078f09a3fbc04b11 (diff) | |
download | tor-1196ed7cc4fc202e43ca102a73befe62aa65767d.tar.gz tor-1196ed7cc4fc202e43ca102a73befe62aa65767d.zip |
Fix relay_command_to_string(); solve 12700.
Two bugs here:
1) We didn't add EXTEND2/EXTENDED2 to relay_command_to_string().
2) relay_command_to_string() didn't log the value of unrecognized
commands.
Both fixed here.
Diffstat (limited to 'src/or/relay.c')
-rw-r--r-- | src/or/relay.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/or/relay.c b/src/or/relay.c index 7f06c6e145..fffd45d522 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -517,6 +517,7 @@ relay_header_unpack(relay_header_t *dest, const uint8_t *src) static const char * relay_command_to_string(uint8_t command) { + static char buf[64]; switch (command) { case RELAY_COMMAND_BEGIN: return "BEGIN"; case RELAY_COMMAND_DATA: return "DATA"; @@ -541,7 +542,12 @@ relay_command_to_string(uint8_t command) case RELAY_COMMAND_RENDEZVOUS_ESTABLISHED: return "RENDEZVOUS_ESTABLISHED"; case RELAY_COMMAND_INTRODUCE_ACK: return "INTRODUCE_ACK"; - default: return "(unrecognized)"; + case RELAY_COMMAND_EXTEND2: return "EXTEND2"; + case RELAY_COMMAND_EXTENDED2: return "EXTENDED2"; + default: + tor_snprintf(buf, sizeof(buf), "Unrecognized relay command %u", + (unsigned)command); + return buf; } } |