]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-107812: extend `socket`'s netlink support to FreeBSD (gh-107813)
authorMina Galić <me+github@igalic.co>
Thu, 10 Aug 2023 00:47:46 +0000 (01:47 +0100)
committerGitHub <noreply@github.com>
Thu, 10 Aug 2023 00:47:46 +0000 (00:47 +0000)
Misc/NEWS.d/next/Library/2023-08-09-15-37-20.gh-issue-107812.CflAXa.rst [new file with mode: 0644]
Modules/socketmodule.h
configure
configure.ac
pyconfig.h.in

diff --git a/Misc/NEWS.d/next/Library/2023-08-09-15-37-20.gh-issue-107812.CflAXa.rst b/Misc/NEWS.d/next/Library/2023-08-09-15-37-20.gh-issue-107812.CflAXa.rst
new file mode 100644 (file)
index 0000000..0aac44f
--- /dev/null
@@ -0,0 +1 @@
+Extend socket's netlink support to the FreeBSD platform.
index 663ae3d6e0dd6cac2126f05d54c390e0cca3eb1c..47146a28e02c8f4a7ced3d2faec2c53558cf7115 100644 (file)
@@ -100,6 +100,8 @@ typedef int socklen_t;
 #  include <asm/types.h>
 # endif
 # include <linux/netlink.h>
+#elif defined(HAVE_NETLINK_NETLINK_H)
+# include <netlink/netlink.h>
 #else
 #  undef AF_NETLINK
 #endif
index 80b4a001c6d6d799ea7fdcf17147bdc9b0e15e40..aaacf8d2669c1637d4ddca09abb90bd3d0a23ee8 100755 (executable)
--- a/configure
+++ b/configure
@@ -11153,6 +11153,7 @@ fi
 
 
 # On Linux, netlink.h requires asm/types.h
+# On FreeBSD, netlink.h is located in netlink/netlink.h
 ac_fn_c_check_header_compile "$LINENO" "linux/netlink.h" "ac_cv_header_linux_netlink_h" "
 #ifdef HAVE_ASM_TYPES_H
 #include <asm/types.h>
@@ -11167,6 +11168,20 @@ then :
   printf "%s\n" "#define HAVE_LINUX_NETLINK_H 1" >>confdefs.h
 
 fi
+ac_fn_c_check_header_compile "$LINENO" "netlink/netlink.h" "ac_cv_header_netlink_netlink_h" "
+#ifdef HAVE_ASM_TYPES_H
+#include <asm/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+"
+if test "x$ac_cv_header_netlink_netlink_h" = xyes
+then :
+  printf "%s\n" "#define HAVE_NETLINK_NETLINK_H 1" >>confdefs.h
+
+fi
 
 
 # On Linux, qrtr.h requires asm/types.h
index 8a84eaf6b370a102c03a9449ce19087dc20ad79e..ddf6da0b9da1233bc34167b01df1dc0088cc6182 100644 (file)
@@ -2880,7 +2880,8 @@ AC_CHECK_HEADERS([net/if.h], [], [],
 ])
 
 # On Linux, netlink.h requires asm/types.h
-AC_CHECK_HEADERS([linux/netlink.h], [], [], [
+# On FreeBSD, netlink.h is located in netlink/netlink.h
+AC_CHECK_HEADERS([linux/netlink.h netlink/netlink.h], [], [], [
 #ifdef HAVE_ASM_TYPES_H
 #include <asm/types.h>
 #endif
index dab8ebf64371f344806212c054c90abaa7f2dba2..181dc3d7d1137021718807bf113189dbb54450d7 100644 (file)
 /* Define to 1 if you have the <netinet/in.h> header file. */
 #undef HAVE_NETINET_IN_H
 
+/* Define to 1 if you have the <netlink/netlink.h> header file. */
+#undef HAVE_NETLINK_NETLINK_H
+
 /* Define to 1 if you have the <netpacket/packet.h> header file. */
 #undef HAVE_NETPACKET_PACKET_H