aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorVolker Diels-Grabsch <v@njh.eu>2025-09-06 01:56:18 +0200
committerStefano Brivio <sbrivio@redhat.com>2025-09-06 13:15:45 +0200
commitf9ee749cbb9bb1b962b37d6fd4655683b9953c13 (patch)
tree524670f098cdc8598efad0566400a7da4299d0c8
parent83afb88f0ca9a6bc51e3438367cb4e38a32567a3 (diff)
downloadpasst-f9ee749cbb9bb1b962b37d6fd4655683b9953c13.tar
passt-f9ee749cbb9bb1b962b37d6fd4655683b9953c13.tar.gz
passt-f9ee749cbb9bb1b962b37d6fd4655683b9953c13.tar.bz2
passt-f9ee749cbb9bb1b962b37d6fd4655683b9953c13.tar.lz
passt-f9ee749cbb9bb1b962b37d6fd4655683b9953c13.tar.xz
passt-f9ee749cbb9bb1b962b37d6fd4655683b9953c13.tar.zst
passt-f9ee749cbb9bb1b962b37d6fd4655683b9953c13.zip
Add missing explicit PSH assignment
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. Signed-off-by: Volker Diels-Grabsch <v@njh.eu> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--tcp.c1
-rw-r--r--tcp_internal.h1
2 files changed, 2 insertions, 0 deletions
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 */