From: Volker Diels-Grabsch <v@njh.eu>
To: passt-dev@passt.top
Cc: Volker Diels-Grabsch <v@njh.eu>
Subject: [PATCH] Add missing explicit PSH assignment
Date: Sat, 6 Sep 2025 01:56:18 +0200 [thread overview]
Message-ID: <20250905235618.292574-1-v@njh.eu> (raw)
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 */
--
@@ -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
next reply other threads:[~2025-09-05 23:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-05 23:56 Volker Diels-Grabsch [this message]
2025-09-06 20:20 ` [PATCH] Add missing explicit PSH assignment Stefano Brivio
2025-09-07 10:40 ` Volker Diels-Grabsch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250905235618.292574-1-v@njh.eu \
--to=v@njh.eu \
--cc=passt-dev@passt.top \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).