49 lines
2.0 KiB
Diff
49 lines
2.0 KiB
Diff
From d609d7a16c0ab0e0215e7c84909bc19b8216727f Mon Sep 17 00:00:00 2001
|
|
From: compile_success <980965867@qq.com>
|
|
Date: Wed, 21 Sep 2022 12:06:21 +0000
|
|
Subject: [PATCH 08/21] ltran update list
|
|
|
|
---
|
|
src/ltran/ltran_forward.c | 19 +++++++++++++------
|
|
1 file changed, 13 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/src/ltran/ltran_forward.c b/src/ltran/ltran_forward.c
|
|
index 1a92348..9ca04aa 100644
|
|
--- a/src/ltran/ltran_forward.c
|
|
+++ b/src/ltran/ltran_forward.c
|
|
@@ -432,18 +432,25 @@ static __rte_always_inline void tcp_hash_table_add_conn(struct gazelle_stack *st
|
|
struct gazelle_quintuple *transfer_qtuple, uint32_t tid)
|
|
{
|
|
struct gazelle_tcp_conn *tcp_conn = NULL;
|
|
+ struct gazelle_tcp_conn_htable *conn_htable = gazelle_get_tcp_conn_htable();
|
|
|
|
- /* When lstack is the server, conn is created in tcp_handle func. lwip send the connect command after
|
|
- receiving syn, and delete conn timeout. */
|
|
- tcp_conn = gazelle_conn_get_by_quintuple(gazelle_get_tcp_conn_htable(), transfer_qtuple);
|
|
+ tcp_conn = gazelle_conn_get_by_quintuple(conn_htable, transfer_qtuple);
|
|
if (tcp_conn) {
|
|
- tcp_conn->conn_timeout = -1;
|
|
- return;
|
|
+ /* When lstack is the server, conn is created in tcp_handle func. lwip send the connect command after
|
|
+ * receiving syn, and delete conn timeout. */
|
|
+ if (tcp_conn->conn_timeout >= 0) {
|
|
+ tcp_conn->conn_timeout = -1;
|
|
+ return;
|
|
+ } else {
|
|
+ /* del old invaild conn */
|
|
+ gazelle_conn_del_by_quintuple(conn_htable, transfer_qtuple);
|
|
+ printf("del old conn port=%d\n", ntohs(transfer_qtuple->dst_port));
|
|
+ }
|
|
}
|
|
|
|
/* When lstack is the client, lwip send the connect command while calling connect func. conn is created
|
|
without a timeout */
|
|
- tcp_conn = gazelle_conn_add_by_quintuple(gazelle_get_tcp_conn_htable(), transfer_qtuple);
|
|
+ tcp_conn = gazelle_conn_add_by_quintuple(conn_htable, transfer_qtuple);
|
|
if (tcp_conn == NULL) {
|
|
LTRAN_ERR("add tcp conn htable failed\n");
|
|
return;
|
|
--
|
|
2.23.0
|
|
|