summaryrefslogtreecommitdiff
path: root/lib/zebra.h
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2021-04-10 23:03:58 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2022-01-17 00:38:56 +0100
commitd948c317c579ad7674baf9b88a199e69cdb35933 (patch)
treee8d67c48b9f49529fa5e817f5aae1319db89cab9 /lib/zebra.h
parent939e32702a04f07dd9e2d29e1b516d4bf43bd56e (diff)
build: check for sendmmsg() and struct mmsghdr
These will be used by the RFC5424 log target. Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'lib/zebra.h')
-rw-r--r--lib/zebra.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/zebra.h b/lib/zebra.h
index 139e47e8d7..e8ddd869bb 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -230,6 +230,26 @@ size_t strlcpy(char *__restrict dest,
const char *__restrict src, size_t destsize);
#endif
+#if !defined(HAVE_STRUCT_MMSGHDR_MSG_HDR) || !defined(HAVE_SENDMMSG)
+/* avoid conflicts in case we have partial support */
+#define mmsghdr frr_mmsghdr
+#define sendmmsg frr_sendmmsg
+
+struct mmsghdr {
+ struct msghdr msg_hdr;
+ unsigned int msg_len;
+};
+
+/* just go 1 at a time here, the loop this is used in will handle the rest */
+static inline int sendmmsg(int fd, struct mmsghdr *mmh, unsigned int len,
+ int flags)
+{
+ int rv = sendmsg(fd, &mmh->msg_hdr, 0);
+
+ return rv > 0 ? 1 : rv;
+}
+#endif
+
/*
* RFC 3542 defines several macros for using struct cmsghdr.
* Here, we define those that are not present