From 4f45def26118f413bf49e75a5b685aa0b8477343 Mon Sep 17 00:00:00 2001 From: Wen Heping Date: Mon, 14 Nov 2022 02:04:01 +0000 Subject: lang/python*: Support FreeBSD divert(4) socket PR: 267648 Reported by: glebius@ Exp-run by: antoine@ --- lang/python310/files/patch-Modules__socketmodule.c | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 lang/python310/files/patch-Modules__socketmodule.c (limited to 'lang/python310/files/patch-Modules__socketmodule.c') diff --git a/lang/python310/files/patch-Modules__socketmodule.c b/lang/python310/files/patch-Modules__socketmodule.c new file mode 100644 index 000000000000..93ef3b785ab9 --- /dev/null +++ b/lang/python310/files/patch-Modules__socketmodule.c @@ -0,0 +1,29 @@ +--- Modules/socketmodule.c ++++ Modules/socketmodule.c +@@ -1850,6 +1850,11 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args, + /* RDS sockets use sockaddr_in: fall-through */ + #endif /* AF_RDS */ + ++#ifdef AF_DIVERT ++ case AF_DIVERT: ++ /* FreeBSD divert(4) sockets use sockaddr_in: fall-through */ ++#endif /* AF_DIVERT */ ++ + case AF_INET: + { + struct maybe_idna host = {NULL, NULL}; +@@ -7628,6 +7633,14 @@ PyInit__socket(void) + PyModule_AddIntMacro(m, AF_SYSTEM); + #endif + ++/* FreeBSD divert(4) */ ++#ifdef PF_DIVERT ++ PyModule_AddIntMacro(m, PF_DIVERT); ++#endif ++#ifdef AF_DIVERT ++ PyModule_AddIntMacro(m, AF_DIVERT); ++#endif ++ + #ifdef AF_PACKET + PyModule_AddIntMacro(m, AF_PACKET); + #endif -- cgit v1.2.3