|
|
@ -20,7 +20,7 @@ static void control_ng_incoming(struct obj *obj, char *buf, int buf_len, struct |
|
|
|
|
|
|
|
|
data = memchr(buf, ' ', buf_len); |
|
|
data = memchr(buf, ' ', buf_len); |
|
|
if (!data || data == buf) { |
|
|
if (!data || data == buf) { |
|
|
mylog(LOG_WARNING, "Received invalid data on NG port (no cookie) from %s:%u: %.*s", addr, ntohs(sin->sin6_port), buf_len, buf); |
|
|
|
|
|
|
|
|
mylog(LOG_WARNING, "Received invalid data on NG port (no cookie) from %s: %.*s", addr, buf_len, buf); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -38,7 +38,7 @@ static void control_ng_incoming(struct obj *obj, char *buf, int buf_len, struct |
|
|
|
|
|
|
|
|
reply = cookie_cache_lookup(&c->cookie_cache, cookie); |
|
|
reply = cookie_cache_lookup(&c->cookie_cache, cookie); |
|
|
if (reply) { |
|
|
if (reply) { |
|
|
mylog(LOG_INFO, "Detected command from %s:%u as a duplicate", addr, ntohs(sin->sin6_port)); |
|
|
|
|
|
|
|
|
mylog(LOG_INFO, "Detected command from %s as a duplicate", addr); |
|
|
reply_len = strlen(reply); /* XXX fails for embedded nulls */ |
|
|
reply_len = strlen(reply); /* XXX fails for embedded nulls */ |
|
|
resp = NULL; |
|
|
resp = NULL; |
|
|
goto send_only; |
|
|
goto send_only; |
|
|
@ -54,7 +54,7 @@ static void control_ng_incoming(struct obj *obj, char *buf, int buf_len, struct |
|
|
if (!cmd) |
|
|
if (!cmd) |
|
|
goto err_send; |
|
|
goto err_send; |
|
|
|
|
|
|
|
|
mylog(LOG_INFO, "Got valid command from %s:%u: %.*s [%.*s]", addr, ntohs(sin->sin6_port), cmd_len, cmd, data_len, data); |
|
|
|
|
|
|
|
|
mylog(LOG_INFO, "Got valid command from %s: %.*s [%.*s]", addr, cmd_len, cmd, data_len, data); |
|
|
|
|
|
|
|
|
errstr = NULL; |
|
|
errstr = NULL; |
|
|
if (!strmemcmp(cmd, cmd_len, "ping")) |
|
|
if (!strmemcmp(cmd, cmd_len, "ping")) |
|
|
@ -74,7 +74,7 @@ static void control_ng_incoming(struct obj *obj, char *buf, int buf_len, struct |
|
|
goto send_out; |
|
|
goto send_out; |
|
|
|
|
|
|
|
|
err_send: |
|
|
err_send: |
|
|
mylog(LOG_WARNING, "Protocol error in packet from %s:%u: %s [%.*s]", addr, ntohs(sin->sin6_port), errstr, data_len, data); |
|
|
|
|
|
|
|
|
mylog(LOG_WARNING, "Protocol error in packet from %s: %s [%.*s]", addr, errstr, data_len, data); |
|
|
bencode_dictionary_add_string(resp, "result", "error"); |
|
|
bencode_dictionary_add_string(resp, "result", "error"); |
|
|
bencode_dictionary_add_string(resp, "error-reason", errstr); |
|
|
bencode_dictionary_add_string(resp, "error-reason", errstr); |
|
|
goto send_out; |
|
|
goto send_out; |
|
|
|