lwip/0102-dfx-add-tcp_in-empty-ack-cnt-and-del-rst-invalid-log.patch
jiangheng c341686f0a adapt lwip-2.2.0
(cherry picked from commit 63c40c2ad66e5b32d96cecad0b123db28783ae5c)
2024-02-17 14:46:44 +08:00

77 lines
2.9 KiB
Diff

From 105f7e2a5828d1999bdbf0bb64d336f22dc67859 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Mon, 8 Jan 2024 15:22:09 +0800
Subject: [PATCH] dfx: add tcp_in empty ack cnt and del rst invalid log
---
src/core/tcp_in.c | 8 ++++++--
src/include/lwip/stats.h | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 118210a..d6f54b6 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -523,6 +523,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
if (pcb->rcv_ann_wnd == 0) {
/* this is a zero-window probe, we respond to it with current RCV.NXT
and drop the data segment */
+ MIB2_STATS_INC(mib2.tcpinemptyacks);
tcp_send_empty_ack(pcb);
}
TCP_STATS_INC(tcp.drop);
@@ -687,8 +688,7 @@ aborted:
if (!(TCPH_FLAGS(tcphdr) & TCP_RST)) {
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, local_port=%d, remote_port=%d\n",
+ LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_input: no PCB match found, send RST, local_port=%d, remote_port=%d\n",
tcphdr->dest, tcphdr->src));
tcp_rst_netif(ip_data.current_input_netif, ackno, seqno + tcplen, ip_current_dest_addr(),
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
@@ -1517,6 +1517,7 @@ tcp_receive(struct tcp_pcb *pcb)
/* End of ACK for new data processing. */
} else {
/* Out of sequence ACK, didn't really ack anything */
+ MIB2_STATS_INC(mib2.tcpinemptyacks);
tcp_send_empty_ack(pcb);
}
@@ -1818,6 +1819,7 @@ tcp_receive(struct tcp_pcb *pcb)
but lwIP currently does not support including SACKs in data packets. So we force
it to respond with an empty ACK packet (only if there is at least one SACK to be sent).
NOTE: tcp_send_empty_ack() on success clears the ACK flags (set by tcp_ack()) */
+ MIB2_STATS_INC(mib2.tcpinemptyacks);
tcp_send_empty_ack(pcb);
}
#endif /* LWIP_TCP_SACK_OUT */
@@ -2058,10 +2060,12 @@ tcp_receive(struct tcp_pcb *pcb)
/* We send the ACK packet after we've (potentially) dealt with SACKs,
so they can be included in the acknowledgment. */
+ MIB2_STATS_INC(mib2.tcpinemptyacks);
tcp_send_empty_ack(pcb);
}
} else {
/* The incoming segment is not within the window. */
+ MIB2_STATS_INC(mib2.tcpinemptyacks);
tcp_send_empty_ack(pcb);
}
} else {
diff --git a/src/include/lwip/stats.h b/src/include/lwip/stats.h
index 805836c..08c34e9 100644
--- a/src/include/lwip/stats.h
+++ b/src/include/lwip/stats.h
@@ -156,6 +156,7 @@ struct stats_mib2 {
u32_t tcpoutofseq;
u32_t tcpacceptmboxfull;
u32_t tcplistendrops;
+ u32_t tcpinemptyacks;
/* UDP */
u32_t udpindatagrams;
--
2.33.0