diff options
author | Pablo Neira Ayuso <pablo@gnumonks.org> | 2011-09-09 01:01:36 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2011-09-09 02:35:45 +0200 |
commit | 32c883a96ff90a5d7f1fd7f8a28cd3fa6b138fff (patch) | |
tree | 9f85a11998d3321e833b80cb4695ab5ed6dfd15f | |
parent | 2220a0542cf17ffc550247bfc46efe27987df9b4 (diff) |
ipa: better log error messages for ipa_msg_recv()
More descriptive errors help to debug problems.
-rw-r--r-- | src/input/ipa.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/input/ipa.c b/src/input/ipa.c index 4773dff7..a519f076 100644 --- a/src/input/ipa.c +++ b/src/input/ipa.c @@ -63,6 +63,7 @@ int ipa_msg_recv(int fd, struct msgb **rmsg) msgb_free(msg); return ret; } else if (ret != sizeof(*hh)) { + LOGP(DLINP, LOGL_ERROR, "too small message received\n"); msgb_free(msg); return -EIO; } @@ -73,6 +74,8 @@ int ipa_msg_recv(int fd, struct msgb **rmsg) len = ntohs(hh->len); if (len < 0 || IPA_ALLOC_SIZE < len + sizeof(*hh)) { + LOGP(DLINP, LOGL_ERROR, "bad message length of %d bytes, " + "received %d bytes\n", len, ret); msgb_free(msg); return -EIO; } @@ -82,6 +85,7 @@ int ipa_msg_recv(int fd, struct msgb **rmsg) msgb_free(msg); return ret; } else if (ret < len) { + LOGP(DLINP, LOGL_ERROR, "trunked message received\n"); msgb_free(msg); return -EIO; } @@ -119,8 +123,6 @@ static void ipa_client_read(struct ipa_client_conn *link) if (ret < 0) { if (errno == EPIPE || errno == ECONNRESET) { LOGP(DLINP, LOGL_ERROR, "lost connection with server\n"); - } else { - LOGP(DLINP, LOGL_ERROR, "unknown error\n"); } ipa_client_retry(link); return; @@ -387,8 +389,6 @@ static void ipa_server_conn_read(struct ipa_server_conn *conn) if (ret < 0) { if (errno == EPIPE || errno == ECONNRESET) { LOGP(DLINP, LOGL_ERROR, "lost connection with server\n"); - } else { - LOGP(DLINP, LOGL_ERROR, "unknown error\n"); } return; } else if (ret == 0) { |