Skip to content

Commit ec54d8f

Browse files
committed
Fix FreeBSD 15.0+ SOCK_SEQPACKET message boundary issue
On FreeBSD 15.0+, SOCK_SEQPACKET sockets require MSG_EOR flag to mark message boundaries. Using write() without MSG_EOR causes multiple messages to coalesce when reader is slow, leading to frame desynchronization and "output destination cannot be nil" errors. This fix uses send() with MSG_EOR on FreeBSD while keeping the original write_all() behavior on other platforms. Fixes: containers/podman#27918 Signed-off-by: Jindrich Novy <jnovy@redhat.com>
1 parent c4599eb commit ec54d8f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/conn_sock.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,11 @@ void write_back_to_remote_consoles(char *buf, int len)
363363
for (int i = local_mainfd_stdin.readers->len; i > 0; i--) {
364364
struct remote_sock_s *remote_sock = g_ptr_array_index(local_mainfd_stdin.readers, i - 1);
365365

366+
#ifdef __FreeBSD__
367+
if (remote_sock->writable && send(remote_sock->fd, buf, len, MSG_EOR) < 0) {
368+
#else
366369
if (remote_sock->writable && write_all(remote_sock->fd, buf, len) < 0) {
370+
#endif
367371
nwarn("Failed to write to remote console socket");
368372
remote_sock_shutdown(remote_sock, SHUT_WR);
369373
}

0 commit comments

Comments
 (0)