Commit a51bb2155c for frr

commit a51bb2155cdbb9a79713e1f3a8148e434640b4af
Author: David 'equinox' Lamparter <equinox@opensourcerouting.org>
Date:   Mon Oct 5 22:29:18 2026 +0200

    lib: use `MSG_EOR` in logging code (fix FreeBSD)

    Unlike Linux (which just does it implicitly on every send call), FreeBSD
    requires using `MSG_EOR` on `SOCK_SEQPACKET` sockets to actually retain
    packet boundaries.

    The logging code expects packet boundaries to stay around, so stick it
    into its send calls.

    Signed-off-by: David 'equinox' Lamparter <equinox@opensourcerouting.org>

diff --git a/lib/zlog_5424.c b/lib/zlog_5424.c
index f9b6a3e0bd..571a1c90a2 100644
--- a/lib/zlog_5424.c
+++ b/lib/zlog_5424.c
@@ -485,8 +485,7 @@ static void zlog_5424(struct zlog_target *zt, struct zlog_msg *msgs[],
 				struct mmsghdr *sendpos;

 				for (sendpos = mmsg; sendpos < mpos;) {
-					ret = sendmmsg(fd, sendpos,
-						       mpos - sendpos, 0);
+					ret = sendmmsg(fd, sendpos, mpos - sendpos, MSG_EOR);
 					if (ret <= 0)
 						break;
 					sendpos += ret;
@@ -543,11 +542,11 @@ static void zlog_5424(struct zlog_target *zt, struct zlog_msg *msgs[],
 		need = zlog_one(zte, msgs[i], &state);
 		assert(need == 0);

-		if (!zte->sa_len)
+		if (!zte->sa_len && !zte->packets)
 			ret = writev(fd, iov, state.iov - iov);
 		else {
 			mpos->msg_hdr.msg_iovlen = state.iov - iov;
-			ret = sendmsg(fd, &mpos->msg_hdr, 0);
+			ret = sendmsg(fd, &mpos->msg_hdr, MSG_EOR);
 		}

 		if (ret < 0)
@@ -688,7 +687,7 @@ static void zlog_5424_sigsafe(struct zlog_target *zt, const char *text,

 	fd = atomic_load_explicit(&zte->fd, memory_order_relaxed);

-	if (!zte->sa_len)
+	if (!zte->sa_len && !zte->packets)
 		writev(fd, iov, iovp - iov);
 	else {
 		struct msghdr mh = {};
@@ -697,7 +696,7 @@ static void zlog_5424_sigsafe(struct zlog_target *zt, const char *text,
 		mh.msg_namelen = zte->sa_len;
 		mh.msg_iov = iov;
 		mh.msg_iovlen = iovp - iov;
-		sendmsg(fd, &mh, 0);
+		sendmsg(fd, &mh, MSG_EOR);
 	}
 }

diff --git a/lib/zlog_live.c b/lib/zlog_live.c
index d5924fc78e..6a9ecbfd1e 100644
--- a/lib/zlog_live.c
+++ b/lib/zlog_live.c
@@ -120,7 +120,7 @@ static void zlog_live(struct zlog_target *zt, struct zlog_msg *msgs[],
 	ssize_t sent;

 	for (size_t msgpos = 0; msgpos < msgtotal; msgpos += sent) {
-		sent = sendmmsg(fd, mmhs + msgpos, msgtotal - msgpos, 0);
+		sent = sendmmsg(fd, mmhs + msgpos, msgtotal - msgpos, MSG_EOR);

 		if (sent <= 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
 			atomic_fetch_add_explicit(&zte->lost_msgs,
@@ -155,6 +155,7 @@ static void zlog_live_sigsafe(struct zlog_target *zt, const char *text,
 	struct zlt_live *zte = container_of(zt, struct zlt_live, zt);
 	struct zlog_live_hdr hdr[1] = {};
 	struct iovec iovs[2], *iov = iovs;
+	struct msghdr mh[1] = {};
 	struct timespec ts;
 	int fd;

@@ -178,7 +179,9 @@ static void zlog_live_sigsafe(struct zlog_target *zt, const char *text,
 	iov->iov_len = len;
 	iov++;

-	writev(fd, iovs, iov - iovs);
+	mh->msg_iov = iovs;
+	mh->msg_iovlen = iov - iovs;
+	sendmsg(fd, mh, MSG_EOR);
 }

 void zlog_live_open(struct zlog_live_cfg *cfg, int prio_min, int *other_fd)