diff --git a/netutils/tftpc/tftpc_get.c b/netutils/tftpc/tftpc_get.c index 4ad5eeb58..28fd438cf 100644 --- a/netutils/tftpc/tftpc_get.c +++ b/netutils/tftpc/tftpc_get.c @@ -119,12 +119,13 @@ static inline int tftp_parsedatapacket(const uint8_t *packet, *blockno = (uint16_t)packet[2] << 8 | (uint16_t)packet[3]; return OK; } -#if defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_DEBUG_NET) +#ifdef CONFIG_DEBUG_NET_WARN else if (*opcode == TFTP_ERR) { (void)tftp_parseerrpacket(packet); } #endif + return ERROR; } diff --git a/netutils/tftpc/tftpc_internal.h b/netutils/tftpc/tftpc_internal.h index e25d5365a..8516aef37 100644 --- a/netutils/tftpc/tftpc_internal.h +++ b/netutils/tftpc/tftpc_internal.h @@ -162,7 +162,7 @@ extern int tftp_sockinit(struct sockaddr_in *server, in_addr_t addr); extern int tftp_mkreqpacket(uint8_t *buffer, int opcode, const char *path, bool binary); extern int tftp_mkackpacket(uint8_t *buffer, uint16_t blockno); extern int tftp_mkerrpacket(uint8_t *buffer, uint16_t errorcode, const char *errormsg); -#if defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_DEBUG_NET) +#ifdef CONFIG_DEBUG_NET_WARN extern int tftp_parseerrpacket(const uint8_t *packet); #endif diff --git a/netutils/tftpc/tftpc_packets.c b/netutils/tftpc/tftpc_packets.c index d4cb5cfc8..39cbe6f13 100644 --- a/netutils/tftpc/tftpc_packets.c +++ b/netutils/tftpc/tftpc_packets.c @@ -207,18 +207,19 @@ int tftp_mkerrpacket(uint8_t *buffer, uint16_t errorcode, const char *errormsg) * ****************************************************************************/ -#if defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_DEBUG_NET) +#ifdef CONFIG_DEBUG_NET_WARN int tftp_parseerrpacket(const uint8_t *buffer) { - uint16_t opcode = (uint16_t)buffer[0] << 8 | (uint16_t)buffer[1]; - uint16_t errcode = (uint16_t)buffer[2] << 8 | (uint16_t)buffer[3]; - const char *errmsg = (const char *)&buffer[4]; + uint16_t opcode = (uint16_t)buffer[0] << 8 | (uint16_t)buffer[1]; + uint16_t errcode = (uint16_t)buffer[2] << 8 | (uint16_t)buffer[3]; + FAR const char *errmsg = (const char *)&buffer[4]; if (opcode == TFTP_ERR) { - nerr("ERR message: %s (%d)\n", errmsg, errcode); + ninfo("ERR message: %s (%d)\n", errmsg, errcode); return OK; } + return ERROR; } #endif diff --git a/netutils/tftpc/tftpc_put.c b/netutils/tftpc/tftpc_put.c index 4611b8d66..05808e4ce 100644 --- a/netutils/tftpc/tftpc_put.c +++ b/netutils/tftpc/tftpc_put.c @@ -270,8 +270,9 @@ static int tftp_rcvack(int sd, uint8_t *packet, struct sockaddr_in *server, if (opcode != TFTP_ACK) { - ninfo("Bad opcode\n"); -#if defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_DEBUG_NET) + nwarn("WARNING: Bad opcode\n"); + +#ifdef CONFIG_DEBUG_NET_WARN if (opcode == TFTP_ERR) { (void)tftp_parseerrpacket(packet);