Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package socket_wrapper for openSUSE:Factory
checked in at 2026-12-02 16:59:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/socket_wrapper (Old)
and /work/SRC/openSUSE:Factory/.socket_wrapper.new.1340718 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "socket_wrapper"
Wed Dec 2 16:59:00 2026 rev:31 rq:1401837 version:1.5.3
Changes:
--------
--- /work/SRC/openSUSE:Factory/socket_wrapper/socket_wrapper.changes
2025-12-10 15:29:24.031380451 +0100
+++
/work/SRC/openSUSE:Factory/.socket_wrapper.new.1340718/socket_wrapper.changes
2026-12-02 17:00:11.690372140 +0100
@@ -1,0 +2,8 @@
+Tue Dec 1 08:45:18 UTC 2026 - Andreas Schneider <[email protected]>
+
+- Update to version 1.5.3
+ * Test for UDP broadcast
+ * Raised the maximum of wrapped interfaces from 64 to 128
+ * Scan the socket directory only once per broadcast
+
+-------------------------------------------------------------------
Old:
----
socket_wrapper-1.5.2.tar.gz
socket_wrapper-1.5.2.tar.gz.asc
New:
----
socket_wrapper-1.5.3.tar.gz
socket_wrapper-1.5.3.tar.gz.asc
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ socket_wrapper.spec ++++++
--- /var/tmp/diff_new_pack.6dN8pm/_old 2026-12-02 17:00:12.601410672 +0100
+++ /var/tmp/diff_new_pack.6dN8pm/_new 2026-12-02 17:00:12.602410714 +0100
@@ -1,7 +1,7 @@
#
# spec file for package socket_wrapper
#
-# Copyright (c) 2025 SUSE LLC and contributors
+# Copyright (c) 2026 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
############################# NOTE ##################################
Name: socket_wrapper
-Version: 1.5.2
+Version: 1.5.3
Release: 0
Summary: A library passing all socket communications through Unix
sockets
License: BSD-3-Clause
++++++ socket_wrapper-1.5.2.tar.gz -> socket_wrapper-1.5.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/socket_wrapper-1.5.2/CHANGELOG.md
new/socket_wrapper-1.5.3/CHANGELOG.md
--- old/socket_wrapper-1.5.2/CHANGELOG.md 2025-12-09 10:07:05.000000000
+0100
+++ new/socket_wrapper-1.5.3/CHANGELOG.md 2026-11-26 08:19:52.000000000
+0100
@@ -4,6 +4,15 @@
The format is based on [Keep a
Changelog](https://keepachangelog.com/en/1.1.0/).
+## [1.5.3] - 2026-11-26
+
+### Added
+- Test for UDP broadcast
+
+### Changed
+- Raised the maximum of wrapped interfaces from 64 to 128
+- Scan the socket directory only once per broadcast
+
## [1.5.2] - 2025-12-08
### Added
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/socket_wrapper-1.5.2/CMakeLists.txt
new/socket_wrapper-1.5.3/CMakeLists.txt
--- old/socket_wrapper-1.5.2/CMakeLists.txt 2025-12-09 10:07:05.000000000
+0100
+++ new/socket_wrapper-1.5.3/CMakeLists.txt 2026-11-26 08:19:52.000000000
+0100
@@ -10,7 +10,7 @@
include(DefineCMakeDefaults)
include(DefineCompilerFlags)
-project(socket_wrapper VERSION 1.5.2 LANGUAGES C)
+project(socket_wrapper VERSION 1.5.3 LANGUAGES C)
# global needed variables
set(APPLICATION_NAME ${PROJECT_NAME})
@@ -24,7 +24,7 @@
# Increment PATCH.
set(LIBRARY_VERSION_MAJOR 0)
set(LIBRARY_VERSION_MINOR 5)
-set(LIBRARY_VERSION_PATCH 2)
+set(LIBRARY_VERSION_PATCH 3)
set(LIBRARY_VERSION
"${LIBRARY_VERSION_MAJOR}.${LIBRARY_VERSION_MINOR}.${LIBRARY_VERSION_PATCH}")
set(LIBRARY_SOVERSION ${LIBRARY_VERSION_MAJOR})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/socket_wrapper-1.5.2/doc/socket_wrapper.1
new/socket_wrapper-1.5.3/doc/socket_wrapper.1
--- old/socket_wrapper-1.5.2/doc/socket_wrapper.1 2025-12-09
10:07:05.000000000 +0100
+++ new/socket_wrapper-1.5.3/doc/socket_wrapper.1 2026-11-26
07:57:18.000000000 +0100
@@ -111,7 +111,7 @@
.RS 4
Additionally, the default interface to be used by an application is defined
with
"SOCKET_WRAPPER_DEFAULT_IFACE=<ID>" where the valid range for <ID> starts with
1
-(the default) and ends with 64. This is analogous to use the IPv4 addresses
+(the default) and ends with 128. This is analogous to use the IPv4 addresses
"127.0.0.<ID>"/"10.53.57.<ID>" or IPv6 addresses "fd00::5357:5f<IDx>" (where
<IDx> is a hexadecimal presentation of <ID>). You should always set the default
interface. If you listen on INADDR_ANY then it will use the default interface
to
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/socket_wrapper-1.5.2/doc/socket_wrapper.1.adoc
new/socket_wrapper-1.5.3/doc/socket_wrapper.1.adoc
--- old/socket_wrapper-1.5.2/doc/socket_wrapper.1.adoc 2025-12-09
10:07:05.000000000 +0100
+++ new/socket_wrapper-1.5.3/doc/socket_wrapper.1.adoc 2026-11-26
07:57:18.000000000 +0100
@@ -55,7 +55,7 @@
Additionally, the default interface to be used by an application is defined
with
"SOCKET_WRAPPER_DEFAULT_IFACE=<ID>" where the valid range for <ID> starts with
1
-(the default) and ends with 64. This is analogous to use the IPv4 addresses
+(the default) and ends with 128. This is analogous to use the IPv4 addresses
"127.0.0.<ID>"/"10.53.57.<ID>" or IPv6 addresses "fd00::5357:5f<IDx>" (where
<IDx> is a hexadecimal presentation of <ID>). You should always set the default
interface. If you listen on INADDR_ANY then it will use the default interface
to
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/socket_wrapper-1.5.2/src/socket_wrapper.c
new/socket_wrapper-1.5.3/src/socket_wrapper.c
--- old/socket_wrapper-1.5.2/src/socket_wrapper.c 2025-12-09
10:07:05.000000000 +0100
+++ new/socket_wrapper-1.5.3/src/socket_wrapper.c 2026-11-26
07:57:18.000000000 +0100
@@ -53,6 +53,7 @@
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
+#include <dirent.h>
#ifdef HAVE_SYS_SYSCALL_H
#include <sys/syscall.h>
#endif
@@ -296,10 +297,12 @@
#define SOCKET_WRAPPER_MAX_SOCKETS_LIMIT 262140
-/* This limit is to avoid broadcast sendto() needing to stat too many
- * files. It may be raised (with a performance cost) to up to 254
- * without changing the format above */
-#define MAX_WRAPPED_INTERFACES 64
+/*
+ * This limit bounds the valid interface IDs and the number of files a
+ * broadcast sendto() needs to stat. It may be raised (with a performance
+ * cost) to up to 254 without changing the format above.
+ */
+#define MAX_WRAPPED_INTERFACES 128
struct swrap_address {
socklen_t sa_socklen;
@@ -7438,6 +7441,10 @@
* SENDTO
***************************************************************************/
+static int swrap_bcast_ifaces(const char *swrap_dir,
+ unsigned int prt,
+ bool bcast_iface[static const
MAX_WRAPPED_INTERFACES + 1]);
+
static ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags,
const struct sockaddr *to, socklen_t tolen)
{
@@ -7486,7 +7493,7 @@
len = msg.msg_iov[0].iov_len;
if (bcast) {
- struct stat st;
+ bool bcast_iface[MAX_WRAPPED_INTERFACES + 1];
unsigned int iface;
unsigned int prt = ntohs(((const struct sockaddr_in *)(const
void *)to)->sin_port);
char type;
@@ -7499,13 +7506,22 @@
return -1;
}
+ rc = swrap_bcast_ifaces(swrap_dir, prt, bcast_iface);
+ if (rc < 0) {
+ int saved_errno = errno;
+ SAFE_FREE(swrap_dir);
+ errno = saved_errno;
+ return -1;
+ }
+
for(iface=0; iface <= MAX_WRAPPED_INTERFACES; iface++) {
+ if (!bcast_iface[iface]) continue;
+
swrap_un_path(&un_addr.sa.un,
swrap_dir,
type,
iface,
prt);
- if (stat(un_addr.sa.un.sun_path, &st) != 0) continue;
/* ignore the any errors in broadcast sends */
libc_sendto(s,
@@ -8209,7 +8225,7 @@
}
if (bcast) {
- struct stat st;
+ bool bcast_iface[MAX_WRAPPED_INTERFACES + 1];
unsigned int iface;
unsigned int prt = ntohs(((const struct sockaddr_in *)(const
void *)to)->sin_port);
char type;
@@ -8260,9 +8276,22 @@
return -1;
}
+ rc = swrap_bcast_ifaces(swrap_dir, prt, bcast_iface);
+ if (rc < 0) {
+ int saved_errno = errno;
+#ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL
+ SAFE_FREE(msg.msg_control);
+#endif
+ SAFE_FREE(buf);
+ SAFE_FREE(swrap_dir);
+ errno = saved_errno;
+ return -1;
+ }
+
for(iface=0; iface <= MAX_WRAPPED_INTERFACES; iface++) {
+ if (!bcast_iface[iface]) continue;
+
swrap_un_path(&un_addr, swrap_dir, type, iface, prt);
- if (stat(un_addr.sun_path, &st) != 0) continue;
msg.msg_name = &un_addr; /* optional address
*/
msg.msg_namelen = sizeof(un_addr); /* size of address */
@@ -8444,7 +8473,7 @@
struct msghdr *msg = &msgvec[i].msg_hdr;
struct sockaddr_un *un_addr = &tmp[i].un_addr;
const struct sockaddr *to = tmp[i].to;
- struct stat st;
+ bool bcast_iface[MAX_WRAPPED_INTERFACES + 1];
unsigned int iface;
unsigned int prt = ntohs(((const struct sockaddr_in
*)(const void *)to)->sin_port);
char type;
@@ -8479,9 +8508,19 @@
type = SOCKET_TYPE_CHAR_UDP;
+ rc = swrap_bcast_ifaces(swrap_dir, prt, bcast_iface);
+ if (rc < 0) {
+ int saved_errno_scan = errno;
+ SAFE_FREE(buf);
+ errno = saved_errno_scan;
+ ret = -1;
+ goto fail_swrap;
+ }
+
for(iface=0; iface <= MAX_WRAPPED_INTERFACES; iface++) {
+ if (!bcast_iface[iface]) continue;
+
swrap_un_path(un_addr, swrap_dir, type, iface,
prt);
- if (stat(un_addr->sun_path, &st) != 0) continue;
msg->msg_name = un_addr; /*
optional address */
msg->msg_namelen = sizeof(*un_addr); /* size of
address */
@@ -8546,6 +8585,159 @@
}
#endif /* HAVE_SENDMMSG */
+static bool swrap_bcast_name_iface(const char *name,
+ unsigned int prt,
+ unsigned int *_iface);
+static bool swrap_hex_to_uint(const char *s, size_t n, unsigned int *_value);
+
+/*
+ * Find the interfaces with a UDP socket bound to a port.
+ *
+ * Reads swrap_dir once instead of calling stat() for every possible
+ * interface. Only names that match SOCKET_FORMAT for a UDP socket on port
+ * are considered. The file type is not checked, the same as the stat()
+ * based lookup this replaces.
+ *
+ * @param[in] swrap_dir The socket_wrapper directory.
+ *
+ * @param[in] port The port in host byte order.
+ *
+ * @param[out] bcast_iface bcast_iface[iface] is set for every interface that
+ * has a UDP socket bound to port. All entries are
+ * cleared first.
+ *
+ * @return 0 on success, -1 with errno set if the directory can't be read.
+ */
+static int swrap_bcast_ifaces(const char *swrap_dir,
+ unsigned int port,
+ bool bcast_iface[static const
MAX_WRAPPED_INTERFACES + 1])
+{
+ DIR *dir = NULL;
+ struct dirent *de = NULL;
+ int saved_errno;
+
+ memset(bcast_iface, 0, (MAX_WRAPPED_INTERFACES + 1) * sizeof(bool));
+
+ dir = opendir(swrap_dir);
+ if (dir == NULL) {
+ return -1;
+ }
+
+ /*
+ * readdir() returns NULL for both the end of the directory and an
+ * error. Only errno tells them apart, so it must be cleared right
+ * before every call.
+ */
+ errno = 0;
+ de = readdir(dir);
+ while (de != NULL) {
+ unsigned int iface = 0;
+ bool match;
+
+ match = swrap_bcast_name_iface(de->d_name, port, &iface);
+ if (match) {
+ bcast_iface[iface] = true;
+ }
+
+ errno = 0;
+ de = readdir(dir);
+ }
+
+ /* Fail closed: a read error must not look like "no receivers" */
+ saved_errno = errno;
+ closedir(dir);
+ if (saved_errno != 0) {
+ errno = saved_errno;
+ return -1;
+ }
+
+ return 0;
+}
+
+/*
+ * Check if a directory entry is a UDP socket bound to a port.
+ *
+ * @param[in] name The directory entry name.
+ *
+ * @param[in] port The port in host byte order.
+ *
+ * @param[out] _iface The interface of the socket, only set on a match.
+ *
+ * @return true if name is a UDP socket on port and a valid interface.
+ */
+static bool swrap_bcast_name_iface(const char *name,
+ unsigned int port,
+ unsigned int *_iface)
+{
+ /* One type character, two hex digits for the interface, four for the
port */
+ const size_t name_len = 1 + 2 + 4;
+ uint32_t iface = 0;
+ uint32_t iface_port = 0;
+ size_t len;
+ bool ok;
+
+ if (name == NULL || name[0] != SOCKET_TYPE_CHAR_UDP) {
+ return false;
+ }
+
+ len = strlen(name);
+ if (len != name_len) {
+ return false;
+ }
+
+ ok = swrap_hex_to_uint(name + 3, 4, &iface_port);
+ if (!ok || iface_port != port) {
+ return false;
+ }
+
+ ok = swrap_hex_to_uint(name + 1, 2, &iface);
+ if (!ok || iface > MAX_WRAPPED_INTERFACES) {
+ return false;
+ }
+
+ *_iface = iface;
+
+ return true;
+}
+
+/*
+ * Parse upper case hex digits.
+ *
+ * This is much faster than sscanf().
+ *
+ * @param[in] s The digits, not necessarily NUL terminated.
+ *
+ * @param[in] n The number of digits to parse.
+ *
+ * @param[out] _value The parsed value, only set on success.
+ *
+ * @return true if the first n characters of s are all hex digits.
+ */
+static bool swrap_hex_to_uint(const char *s, size_t n, uint32_t *_value)
+{
+ uint32_t value = 0;
+ size_t i;
+
+ for (i = 0; i < n; i++) {
+ char c = s[i];
+ uint32_t digit;
+
+ if (c >= '0' && c <= '9') {
+ digit = c - '0';
+ } else if (c >= 'A' && c <= 'F') {
+ digit = c - 'A' + 10;
+ } else {
+ return false;
+ }
+
+ value = (value << 4U) | digit;
+ }
+
+ *_value = value;
+
+ return true;
+}
+
/****************************************************************************
* READV
***************************************************************************/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/socket_wrapper-1.5.2/src/socket_wrapper.h
new/socket_wrapper-1.5.3/src/socket_wrapper.h
--- old/socket_wrapper-1.5.2/src/socket_wrapper.h 2025-05-06
10:09:04.000000000 +0200
+++ new/socket_wrapper-1.5.3/src/socket_wrapper.h 2026-11-26
07:57:18.000000000 +0100
@@ -47,7 +47,7 @@
Applications with the need to alter their behaviour when
socket wrapper is active, can link use these functions.
- By default it's required for applications to use any of these
+ By default it's not required for applications to use any of these
functions as libsocket_wrapper.so is injected at runtime via
LD_PRELOAD.
@@ -68,7 +68,7 @@
*
* socket_wrapper may not be able to intercept the __close_nocancel()
* syscall made from within libc.so. As result it's possible
- * that the in memory meta date of socket_wrapper references
+ * that the in memory meta data of socket_wrapper references
* stale file descriptors, which are already reused for unrelated
* kernel objects, e.g. files, directories, ...
*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/socket_wrapper-1.5.2/tests/CMakeLists.txt
new/socket_wrapper-1.5.3/tests/CMakeLists.txt
--- old/socket_wrapper-1.5.2/tests/CMakeLists.txt 2025-12-09
10:07:05.000000000 +0100
+++ new/socket_wrapper-1.5.3/tests/CMakeLists.txt 2026-11-26
07:57:18.000000000 +0100
@@ -94,6 +94,7 @@
test_echo_udp_sendto_recvfrom
test_echo_udp_send_recv
test_echo_udp_sendmsg_recvmsg
+ test_echo_udp_broadcast
test_max_sockets
test_public_functions
test_close_failure
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/socket_wrapper-1.5.2/tests/test_echo_udp_broadcast.c
new/socket_wrapper-1.5.3/tests/test_echo_udp_broadcast.c
--- old/socket_wrapper-1.5.2/tests/test_echo_udp_broadcast.c 1970-01-01
01:00:00.000000000 +0100
+++ new/socket_wrapper-1.5.3/tests/test_echo_udp_broadcast.c 2026-11-26
07:57:18.000000000 +0100
@@ -0,0 +1,323 @@
+/*
+ * Tests for UDP broadcast fan-out.
+ *
+ * A datagram sent to the wrapped IPv4 broadcast address (127.255.255.255)
+ * must reach every UDP socket bound to the destination port, on any wrapped
+ * interface. Also it must not reach sockets bound to other ports.
+ */
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <cmocka.h>
+
+#include "config.h"
+#include "torture.h"
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#define BCAST_ADDR "127.255.255.255"
+#define BCAST_PORT 137
+#define OTHER_PORT 138
+#define OTHER_IP "127.0.0.30"
+
+/* Interfaces with a socket bound to BCAST_PORT */
+static const char *const recv_ips[] = {
+ "127.0.0.10",
+ "127.0.0.20",
+ "127.0.0.128", /* highest valid interface */
+};
+
+#define NUM_RECV_IPS (sizeof(recv_ips) / sizeof(recv_ips[0]))
+
+struct bcast_sockets {
+ int recv_fds[NUM_RECV_IPS];
+ int other_fd;
+ int sender_fd;
+};
+
+static void bcast_sockets_open(struct bcast_sockets *bs);
+static void bcast_sockets_close(struct bcast_sockets *bs);
+static int udp_socket(void);
+static int udp_bind(const char *ip, int port);
+static void bcast_addr(struct torture_address *addr, int port);
+static void assert_received(int fd, const char *payload, size_t len);
+static void assert_nothing_received(int fd);
+
+static int setup(void **state)
+{
+ torture_setup_socket_dir(state);
+
+ return 0;
+}
+
+static int teardown(void **state)
+{
+ torture_teardown_socket_dir(state);
+
+ return 0;
+}
+
+/* sendto() to the broadcast address reaches exactly the port's listeners */
+static void test_broadcast_sendto(void **state)
+{
+ struct torture_address addr = {
+ .sa_socklen = sizeof(struct sockaddr_in),
+ };
+ struct bcast_sockets bs = {};
+ char payload[] = "bcast.sendto";
+ ssize_t ret;
+ size_t i;
+
+ (void) state; /* unused */
+
+ bcast_sockets_open(&bs);
+ bcast_addr(&addr, BCAST_PORT);
+
+ ret = sendto(bs.sender_fd,
+ payload,
+ sizeof(payload),
+ 0,
+ &addr.sa.s,
+ addr.sa_socklen);
+ assert_int_equal(ret, sizeof(payload));
+
+ for (i = 0; i < NUM_RECV_IPS; i++) {
+ assert_received(bs.recv_fds[i], payload, sizeof(payload));
+ }
+ assert_nothing_received(bs.other_fd);
+
+ bcast_sockets_close(&bs);
+}
+
+/* sendmsg() to the broadcast address reaches exactly the port's listeners */
+static void test_broadcast_sendmsg(void **state)
+{
+ struct torture_address addr = {
+ .sa_socklen = sizeof(struct sockaddr_in),
+ };
+ struct bcast_sockets bs = {};
+ char payload[] = "bcast.sendmsg";
+ struct iovec iov = {
+ .iov_base = payload,
+ .iov_len = sizeof(payload),
+ };
+ struct msghdr msg = {
+ .msg_iov = &iov,
+ .msg_iovlen = 1,
+ };
+ ssize_t ret;
+ size_t i;
+
+ (void) state; /* unused */
+
+ bcast_sockets_open(&bs);
+ bcast_addr(&addr, BCAST_PORT);
+
+ msg.msg_name = &addr.sa.s;
+ msg.msg_namelen = addr.sa_socklen;
+
+ ret = sendmsg(bs.sender_fd, &msg, 0);
+ assert_int_equal(ret, sizeof(payload));
+
+ for (i = 0; i < NUM_RECV_IPS; i++) {
+ assert_received(bs.recv_fds[i], payload, sizeof(payload));
+ }
+ assert_nothing_received(bs.other_fd);
+
+ bcast_sockets_close(&bs);
+}
+
+#ifdef HAVE_SENDMMSG
+/*
+ * sendmmsg() with broadcasts to two ports delivers each message only to the
+ * listeners of its own port.
+ */
+static void test_broadcast_sendmmsg(void **state)
+{
+ struct torture_address addrs[2] = {
+ { .sa_socklen = sizeof(struct sockaddr_in) },
+ { .sa_socklen = sizeof(struct sockaddr_in) },
+ };
+ struct bcast_sockets bs = {};
+ char payload_port[] = "bcast.sendmmsg.port";
+ char payload_other[] = "bcast.sendmmsg.other";
+ struct iovec iovs[2] = {
+ { .iov_base = payload_port, .iov_len = sizeof(payload_port) },
+ { .iov_base = payload_other, .iov_len = sizeof(payload_other) },
+ };
+ struct mmsghdr msgs[2] = {};
+ int ret;
+ size_t i;
+
+ (void) state; /* unused */
+
+ bcast_sockets_open(&bs);
+ bcast_addr(&addrs[0], BCAST_PORT);
+ bcast_addr(&addrs[1], OTHER_PORT);
+
+ for (i = 0; i < 2; i++) {
+ msgs[i].msg_hdr.msg_name = &addrs[i].sa.s;
+ msgs[i].msg_hdr.msg_namelen = addrs[i].sa_socklen;
+ msgs[i].msg_hdr.msg_iov = &iovs[i];
+ msgs[i].msg_hdr.msg_iovlen = 1;
+ }
+
+ ret = sendmmsg(bs.sender_fd, msgs, 2, 0);
+ assert_int_equal(ret, 2);
+
+ for (i = 0; i < NUM_RECV_IPS; i++) {
+ assert_received(bs.recv_fds[i],
+ payload_port,
+ sizeof(payload_port));
+ assert_nothing_received(bs.recv_fds[i]);
+ }
+ assert_received(bs.other_fd, payload_other, sizeof(payload_other));
+ assert_nothing_received(bs.other_fd);
+
+ bcast_sockets_close(&bs);
+}
+#endif /* HAVE_SENDMMSG */
+
+/* Bind the listeners and create a broadcast-enabled sender */
+static void bcast_sockets_open(struct bcast_sockets *bs)
+{
+ int one = 1;
+ size_t i;
+ int rc;
+
+ for (i = 0; i < NUM_RECV_IPS; i++) {
+ bs->recv_fds[i] = udp_bind(recv_ips[i], BCAST_PORT);
+ }
+ bs->other_fd = udp_bind(OTHER_IP, OTHER_PORT);
+
+ bs->sender_fd = udp_socket();
+
+ rc = setsockopt(bs->sender_fd,
+ SOL_SOCKET,
+ SO_BROADCAST,
+ &one,
+ sizeof(one));
+ assert_return_code(rc, errno);
+}
+
+static void bcast_sockets_close(struct bcast_sockets *bs)
+{
+ size_t i;
+
+ for (i = 0; i < NUM_RECV_IPS; i++) {
+ close(bs->recv_fds[i]);
+ }
+ close(bs->other_fd);
+ close(bs->sender_fd);
+}
+
+/* Return a new UDP socket */
+static int udp_socket(void)
+{
+ int s;
+
+ s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+ assert_return_code(s, errno);
+ if (s < 0) {
+ /*
+ * Never reached. Static analyzers don't know that a failed
+ * cmocka assert stops the test.
+ */
+ abort();
+ }
+
+ return s;
+}
+
+/* Return a UDP socket bound to ip:port */
+static int udp_bind(const char *ip, int port)
+{
+ struct torture_address addr = {
+ .sa_socklen = sizeof(struct sockaddr_in),
+ };
+ int rc;
+ int s;
+
+ s = udp_socket();
+
+ addr.sa.in.sin_family = AF_INET;
+ addr.sa.in.sin_port = htons(port);
+
+ rc = inet_pton(AF_INET, ip, &addr.sa.in.sin_addr);
+ assert_int_equal(rc, 1);
+
+ rc = bind(s, &addr.sa.s, addr.sa_socklen);
+ assert_return_code(rc, errno);
+
+ return s;
+}
+
+static void bcast_addr(struct torture_address *addr, int port)
+{
+ int rc;
+
+ addr->sa.in.sin_family = AF_INET;
+ addr->sa.in.sin_port = htons(port);
+
+ rc = inet_pton(AF_INET, BCAST_ADDR, &addr->sa.in.sin_addr);
+ assert_int_equal(rc, 1);
+}
+
+/*
+ * Wrapped UDP is backed by AF_UNIX datagram sockets, so a broadcast is
+ * already queued when the send call returns and a non-blocking receive is
+ * deterministic.
+ */
+static void assert_received(int fd, const char *payload, size_t len)
+{
+ char buf[64] = {0};
+ ssize_t ret;
+
+ ret = recv(fd, buf, sizeof(buf), MSG_DONTWAIT);
+ assert_return_code(ret, errno);
+ assert_int_equal(ret, len);
+ assert_memory_equal(buf, payload, len);
+}
+
+static void assert_nothing_received(int fd)
+{
+ char buf[64] = {0};
+ ssize_t ret;
+ int err;
+
+ ret = recv(fd, buf, sizeof(buf), MSG_DONTWAIT);
+ err = errno;
+ assert_int_equal(ret, -1);
+ assert_true(err == EAGAIN || err == EWOULDBLOCK);
+}
+
+int main(void) {
+ int rc;
+
+ const struct CMUnitTest bcast_tests[] = {
+ cmocka_unit_test_setup_teardown(test_broadcast_sendto,
+ setup,
+ teardown),
+ cmocka_unit_test_setup_teardown(test_broadcast_sendmsg,
+ setup,
+ teardown),
+#ifdef HAVE_SENDMMSG
+ cmocka_unit_test_setup_teardown(test_broadcast_sendmmsg,
+ setup,
+ teardown),
+#endif
+ };
+
+ rc = cmocka_run_group_tests(bcast_tests, NULL, NULL);
+
+ return rc;
+}
++++++ socket_wrapper-rpmlintrc ++++++
--- /var/tmp/diff_new_pack.6dN8pm/_old 2026-12-02 17:00:12.739416509 +0100
+++ /var/tmp/diff_new_pack.6dN8pm/_new 2026-12-02 17:00:12.744416721 +0100
@@ -4,8 +4,5 @@
#
# Learn more at http://cwrap.org
#
-addFilter("shlib-policy-name-error")
-addFilter("shared-lib-calls-exit")
addFilter("devel-file-in-non-devel-package")
-addFilter("shared-lib-without-dependency-information")