From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=njh.eu Received: from mail.notjusthosting.com (mail.notjusthosting.com [IPv6:2a01:4f8:a0:516f:1::1]) by passt.top (Postfix) with ESMTPS id B63805A0271 for ; Sat, 06 Sep 2025 01:56:25 +0200 (CEST) Received: from echelon-telekom.c-base.org ([80.147.140.51] helo=vlap) by mail.notjusthosting.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1uugI5-0001eE-5y; Sat, 06 Sep 2025 01:56:25 +0200 From: Volker Diels-Grabsch To: passt-dev@passt.top Subject: [PATCH] Add missing explicit PSH assignment Date: Sat, 6 Sep 2025 01:56:18 +0200 Message-ID: <20250905235618.292574-1-v@njh.eu> X-Mailer: git-send-email 2.47.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: HWMJ4TNXM5PENIOOCBUKR72IFCPGCOQH X-Message-ID-Hash: HWMJ4TNXM5PENIOOCBUKR72IFCPGCOQH X-MailFrom: v@njh.eu 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: Volker Diels-Grabsch 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: For packets with data, we set the PSH flag depending on whether it's the last chunk of data in a single receive operation from a socket. But then we reuse the same buffers for SYN segments, and oops, PSH is set randomly. This change cleans this up by setting PSH explicitly, just as we do with the other flags. --- tcp.c | 1 + tcp_internal.h | 1 + 2 files changed, 2 insertions(+) diff --git a/tcp.c b/tcp.c index dba5fdc..a27b069 100644 --- a/tcp.c +++ b/tcp.c @@ -1176,6 +1176,7 @@ int tcp_prepare_flags(const struct ctx *c, struct tcp_tap_conn *conn, th->doff = (sizeof(*th) + *optlen) / 4; th->ack = !!(flags & ACK); + th->psh = !!(flags & PSH); th->rst = !!(flags & RST); th->syn = !!(flags & SYN); th->fin = !!(flags & FIN); diff --git a/tcp_internal.h b/tcp_internal.h index 36c6533..9dae688 100644 --- a/tcp_internal.h +++ b/tcp_internal.h @@ -26,6 +26,7 @@ #define FIN (1 << 0) #define SYN (1 << 1) #define RST (1 << 2) +#define PSH (1 << 3) #define ACK (1 << 4) /* Flags for internal usage */ -- 2.47.2