cmdmon: add debug messages for receiving/sending packets
This commit is contained in:
parent
82f7fa3887
commit
2d581a6a86
1 changed files with 13 additions and 5 deletions
18
cmdmon.c
18
cmdmon.c
|
@ -686,7 +686,11 @@ transmit_reply(CMD_Reply *msg, union sockaddr_in46 *where_to, int auth_len)
|
||||||
int tx_message_length;
|
int tx_message_length;
|
||||||
int sock_fd;
|
int sock_fd;
|
||||||
socklen_t addrlen;
|
socklen_t addrlen;
|
||||||
|
unsigned short port;
|
||||||
|
IPAddr ip;
|
||||||
|
|
||||||
|
UTI_SockaddrToIPAndPort(&where_to->u, &ip, &port);
|
||||||
|
|
||||||
switch (where_to->u.sa_family) {
|
switch (where_to->u.sa_family) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
sock_fd = sock_fd4;
|
sock_fd = sock_fd4;
|
||||||
|
@ -707,12 +711,13 @@ transmit_reply(CMD_Reply *msg, union sockaddr_in46 *where_to, int auth_len)
|
||||||
&where_to->u, addrlen);
|
&where_to->u, addrlen);
|
||||||
|
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
unsigned short port;
|
DEBUG_LOG(LOGF_CmdMon, "Could not send to %s:%hu fd %d : %s",
|
||||||
IPAddr ip;
|
UTI_IPToString(&ip), port, sock_fd, strerror(errno));
|
||||||
|
return;
|
||||||
UTI_SockaddrToIPAndPort(&where_to->u, &ip, &port);
|
|
||||||
DEBUG_LOG(LOGF_CmdMon, "Could not send response to %s:%hu", UTI_IPToString(&ip), port);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEBUG_LOG(LOGF_CmdMon, "Sent %d bytes to %s:%hu fd %d", status,
|
||||||
|
UTI_IPToString(&ip), port, sock_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
@ -1551,6 +1556,9 @@ read_from_cmd_socket(void *anything)
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEBUG_LOG(LOGF_CmdMon, "Received %d bytes from %s:%hu fd %d",
|
||||||
|
status, UTI_IPToString(&remote_ip), remote_port, sock_fd);
|
||||||
|
|
||||||
if (!(localhost || ADF_IsAllowed(access_auth_table, &remote_ip))) {
|
if (!(localhost || ADF_IsAllowed(access_auth_table, &remote_ip))) {
|
||||||
/* The client is not allowed access, so don't waste any more time
|
/* The client is not allowed access, so don't waste any more time
|
||||||
on him. Note that localhost is always allowed access
|
on him. Note that localhost is always allowed access
|
||||||
|
|
Loading…
Reference in a new issue