Thread (19 messages) 19 messages, 4 authors, 2026-02-09

Re: [PATCH net-next v2 1/4] selftests: net: Move some UAPI header inclusions after libc ones

From: Thomas Weißschuh <hidden>
Date: 2026-01-30 10:22:22
Also in: bpf, linux-kselftest, linux-security-module, lkml, mptcp, netdev

(trimmed the recipient list)

Hi Matt,

On Mon, Jan 26, 2026 at 07:13:50PM +0100, Matthieu Baerts wrote:
On 20/01/2026 15:10, Thomas Weißschuh wrote:
quoted
Interleaving inclusions of UAPI headers and libc headers is problematic.
Both sets of headers define conflicting symbols. To enable their
coexistence a compatibility-mechanism is in place.

An upcoming change will define 'struct sockaddr' from linux/socket.h.
However sys/socket.h from libc does not yet handle this case and a
symbol conflict will arise.

Furthermore libc-compat.h evaluates the state of the libc
inclusions only once, at the point it is included first. If another
problematic header from libc is included later, symbol conflicts arise.
This will trigger other duplicate definitions when linux/libc-compat.h
is added to linux/socket.h

Move the inclusion of UAPI headers after the inclusion of the glibc
ones, so the libc-compat.h continues to work correctly.
Thank you for looking at this!

Here is my (late, sorry) review for the modifications related to MPTCP:
quoted
diff --git a/tools/testing/selftests/net/mptcp/mptcp_diag.c b/tools/testing/selftests/net/mptcp/mptcp_diag.c
index 8e0b1b8d84b6..af25ebfd2915 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_diag.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_diag.c
@@ -1,11 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /* Copyright (c) 2025, Kylin Software */
 
-#include <linux/sock_diag.h>
-#include <linux/rtnetlink.h>
-#include <linux/inet_diag.h>
-#include <linux/netlink.h>
-#include <linux/compiler.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <linux/tcp.h>
There is a remaining one (linux/tcp.h) here that you might want to move
below too.
Good point.
quoted
@@ -17,6 +12,12 @@
 #include <errno.h>
 #include <stdio.h>
 
+#include <linux/sock_diag.h>
+#include <linux/rtnetlink.h>
+#include <linux/inet_diag.h>
+#include <linux/netlink.h>
+#include <linux/compiler.h>
Note that I just noticed this is the only file from this directory where
the "includes" are not sorted by type and alphabetical order, see
pm_nl_ctl.c as an example. A bit of a detail, but if you plan to send a
v2, do you mind doing that too here while at it, please?
I'll send a v3 during the next cycle.
If not, I can look at that later, but better to avoid doing that in
parallel.
If you want to fix this up already during this cycle,
that would also be most welcome.


Thomas
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help