From f177083a46c179e9d93546d05c06f20603816520 Mon Sep 17 00:00:00 2001 From: bytemarx <100504683+bytemarx@users.noreply.github.com> Date: Thu, 9 May 2024 02:08:07 -0400 Subject: [PATCH] Add `ETH_P_ALL`, `AF_DIVERT`, and `PF_DIVERT` to `socket` --- stdlib/socket.pyi | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/stdlib/socket.pyi b/stdlib/socket.pyi index a309bac9370a..b626409d2dde 100644 --- a/stdlib/socket.pyi +++ b/stdlib/socket.pyi @@ -474,6 +474,13 @@ if sys.version_info >= (3, 12): ETHERTYPE_VLAN as ETHERTYPE_VLAN, ) + if sys.platform == "linux": + from _socket import ETH_P_ALL as ETH_P_ALL + + if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin": + # FreeBSD >= 14.0 + from _socket import PF_DIVERT as PF_DIVERT + # Re-exported from errno EBADF: int EAGAIN: int @@ -525,6 +532,9 @@ class AddressFamily(IntEnum): AF_BLUETOOTH = 32 if sys.platform == "win32" and sys.version_info >= (3, 12): AF_HYPERV = 34 + if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin" and sys.version_info >= (3, 12): + # FreeBSD >= 14.0 + AF_DIVERT = 44 AF_INET = AddressFamily.AF_INET AF_INET6 = AddressFamily.AF_INET6 @@ -577,6 +587,9 @@ if sys.platform != "win32" or sys.version_info >= (3, 9): if sys.platform == "win32" and sys.version_info >= (3, 12): AF_HYPERV = AddressFamily.AF_HYPERV +if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin" and sys.version_info >= (3, 12): + # FreeBSD >= 14.0 + AF_DIVERT = AddressFamily.AF_DIVERT class SocketKind(IntEnum): SOCK_STREAM = 1