From 645af9fb17d1e99cffaccf018d806bdcd12de150 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 7 Apr 2024 22:01:46 +0100 Subject: [PATCH] ext/sockets: adding solaris/illumos SO_EXCLBIND constant. when set to "true", neutralises the effect of SO_REUSEADDR/SO_REUSEPORT making the socket binding exclusive. Close GH-13912 --- NEWS | 2 ++ UPGRADING | 1 + ext/sockets/sockets.stub.php | 7 +++++++ ext/sockets/sockets_arginfo.h | 5 ++++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 89d14dea9a0..7078dc16693 100644 --- a/NEWS +++ b/NEWS @@ -195,6 +195,8 @@ PHP NEWS . Added multicast group support for ipv4 on FreeBSD. (jonathan@tangential.ca) . Added the TCP_SYNCNT constant for Linux to set number of attempts to send SYN packets from the client. (David Carlier) + . Added the SO_EXCLBIND constant for exclusive socket binding on illumos/solaris. + (David Carlier) - SNMP: . Removed the deprecated inet_ntoa call support. (David Carlier) diff --git a/UPGRADING b/UPGRADING index 3450825a2a5..b8849007d61 100644 --- a/UPGRADING +++ b/UPGRADING @@ -570,6 +570,7 @@ PHP 8.4 UPGRADE NOTES . SOCK_CONN_DGRAM (NetBSD only). . SOCK_DCCP (NetBSD only). . TCP_SYNCNT (Linux only). + . SO_EXCLBIND (Solaris/Illumos only). - Sodium: . SODIUM_CRYPTO_AEAD_AEGIS128L_KEYBYTES diff --git a/ext/sockets/sockets.stub.php b/ext/sockets/sockets.stub.php index 08e45eea8b5..502fff2e0f1 100644 --- a/ext/sockets/sockets.stub.php +++ b/ext/sockets/sockets.stub.php @@ -410,6 +410,13 @@ const SO_MEMINFO = UNKNOWN; */ const SO_BPF_EXTENSIONS = UNKNOWN; #endif +#ifdef SO_EXCLBIND +/** + * @var int + * @cvalue SO_EXCLBIND + */ +const SO_EXCLBIND = UNKNOWN; +#endif #ifdef SKF_AD_OFF /** * @var int diff --git a/ext/sockets/sockets_arginfo.h b/ext/sockets/sockets_arginfo.h index a26bd000af6..6697db704c7 100644 --- a/ext/sockets/sockets_arginfo.h +++ b/ext/sockets/sockets_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c761db0839535812316a42200f68c7db22639d81 */ + * Stub hash: 98bd7f47a1aa8d1c2cb40bf768115da2633f56fb */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_select, 0, 4, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(1, read, IS_ARRAY, 1) @@ -478,6 +478,9 @@ static void register_sockets_symbols(int module_number) #if defined(SO_BPF_EXTENSIONS) REGISTER_LONG_CONSTANT("SO_BPF_EXTENSIONS", SO_BPF_EXTENSIONS, CONST_PERSISTENT); #endif +#if defined(SO_EXCLBIND) + REGISTER_LONG_CONSTANT("SO_EXCLBIND", SO_EXCLBIND, CONST_PERSISTENT); +#endif #if defined(SKF_AD_OFF) REGISTER_LONG_CONSTANT("SKF_AD_OFF", SKF_AD_OFF, CONST_PERSISTENT); #endif