From 9ef6e86cbbd7bff2d1980f9b88f3b6f9ec1457b5 Mon Sep 17 00:00:00 2001 From: yangchen Date: Wed, 6 Dec 2023 08:43:23 +0800 Subject: [PATCH] add fd log info and fix wrong port log info --- src/api/sockets.c | 2 +- src/core/tcp_in.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/api/sockets.c b/src/api/sockets.c index 65c69d4..d488b5b 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -2797,7 +2797,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len) #endif break; case NETCONN_EVT_ERROR: - LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, ("event_callback: have errevent, err=%d\n", conn->pending_err)); + LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, ("event_callback: have errevent, err=%d, fd=%d\n", conn->pending_err, conn->socket)); sock->errevent = 1; #if GAZELLE_ENABLE if (netif_is_rtc_mode(netif_default)) { diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index 8ed91b5..24706c1 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -688,8 +688,8 @@ aborted: TCP_STATS_INC(tcp.proterr); TCP_STATS_INC(tcp.drop); LWIP_DEBUGF(TCP_RST_DEBUG | GAZELLE_DEBUG_SERIOUS, - ("tcp_input: no PCB match found, send RST, dest port=%d, src port=%d\n", - lwip_ntohs(tcphdr->dest), lwip_ntohs(tcphdr->src))); + ("tcp_input: no PCB match found, send RST, local_port=%d, remote_port=%d\n", + tcphdr->src, tcphdr->dest)); tcp_rst(NULL, ackno, seqno + tcplen, ip_current_dest_addr(), ip_current_src_addr(), tcphdr->dest, tcphdr->src); } @@ -765,8 +765,8 @@ tcp_listen_input(struct tcp_pcb_listen *pcb) /* For incoming segments with the ACK flag set, respond with a RST. */ LWIP_DEBUGF(TCP_RST_DEBUG | GAZELLE_DEBUG_SERIOUS, - ("tcp_listen_input: ACK in LISTEN, send reset, dest port=%d, src port=%d\n", - lwip_ntohs(tcphdr->dest), lwip_ntohs(tcphdr->src))); + ("tcp_listen_input: ACK in LISTEN, send reset, local_port=%d, remote_port=%d\n", + tcphdr->src, tcphdr->dest)); tcp_rst((const struct tcp_pcb *)pcb, ackno, seqno + tcplen, ip_current_dest_addr(), ip_current_src_addr(), tcphdr->dest, tcphdr->src); } else if (flags & TCP_SYN) { @@ -902,8 +902,8 @@ tcp_timewait_input(struct tcp_pcb *pcb) if (TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt, pcb->rcv_nxt + pcb->rcv_wnd)) { /* If the SYN is in the window it is an error, send a reset */ LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, - ("tcp_timewait_input: SYN in TIME_WAIT, send RST, dest port=%d, src port=%d\n", - lwip_ntohs(tcphdr->dest), lwip_ntohs(tcphdr->src))); + ("tcp_timewait_input: SYN in TIME_WAIT, send RST, local_port=%d, remote_port=%d\n", + tcphdr->src, tcphdr->dest)); tcp_rst(pcb, ackno, seqno + tcplen, ip_current_dest_addr(), ip_current_src_addr(), tcphdr->dest, tcphdr->src); return; @@ -1072,8 +1072,8 @@ tcp_process(struct tcp_pcb *pcb) /* received ACK? possibly a half-open connection */ else if (flags & TCP_ACK) { /* send a RST to bring the other side in a non-synchronized state. */ - LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, ("tcp_process: ACK in SYN_SENT, send RST, dest port=%d, src port=%d\n", - lwip_ntohs(tcphdr->dest), lwip_ntohs(tcphdr->src))); + LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, ("tcp_process: ACK in SYN_SENT, send RST, local_port=%d, remote_port=%d\n", + tcphdr->src, tcphdr->dest)); tcp_rst(pcb, ackno, seqno + tcplen, ip_current_dest_addr(), ip_current_src_addr(), tcphdr->dest, tcphdr->src); /* Resend SYN immediately (don't wait for rto timeout) to establish @@ -1145,8 +1145,8 @@ tcp_process(struct tcp_pcb *pcb) } else { /* incorrect ACK number, send RST */ LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, - ("tcp_process: incorrect ACK number in SYN_RCVD, send RST, ackno=%d, lastack=%d, snd_nxt=%d, dest port=%d, src port=%d\n", - ackno, pcb->lastack, pcb->snd_nxt, lwip_ntohs(tcphdr->dest), lwip_ntohs(tcphdr->src))); + ("tcp_process: incorrect ACK number in SYN_RCVD, send RST, ackno=%d, lastack=%d, snd_nxt=%d, local_port=%d, remote_port=%d\n", + ackno, pcb->lastack, pcb->snd_nxt, tcphdr->src, tcphdr->dest)); tcp_rst(pcb, ackno, seqno + tcplen, ip_current_dest_addr(), ip_current_src_addr(), tcphdr->dest, tcphdr->src); } -- 2.33.0