summaryrefslogtreecommitdiffstats
path: root/lib/frrsendmmsg.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:32 +0000
commit35cadacd2bb9383686753731e31bd7e145fb2506 (patch)
tree4489adbde75a837989533837185b2b8369a0bf68 /lib/frrsendmmsg.h
parentAdding debian version 9.1-0.1. (diff)
downloadfrr-35cadacd2bb9383686753731e31bd7e145fb2506.tar.xz
frr-35cadacd2bb9383686753731e31bd7e145fb2506.zip
Merging upstream version 10.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/frrsendmmsg.h')
-rw-r--r--lib/frrsendmmsg.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/frrsendmmsg.h b/lib/frrsendmmsg.h
new file mode 100644
index 0000000..ea63d13
--- /dev/null
+++ b/lib/frrsendmmsg.h
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * FRR sendmmsg wrapper
+ * Copyright (C) 2024 by Nvidia, Inc.
+ * Donald Sharp
+ */
+#ifndef __FRRSENDMMSG_H__
+#define __FRRSENDMMSG_H__
+
+#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
+
+#endif