Weilin Du
2918caee20
ext/*: Remove break after return ( #21485 )
2026-03-23 20:30:13 +01:00
David CARLIER
f830fa9948
Sockets refactoring 2026 ( #21365 )
...
ext/sockets: internal refactorings.
- remove redundant memsets and faster socket unix path copy.
- simplify php_open_listen_sock.
- use INADDR_ANY directly instead of resolving via gethostbyname.
- remove redundant memsets in conversions.
2026-03-07 14:09:49 +00:00
ndossche
0375697dab
Merge branch 'PHP-8.5'
...
* PHP-8.5:
Fix merge for ext/sockets
2026-02-15 23:28:51 +01:00
ndossche
b6ca14799d
Fix merge for ext/sockets
2026-02-15 23:28:45 +01:00
David Carlier
d01bc9abd1
Merge branch 'PHP-8.5'
...
* PHP-8.5:
ext/sockets: socket_sendto() add max addr length control for AF_UNIX.
2026-02-15 21:55:06 +00:00
David Carlier
15163debc5
Merge branch 'PHP-8.4' into PHP-8.5
...
* PHP-8.4:
ext/sockets: socket_sendto() add max addr length control for AF_UNIX.
2026-02-15 21:54:54 +00:00
David Carlier
b6495c189a
ext/sockets: socket_sendto() add max addr length control for AF_UNIX.
...
we just mirror what is done for socket_connect()/AF_UNIX type.
close GH-21218
2026-02-15 21:54:19 +00:00
David Carlier
44d6417bd7
ext/sockets: GH-20532 socket_addrinfo_lookup() sets EAI error code on resolution failures with a new optional argument.
...
close GH-20534
2026-01-20 20:58:52 +00:00
David CARLIER
9b719cd4a3
ext/sockets: socket_addrinfo_lookup() allows AF_UNSPEC for ai_family. ( #20658 )
...
while still filtering out IPC like addresses and so on.
close GH-20658
2026-01-15 19:24:56 +00:00
James Lucas
46e55dd97c
ext/sockets: adding Linux's TCP_USER_TIMEOUT constant.
...
Set TCP_USER_TIMEOUT to cap (ms) how long TCP will wait for ACKs on in-flight data
before aborting the connection; prevents stuck/half-open sessions and
enables faster failover vs default retransmission timeouts.
Co-authored-by: David Carlier <devnexen@gmail.com >
close GH-20708
2025-12-19 07:38:10 +00:00
Gina Peter Banyard
fd1c3660ca
ext/sockets: socket_recvfrom() improve error message when port argument is missing
2025-10-13 13:44:19 +01:00
Tim Düsterhus
70117e53b9
sockets: Use return true / return false for functions returning bool
...
Changes done with Coccinelle:
@r1@
identifier fn;
typedef bool;
symbol false;
symbol true;
@@
bool fn ( ... )
{
<...
return
(
- 0
+ false
|
- 1
+ true
)
;
...>
}
Coccinelle patch sourced from
torvalds/linux@46b5c9b856 .
2025-09-24 18:51:40 +02:00
David Carlier
2a96af743e
fix build warnings for Haiku.
...
especially linker warning about php binary having an executable stack.
cloe GH-19575
2025-09-06 14:06:10 +01:00
Gina Peter Banyard
841afdc486
streams: use type zend_result instead of type int
2025-08-04 15:30:57 +01:00
David CARLIER
068aaed196
ext/sockets: using accept4 wheneever possible for php_accept_connect helper ( #19268 )
...
Haiku now supports it as well now, so we can simplify the workflow a bit for those platforms.
2025-07-27 20:52:11 +01:00
Niels Dossche
d9602e4362
Merge branch 'PHP-8.3' into PHP-8.4
...
* PHP-8.3:
NEWS for GH-19162
ext/socket: Remove incorrect zval_ptr_dtor
ext/hash: Remove incorrect zval_ptr_dtor
2025-07-17 21:52:23 +02:00
Niels Dossche
d11099ae32
ext/socket: Remove incorrect zval_ptr_dtor
2025-07-17 21:50:35 +02:00
David CARLIER
46213f879a
ext/sockets: socket_addrinfo_lookup narrowing down socket family check to AF_INET/AF_INET6 only. ( #19040 )
2025-07-12 15:48:25 +01:00
David CARLIER
c789e9c9f1
ext/sockets: socket_create_pair() simplify workflow. ( #18679 )
...
create the pair objects only on success.
2025-05-28 12:41:48 +01:00
David Carlier
5a7920ba60
ext/sockets: socket_shutdown() having proper constants for mode.
...
close GH-18648
2025-05-26 18:48:21 +01:00
David Carlier
4671f8510c
ext/sockets: UDP_SEGMENT support.
...
UDP segmentation offload is an optimisation attempt by sending multiple
large enough datagrams over UDP which reduces syscalls as by default,
they have to be broke down in small UDP packets, it is better if the
hardware supports it, other handed down to the software implementation.
close GH-18213
2025-05-22 20:32:29 +01:00
David CARLIER
68d54030a1
ext/sockets: using array optimisations. ( #18367 )
...
mostly explicit packed arrays.
2025-04-20 19:34:11 +01:00
David Carlier
d6cd754121
Merge branch 'PHP-8.4'
2025-02-25 21:56:01 +00:00
David Carlier
c8bead8393
Merge branch 'PHP-8.3' into PHP-8.4
2025-02-25 21:55:46 +00:00
David Carlier
8cbc0c57b7
Fix GH-17921 socket_read/socket_recv overflows on buffer size.
...
update the existing checks to be more straightforward instead of
counting on undefined behavior.
close GH-17923
2025-02-25 21:54:24 +00:00
David CARLIER
cc116067b2
Revert "ext/sockets: follow-up on AF_PACKET support." ( #17924 )
...
This reverts commit de018aa2c5 .
2025-02-25 07:04:40 +00:00
David Carlier
de018aa2c5
ext/sockets: follow-up on AF_PACKET support.
...
support from socket_recvfrom and exposing basic PHP userland type.
close GH-17657
2025-02-24 22:09:29 +00:00
David CARLIER
6c096bfa13
ext/sockets: php_set_inet*_addr using zend_string instead. ( #17845 )
2025-02-20 21:59:55 +00:00
David Carlier
2ea386a516
ext/sockets: linux AF_PACKET support.
...
close GH-17440
2025-01-30 12:43:35 +00:00
David Carlier
466f3257eb
ext/sockets: socket_addrinfo_lookup and other few internal changes
...
- socket_addrinfo_lookup throws when hints is an indexed array.
- socket_get_option hardcoding size outputs to user when data
size known.
close GH-17363
2025-01-05 13:32:12 +00:00
David Carlier
c7a322cc4c
ext/sockets: follow-up on GH-17300 to check hints value ranges.
...
close GH-17326
2025-01-04 15:39:53 +00:00
David Carlier
b7c76ded31
ext/socket: socket_addrinfo_lookup check hints array.
...
close GH-17300
2025-01-02 13:14:10 +00:00
David Carlier
665ebd7f48
ext/sockets: socket_sendto check port range.
...
close GH-17299
2024-12-29 19:07:19 +00:00
David Carlier
caafa041d9
ext/sockets: socket_bind() check port validity.
...
range from ephemeral port (0) to max unsigned 16 bits.
close GH-17296
2024-12-29 15:22:05 +00:00
Gina Peter Banyard
9eb228488a
ext/sockets: Additional refactorings to socket_set_option() ( #17186 )
...
* ext/socket: Reduce scope of variables
* ext/socket: Throw TypeErrors when not passing a string for options requiring one
* ext/sockets: Throw ValueError when string has null bytes for options not passing string length
* ext/sockets: Throw ValueError when string is too long
And replace calls to strlcpy to memcpy
2024-12-29 12:18:15 +00:00
David Carlier
00fe9b205c
ext/sockets: socket_create_listen() check port value beforehand.
...
port is a 16 bit field, limited to the 65535 value then.
Note that 0 is a valid case for ephemeral port.
close GH-17281
2024-12-27 14:29:11 +00:00
David Carlier
63e4e08e0d
ext/sockets: following-up on GH-16842, update FreeBSD TCP stack setting.
...
- `TCP_FUNCTION_ALIAS`: fetches the function pointer name alias (>= 14.0
only tough).
- `TCP_BBR_ALGORITHM`: set/get the underlying algorithm (0: netflix, 1:
google) when the BBR's TCP stack is used.
- `TCP_REUSPORT_LB_NUMA`: set/get a NUMA domain filter on the socket.
close GH-16923
2024-12-26 20:54:14 +00:00
David CARLIER
c4bb6e6c39
ext/sockets: further timeout handling changes. ( #17210 )
...
close GH-17210
2024-12-20 22:36:14 +00:00
David Carlier
4750ce1e6d
Merge branch 'PHP-8.4'
2024-12-16 23:00:23 +00:00
David Carlier
eb0e991c5d
Merge branch 'PHP-8.3' into PHP-8.4
2024-12-16 22:56:18 +00:00
David Carlier
8a649a8343
ext/sockets: socket_set_option switch from convert_to_long to zval_get_long.
...
to be explicit when the expected type is not met. Check SO_LINGER values
for possible overflow.
close GH-17135
2024-12-16 22:55:23 +00:00
David CARLIER
07cd468262
ext/sockets: socket_get_option/socket_set_option timeout type on win32. ( #17123 )
...
For SO_SNDTIMEO/SO_RCVTIMEO, normally the timeout ought to be of
DWORD/unsigned long.
2024-12-12 13:12:40 +00:00
David Carlier
94d9cc1266
Merge branch 'PHP-8.4'
2024-12-09 13:17:29 +00:00
David Carlier
986dfd4e09
Merge branch 'PHP-8.3' into PHP-8.4
2024-12-09 13:16:50 +00:00
David Carlier
3bea6a2ddb
ext/sockets: socket_strerror follow-up on GH-16267 fix.
...
boundaries should be INT_MIN <= val < INT_MAX in fact.
close GH-16891
2024-12-09 13:16:32 +00:00
David Carlier
ccda20b8d1
ext/sockets: Adding TCP_FUNCTION_BLK socket option for FreeBSD.
...
Allows to select an alternate TCP stack. For example with RACK,
a fast loss detection relying on timestamp per packet.
While it works system-wide, it can also apply in an individual socket level too.
close GH-16842
2024-11-21 23:00:06 +00:00
David Carlier
10dbdc5608
Merge branch 'PHP-8.3' into PHP-8.4
2024-10-12 15:23:48 +01:00
David Carlier
f12e496cba
Merge branch 'PHP-8.2' into PHP-8.3
2024-10-12 15:23:35 +01:00
David Carlier
e583890af0
Fix socket_recvfrom overflow on buffer size.
...
when passing PHP_INT_MAX for the $length param we get this (with ubsan)
`ext/sockets/sockets.c:1409:36: runtime error: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long int'`
close GH-16382
2024-10-12 15:23:03 +01:00
David Carlier
062b3ca2f2
Merge branch 'PHP-8.3' into PHP-8.4
2024-10-06 19:26:10 +01:00