代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/lwip 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From b4a2b2799c199fb2955ecaae72e7b7dbe79e593b Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Thu, 15 Jun 2023 21:42:04 +0800
Subject: [PATCH] fix null pointer when all zero address listen
---
src/core/tcp_in.c | 58 ++++++++++++++++++++++++++++-------------------
1 file changed, 35 insertions(+), 23 deletions(-)
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 59e854c..d151a96 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -114,6 +114,36 @@ static void tcp_remove_sacks_gt(struct tcp_pcb *pcb, u32_t seq);
#endif /* TCP_OOSEQ_BYTES_LIMIT || TCP_OOSEQ_PBUFS_LIMIT */
#endif /* LWIP_TCP_SACK_OUT */
+#if GAZELLE_TCP_REUSE_IPPORT
+struct tcp_pcb_listen *min_cnts_lpcb_get(struct tcp_pcb_listen *lpcb)
+{
+ struct tcp_pcb_listen *min_cnts_lpcb;
+ struct tcp_pcb_listen *tmp_lpcb = lpcb;
+ u16_t min_conn_num = GAZELLE_TCP_MAX_CONN_PER_THREAD;
+ u8_t have_master_fd = 0;
+
+ while (tmp_lpcb != NULL) {
+ if (tmp_lpcb->master_lpcb) {
+ have_master_fd = 1;
+ }
+ tmp_lpcb = tmp_lpcb->next_same_port_pcb;
+ }
+
+ tmp_lpcb = lpcb;
+ min_cnts_lpcb = lpcb;
+ while (tmp_lpcb != NULL) {
+ if (!have_master_fd || tmp_lpcb->master_lpcb) {
+ if (tmp_lpcb->connect_num < min_conn_num) {
+ min_cnts_lpcb = tmp_lpcb;
+ min_conn_num = tmp_lpcb->connect_num;
+ }
+ tmp_lpcb = tmp_lpcb->next_same_port_pcb;
+ }
+ }
+ return min_cnts_lpcb;
+}
+#endif
+
/**
* The initial input processing of TCP. It verifies the TCP header, demultiplexes
* the segment between the PCBs and passes it on to tcp_process(), which implements
@@ -384,33 +414,15 @@ tcp_input(struct pbuf *p, struct netif *inp)
if (ip_addr_eq(&lpcb->local_ip, ip_current_dest_addr())) {
/* found an exact match */
#if GAZELLE_TCP_REUSE_IPPORT
- // check master fd
- struct tcp_pcb_listen *tmp_lpcb = lpcb;
- u8_t have_master_fd = 0;
- while (tmp_lpcb != NULL) {
- if (tmp_lpcb->master_lpcb) {
- have_master_fd = 1;
- }
- tmp_lpcb = tmp_lpcb->next_same_port_pcb;
- }
-
- tmp_lpcb = lpcb;
- min_cnts_lpcb = lpcb;
- u16_t min_conn_num = GAZELLE_TCP_MAX_CONN_PER_THREAD;
- while (tmp_lpcb != NULL) {
- if (!have_master_fd || tmp_lpcb->master_lpcb) {
- if (tmp_lpcb->connect_num < min_conn_num) {
- min_cnts_lpcb = tmp_lpcb;
- min_conn_num = tmp_lpcb->connect_num;
- }
- }
- tmp_lpcb = tmp_lpcb->next_same_port_pcb;
- }
+ min_cnts_lpcb = min_cnts_lpcb_get(lpcb);
#endif
break;
} else if (ip_addr_isany(&lpcb->local_ip)) {
/* found an ANY-match */
#if SO_REUSE
+#if GAZELLE_TCP_REUSE_IPPORT
+ min_cnts_lpcb = min_cnts_lpcb_get(lpcb);
+#endif
lpcb_any = lpcb;
lpcb_prev = prev;
#else /* SO_REUSE */
@@ -458,7 +470,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
{
#if GAZELLE_TCP_REUSE_IPPORT
tcp_listen_input(min_cnts_lpcb);
- min_cnts_lpcb->connect_num++;
+ min_cnts_lpcb->connect_num++;
#else
tcp_listen_input(lpcb);
#endif
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。