1
0
mirror of https://github.com/php/php-src.git synced 2026-04-26 01:18:19 +02:00
Commit Graph

1037 Commits

Author SHA1 Message Date
Gina Peter Banyard 1f131e3ae6 [skip ci] ext/sockets: remove tests that leak memory (#19408)
I don't understand what the purposes of theses tests are.
2025-08-07 21:50:04 +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
David CARLIER 4a0ad9bd91 ext/sockets: cmsg data array elements using uint32_t type instead. (#19254) 2025-07-27 15:43:59 +01:00
David Carlier 64852b44b5 ext/sockets: multicast on unsupported socket type error change.
From a mere warning to an exception.

close GH-19114
2025-07-15 13:05:13 +01: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
Peter Kokot c2af281c0c Use <winsock2.h> instead of legacy <winsock.h> (#19037)
This also omits defining unused HAVE_WINSOCK_H macro when building
ext/sockets.
2025-07-07 09:40:03 +02:00
Gina Peter Banyard 40be5fa99f ext/sockets: Remove bool type coercions in tests 2025-06-23 14:56:53 +02:00
DanielEScherzer ddd33fd7e4 Generated arginfo headers: combine preprocessor conditional blocks (2) (#18667)
When global constants' or class constants' availability is based on some
preprocessor condition, the generated arginfo header files wrap the
declarations in the preprocessor `#if` conditional blocks, one per declaration,
even if they are in the same conditional block based on comments in the stub
file. Instead of having multiple conditional blocks one after the other with
the same condition, combine them into a single conditional block.
2025-06-22 14:35:28 -07:00
Gina Peter Banyard 279983dc8d ext/sockets: Use zval_is_true() instead of converting to boolean (#18681) 2025-05-28 20:06:47 +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 dfff6ac852 Merge branch 'PHP-8.4' 2025-05-22 20:47:36 +01:00
David Carlier c00d7e056a Merge branch 'PHP-8.3' into PHP-8.4 2025-05-22 20:47:25 +01:00
David Carlier c30bddc18f Fix GH-18617: socket_import_file_descriptor return check.
to_zval_read_fd_array() helper when retrieving the socket protocol did
not check it.

close GH-18617
2025-05-22 20:46:18 +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
Gina Peter Banyard 556e4d9008 streams: Indicate which argument fails the stream ZPP check 2025-03-24 22:54:34 +00:00
David CARLIER 21fd08be71 ext/sockets: adding SO_BUSY_POLL socket option for Linux. (#17954)
To possibly reduce the latency when polling packets by activating it
from the network interface for N microseconds.
The kernel by doing so, increase the CPU(s) activity bound to
the socket significantly.
Note that not only the kernel needs to have support enabled for it
(which the average distribution usually does) but the network
interface itself needs to support it too. If not, it is just a no-op.
2025-03-11 20:03:28 +00: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 0ec6413562 ext/sockets: multicast socket option helper change to zval_try_get_tmp_string() (#17871) 2025-02-20 23:47:33 +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 ddd1dd0c4b ext/sockets: adding BSD IP_BINDANY constant.
Simply allows the socket to bind to any address, including one not
bound to any network interface.

close GH-17591
2025-02-11 13:10:42 +00:00
Niels Dossche 28751d32c2 Fix nightly failure in socket_afpacket.phpt
Alpine has a slighly differently worded error message, so relax the test:

"unable to retrieve peer name [95]: Not supported"
2025-02-01 12:39:15 +01:00
David Carlier 2ea386a516 ext/sockets: linux AF_PACKET support.
close GH-17440
2025-01-30 12:43:35 +00:00
David Carlier 9f87a19de4 ext/sockets: drop convert_to_array for multicast leave group settings.
close GH-17371
2025-01-06 13:11:07 +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 3e9b530d62 ext/sockets: conversions internal changes. (#17311)
following up on strlcpy removal work too.
2025-01-01 12:13:39 +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 33ba1a4ab9 ext/sockets: adding IPPROTO_ICMP* constants for socket creations.
Is to create socket for Internet Control Message Protocol context.
Due to their nature, they are meant to be used via
raw sockets rather than TCP/UDP.

close GH-16737
2024-11-12 18:52:22 +00:00
David Carlier 10dbdc5608 Merge branch 'PHP-8.3' into PHP-8.4 2024-10-12 15:23:48 +01:00