From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id D57BD5A0276 for ; Fri, 11 Aug 2023 10:32:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1691742727; bh=zBtj99rywh6isg1d0F7bIR5xUdgesWX8AC1vhRHYpHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cKuBwyW4i0w4uTFXmapFk33XYpSP7+9s5V8srdYgeMzN7LnXv3NSaUn/TZfLJTOSi oJjZbIT02+KftFEPgJoPeN9F4RletQDBDydDV0QpDxG7ao6fOSknP4DtJjKUBzzqVo 5x9ZBv3tcqRvdutu3tU38nCsaCf+7mqUGq3149T8= Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4RMcTz2S9Pz4wy4; Fri, 11 Aug 2023 18:32:07 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH 4/6] tcp: Consistent usage of ports in tcp_seq_init() Date: Fri, 11 Aug 2023 18:32:01 +1000 Message-ID: <20230811083203.1019725-5-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230811083203.1019725-1-david@gibson.dropbear.id.au> References: <20230811083203.1019725-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: WVX5HBPMMOJCPZDMBDK3MOYQQRIUMXQA X-Message-ID-Hash: WVX5HBPMMOJCPZDMBDK3MOYQQRIUMXQA 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