加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0091-add-fd-log-info-and-fix-wrong-port-log-info.patch 4.64 KB
一键复制 编辑 原始数据 按行查看 历史
jinag12 提交于 2024-02-06 10:45 . adapt lwip-2.2.0
From 9ef6e86cbbd7bff2d1980f9b88f3b6f9ec1457b5 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
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 7978504..459299a 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -2840,7 +2840,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 6e84df4..8fb9482 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_netif(ip_data.current_input_netif, 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_netif(ip_data.current_input_netif, 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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化