lwip log: fix wrong port log info

(cherry picked from commit 2f56e812de7bf85f19db5a2455b4b3ff7c1b9531)
This commit is contained in:
yangchen 2023-12-06 09:40:54 +08:00 committed by openeuler-sync-bot
parent faab7aa597
commit 8d2c652b68
3 changed files with 92 additions and 3 deletions

View File

@ -16,10 +16,10 @@ index f63a99e..b4a183a 100644
/* @todo: do we need to set/calculate the correct checksum? */
#if CHECKSUM_GEN_IP
- IF__NETIF_CHECKSUM_ENABLED(ip_current_input_netif(), NETIF_CHECKSUM_GEN_IP) {
+ IF__NETIF_CHECKSUM_ENABLED(default_netif, NETIF_CHECKSUM_GEN_IP) {
+ IF__NETIF_CHECKSUM_ENABLED(netif_default, NETIF_CHECKSUM_GEN_IP) {
#if CHECKSUM_GEN_IP_HW
- if (netif_get_txol_flags(ip_current_input_netif()) & DEV_TX_OFFLOAD_IPV4_CKSUM) {
+ if (netif_get_txol_flags(default_netif) & DEV_TX_OFFLOAD_IPV4_CKSUM) {
+ if (netif_get_txol_flags(netif_default) & DEV_TX_OFFLOAD_IPV4_CKSUM) {
iph_cksum_set(p, IP_HLEN, 1);
} else {
iph_cksum_set(p, IP_HLEN, 0);

View File

@ -0,0 +1,85 @@
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 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

View File

@ -4,7 +4,7 @@
Summary: lwip is a small independent implementation of the TCP/IP protocol suite
Name: lwip
Version: 2.1.3
Release: 93
Release: 94
License: BSD
URL: http://savannah.nongnu.org/projects/lwip/
Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip
@ -104,6 +104,7 @@ Patch9086: 0087-support-vlan-offload.patch
Patch9087: 0088-modify-log-info-err.patch
Patch9088: 0089-add-struct-gz-addr.patch
Patch9089: 0090-frag-fix-coredump-when-get-netif.patch
Patch9090: 0091-add-fd-log-info-and-fix-wrong-port-log-info.patch
BuildRequires: gcc-c++ dos2unix dpdk-devel
@ -134,6 +135,9 @@ cd %{_builddir}/%{name}-%{version}/src
%{_libdir}/liblwip.a
%changelog
* Fri Dec 8 2023 yangchen <yangchen145@huawei.com> - 2.1.3-94
- add fd log info and fix wrong port log info
* Fri Dec 8 2023 jiangheng <jiangheng14@huawei.com> - 2.1.3-93
- ip4 frag: fix coredump when get netif