Skip to content

Commit b17d32c

Browse files
authored
gh-96534: socketmodule: support FreeBSD divert(4) socket (#96536)
1 parent fdcb49c commit b17d32c

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

Doc/library/socket.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,17 @@ Constants
509509
.. versionadded:: 3.9
510510

511511

512+
.. data:: AF_DIVERT
513+
PF_DIVERT
514+
515+
These two constants, documented in the FreeBSD divert(4) manual page, are
516+
also defined in the socket module.
517+
518+
.. availability:: FreeBSD >= 14.0.
519+
520+
.. versionadded:: 3.12
521+
522+
512523
.. data:: AF_PACKET
513524
PF_PACKET
514525
PACKET_*
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Support divert(4) added in FreeBSD 14.

Modules/socketmodule.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,6 +1903,11 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
19031903
/* RDS sockets use sockaddr_in: fall-through */
19041904
#endif /* AF_RDS */
19051905

1906+
#ifdef AF_DIVERT
1907+
case AF_DIVERT:
1908+
/* FreeBSD divert(4) sockets use sockaddr_in: fall-through */
1909+
#endif /* AF_DIVERT */
1910+
19061911
case AF_INET:
19071912
{
19081913
struct maybe_idna host = {NULL, NULL};
@@ -7683,6 +7688,14 @@ socket_exec(PyObject *m)
76837688
ADD_INT_MACRO(m, AF_SYSTEM);
76847689
#endif
76857690

7691+
/* FreeBSD divert(4) */
7692+
#ifdef PF_DIVERT
7693+
PyModule_AddIntMacro(m, PF_DIVERT);
7694+
#endif
7695+
#ifdef AF_DIVERT
7696+
PyModule_AddIntMacro(m, AF_DIVERT);
7697+
#endif
7698+
76867699
#ifdef AF_PACKET
76877700
ADD_INT_MACRO(m, AF_PACKET);
76887701
#endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy