From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 549825A0274 for ; Fri, 11 Aug 2023 14:54:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1691758448; bh=zBtj99rywh6isg1d0F7bIR5xUdgesWX8AC1vhRHYpHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wsb+Vywq++BJME+7r6S2mTLZIm9K+bRRr5NWfE9XT2o+dBP/CVJ5W9nF/NXfZvLTm 7vzsejaJr81QeLnMtrAsi+1H1QWZw9D/eVDPIL2OHLB8DCZR7ekjE5QYM1H8yvHKHV c/iUeUpvC2g+P9WuCvgQNyGdo56rYLR0h8dxIEvM= Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4RMkJJ3cJNz4wy4; Fri, 11 Aug 2023 22:54:08 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 4/7] tcp: Consistent usage of ports in tcp_seq_init() Date: Fri, 11 Aug 2023 22:54:02 +1000 Message-ID: <20230811125405.1364340-5-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230811125405.1364340-1-david@gibson.dropbear.id.au> References: <20230811125405.1364340-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: N64NTOESHW3APOZ2YZXPZR36LHX642AO X-Message-ID-Hash: N64NTOESHW3APOZ2YZXPZR36LHX642AO X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: In tcp_seq_init() the meaning of "src" and "dst" isn't really clear since it's used for connections in both directions. However, these values are just feeding a hash, so as long as we're consistent and include all the information we want, it doesn't really matter. Oddly, for the "src" side we supply the (tap side) forwarding address but the (tap side) endpoint port. This again doesn't really matter, but it's confusing. So swap this with dstport, so "src" is always forwarding and "dst" is always endpoint. Signed-off-by: David Gibson --- tcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tcp.c b/tcp.c index 74bf744..56634c9 100644 --- a/tcp.c +++ b/tcp.c @@ -1857,8 +1857,8 @@ static void tcp_seq_init(const struct ctx *c, struct tcp_tap_conn *conn, in_port_t dstport; } __attribute__((__packed__)) in = { .src = conn->faddr, - .srcport = conn->eport, - .dstport = conn->fport, + .srcport = conn->fport, + .dstport = conn->eport, }; uint32_t ns, seq = 0; -- 2.41.0