1From 9ef6e86cbbd7bff2d1980f9b88f3b6f9ec1457b5 Mon Sep 17 00:00:00 2001 2From: yangchen <yangchen145@huawei.com> 3Date: Wed, 6 Dec 2023 08:43:23 +0800 4Subject: [PATCH] add fd log info and fix wrong port log info 5 6--- 7 src/api/sockets.c | 2 +- 8 src/core/tcp_in.c | 20 ++++++++++---------- 9 2 files changed, 11 insertions(+), 11 deletions(-) 10 11diff --git a/src/api/sockets.c b/src/api/sockets.c 12index 65c69d4..d488b5b 100644 13--- a/src/api/sockets.c 14+++ b/src/api/sockets.c 15@@ -2797,7 +2797,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len) 16 #endif 17 break; 18 case NETCONN_EVT_ERROR: 19- LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, ("event_callback: have errevent, err=%d\n", conn->pending_err)); 20+ LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, ("event_callback: have errevent, err=%d, fd=%d\n", conn->pending_err, conn->socket)); 21 sock->errevent = 1; 22 #if GAZELLE_ENABLE 23 if (netif_is_rtc_mode(netif_default)) { 24diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c 25index 8ed91b5..24706c1 100644 26--- a/src/core/tcp_in.c 27+++ b/src/core/tcp_in.c 28@@ -688,8 +688,8 @@ aborted: 29 TCP_STATS_INC(tcp.proterr); 30 TCP_STATS_INC(tcp.drop); 31 LWIP_DEBUGF(TCP_RST_DEBUG | GAZELLE_DEBUG_SERIOUS, 32- ("tcp_input: no PCB match found, send RST, dest port=%d, src port=%d\n", 33- lwip_ntohs(tcphdr->dest), lwip_ntohs(tcphdr->src))); 34+ ("tcp_input: no PCB match found, send RST, local_port=%d, remote_port=%d\n", 35+ tcphdr->src, tcphdr->dest)); 36 tcp_rst(NULL, ackno, seqno + tcplen, ip_current_dest_addr(), 37 ip_current_src_addr(), tcphdr->dest, tcphdr->src); 38 } 39@@ -765,8 +765,8 @@ tcp_listen_input(struct tcp_pcb_listen *pcb) 40 /* For incoming segments with the ACK flag set, respond with a 41 RST. */ 42 LWIP_DEBUGF(TCP_RST_DEBUG | GAZELLE_DEBUG_SERIOUS, 43- ("tcp_listen_input: ACK in LISTEN, send reset, dest port=%d, src port=%d\n", 44- lwip_ntohs(tcphdr->dest), lwip_ntohs(tcphdr->src))); 45+ ("tcp_listen_input: ACK in LISTEN, send reset, local_port=%d, remote_port=%d\n", 46+ tcphdr->src, tcphdr->dest)); 47 tcp_rst((const struct tcp_pcb *)pcb, ackno, seqno + tcplen, ip_current_dest_addr(), 48 ip_current_src_addr(), tcphdr->dest, tcphdr->src); 49 } else if (flags & TCP_SYN) { 50@@ -902,8 +902,8 @@ tcp_timewait_input(struct tcp_pcb *pcb) 51 if (TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt, pcb->rcv_nxt + pcb->rcv_wnd)) { 52 /* If the SYN is in the window it is an error, send a reset */ 53 LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, 54- ("tcp_timewait_input: SYN in TIME_WAIT, send RST, dest port=%d, src port=%d\n", 55- lwip_ntohs(tcphdr->dest), lwip_ntohs(tcphdr->src))); 56+ ("tcp_timewait_input: SYN in TIME_WAIT, send RST, local_port=%d, remote_port=%d\n", 57+ tcphdr->src, tcphdr->dest)); 58 tcp_rst(pcb, ackno, seqno + tcplen, ip_current_dest_addr(), 59 ip_current_src_addr(), tcphdr->dest, tcphdr->src); 60 return; 61@@ -1072,8 +1072,8 @@ tcp_process(struct tcp_pcb *pcb) 62 /* received ACK? possibly a half-open connection */ 63 else if (flags & TCP_ACK) { 64 /* send a RST to bring the other side in a non-synchronized state. */ 65- LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, ("tcp_process: ACK in SYN_SENT, send RST, dest port=%d, src port=%d\n", 66- lwip_ntohs(tcphdr->dest), lwip_ntohs(tcphdr->src))); 67+ LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, ("tcp_process: ACK in SYN_SENT, send RST, local_port=%d, remote_port=%d\n", 68+ tcphdr->src, tcphdr->dest)); 69 tcp_rst(pcb, ackno, seqno + tcplen, ip_current_dest_addr(), 70 ip_current_src_addr(), tcphdr->dest, tcphdr->src); 71 /* Resend SYN immediately (don't wait for rto timeout) to establish 72@@ -1145,8 +1145,8 @@ tcp_process(struct tcp_pcb *pcb) 73 } else { 74 /* incorrect ACK number, send RST */ 75 LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, 76- ("tcp_process: incorrect ACK number in SYN_RCVD, send RST, ackno=%d, lastack=%d, snd_nxt=%d, dest port=%d, src port=%d\n", 77- ackno, pcb->lastack, pcb->snd_nxt, lwip_ntohs(tcphdr->dest), lwip_ntohs(tcphdr->src))); 78+ ("tcp_process: incorrect ACK number in SYN_RCVD, send RST, ackno=%d, lastack=%d, snd_nxt=%d, local_port=%d, remote_port=%d\n", 79+ ackno, pcb->lastack, pcb->snd_nxt, tcphdr->src, tcphdr->dest)); 80 tcp_rst(pcb, ackno, seqno + tcplen, ip_current_dest_addr(), 81 ip_current_src_addr(), tcphdr->dest, tcphdr->src); 82 } 83-- 842.33.0 85 86