https://github.com/python/cpython/commit/1bffd7a2a738506a4ad50c6c3c2c32926cce6d14
commit: 1bffd7a2a738506a4ad50c6c3c2c32926cce6d14
branch: main
author: Steven Jin <[email protected]>
committer: erlend-aasland <[email protected]>
date: 2024-10-15T00:36:38+02:00
summary:
gh-124944: Add socket.SO_ORIGINAL_DST (#124945)
files:
A Misc/NEWS.d/next/Library/2024-10-03-17-13-22.gh-issue-124944.YyLAzf.rst
M Modules/socketmodule.c
M Modules/socketmodule.h
M configure
M configure.ac
M pyconfig.h.in
diff --git
a/Misc/NEWS.d/next/Library/2024-10-03-17-13-22.gh-issue-124944.YyLAzf.rst
b/Misc/NEWS.d/next/Library/2024-10-03-17-13-22.gh-issue-124944.YyLAzf.rst
new file mode 100644
index 00000000000000..66af712c5ae5a8
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-10-03-17-13-22.gh-issue-124944.YyLAzf.rst
@@ -0,0 +1 @@
+Add ``SO_ORIGINAL_DST`` to the :mod:`socket` module.
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 0829d2358129d2..744e5e0c0b2b54 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -7921,6 +7921,9 @@ socket_exec(PyObject *m)
#ifdef SO_OOBINLINE
ADD_INT_MACRO(m, SO_OOBINLINE);
#endif
+#ifdef SO_ORIGINAL_DST
+ ADD_INT_MACRO(m, SO_ORIGINAL_DST);
+#endif
#ifndef __GNU__
#ifdef SO_REUSEPORT
ADD_INT_MACRO(m, SO_REUSEPORT);
diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h
index a77c620c2ef630..e1d96377728eb9 100644
--- a/Modules/socketmodule.h
+++ b/Modules/socketmodule.h
@@ -172,6 +172,10 @@ typedef int socklen_t;
# undef AF_VSOCK
#endif
+#ifdef HAVE_LINUX_NETFILTER_IPV4_H
+# include <linux/netfilter_ipv4.h>
+#endif
+
#ifdef HAVE_SOCKADDR_ALG
# include <linux/if_alg.h>
diff --git a/configure b/configure
index 0cc73e4e66552d..c5bec6a1b0d7c2 100755
--- a/configure
+++ b/configure
@@ -11092,6 +11092,12 @@ if test "x$ac_cv_header_linux_memfd_h" = xyes
then :
printf "%s\n" "#define HAVE_LINUX_MEMFD_H 1" >>confdefs.h
+fi
+ac_fn_c_check_header_compile "$LINENO" "linux/netfilter_ipv4.h"
"ac_cv_header_linux_netfilter_ipv4_h" "$ac_includes_default"
+if test "x$ac_cv_header_linux_netfilter_ipv4_h" = xyes
+then :
+ printf "%s\n" "#define HAVE_LINUX_NETFILTER_IPV4_H 1" >>confdefs.h
+
fi
ac_fn_c_check_header_compile "$LINENO" "linux/random.h"
"ac_cv_header_linux_random_h" "$ac_includes_default"
if test "x$ac_cv_header_linux_random_h" = xyes
diff --git a/configure.ac b/configure.ac
index 1864e94ace9243..d4b7942190207a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3013,7 +3013,7 @@ AC_DEFINE([STDC_HEADERS], [1],
AC_CHECK_HEADERS([ \
alloca.h asm/types.h bluetooth.h conio.h direct.h dlfcn.h endian.h errno.h
fcntl.h grp.h \
io.h langinfo.h libintl.h libutil.h linux/auxvec.h sys/auxv.h linux/fs.h
linux/limits.h linux/memfd.h \
- linux/random.h linux/soundcard.h \
+ linux/netfilter_ipv4.h linux/random.h linux/soundcard.h \
linux/tipc.h linux/wait.h netdb.h net/ethernet.h netinet/in.h
netpacket/packet.h poll.h process.h pthread.h pty.h \
sched.h setjmp.h shadow.h signal.h spawn.h stropts.h sys/audioio.h
sys/bsdtty.h sys/devpoll.h \
sys/endian.h sys/epoll.h sys/event.h sys/eventfd.h sys/file.h sys/ioctl.h
sys/kern_control.h \
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 7f02603e26f5d0..1947d8ee14f83e 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -739,6 +739,9 @@
/* Define to 1 if you have the <linux/memfd.h> header file. */
#undef HAVE_LINUX_MEMFD_H
+/* Define to 1 if you have the <linux/netfilter_ipv4.h> header file. */
+#undef HAVE_LINUX_NETFILTER_IPV4_H
+
/* Define to 1 if you have the <linux/netlink.h> header file. */
#undef HAVE_LINUX_NETLINK_H
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]