Niels Dossche
d11099ae32
ext/socket: Remove incorrect zval_ptr_dtor
2025-07-17 21:50:35 +02: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
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
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
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
2af32659b3
Merge branch 'PHP-8.2' into PHP-8.3
2024-10-06 19:25:59 +01:00
David Carlier
8537aa687e
Fix GH-16267 socket_strerror overflow on argument value.
...
only socket_strerror provides user-supplied value to sockets_strerror
handler.
close GH-16270
2024-10-06 19:25:38 +01:00
David Carlier
b412fd6a77
Merge branch 'PHP-8.2' into PHP-8.3
2024-03-31 17:01:16 +01:00
David Carlier
ba4c82fd80
ext/sockets: socket_create_listen clearing socket data before binding.
...
Close GH-13855
2024-03-31 17:00:54 +01:00
David Carlier
93d89cb80d
Merge branch 'PHP-8.2' into PHP-8.3
2024-03-06 11:39:37 +00:00
David Carlier
e3f0d03452
Fix GH-13603 ext/sockets: properly initialised address info data.
...
Led to random characters visible on socket id on macOs.
Close GH-13606
2024-03-06 11:37:48 +00:00
twosee
d9b0bdbaa4
Merge branch 'PHP-8.2' into PHP-8.3
...
* PHP-8.2:
Fix socket_export_stream() with wrong protocol
2023-09-29 18:58:05 +08:00
twosee
90707f33e1
Merge branch 'PHP-8.1' into PHP-8.2
...
* PHP-8.1:
Fix socket_export_stream() with wrong protocol
2023-09-29 18:33:59 +08:00
twosee
b5da98b972
Fix socket_export_stream() with wrong protocol
...
Closes GH-12310.
2023-09-29 18:33:12 +08:00
Javier Eguiluz
732d92c0e5
[skip ci] Fix various typos and grammar issues ( #11143 )
2023-04-28 11:05:32 +02:00
George Peter Banyard
735edd1c17
Voidify php_sock_array_from_fd_set() as result is never used
2023-01-30 16:05:30 +00:00
George Peter Banyard
3eb9dd47e0
Use bool and zend_result where it makes sense in sockets extension
2023-01-30 16:05:30 +00:00
Máté Kocsis
7936c8085e
Fix GH-8329 Print true/false instead of bool in error and debug messages ( #8385 )
2023-01-23 10:52:14 +01:00
David CARLIER
4c4e72f149
socket add socket_atmark support.
...
checks whether the socket belongs to the out-of-band mark, thus allows to be
processed accordingly (using the MSG_OOB flag on send/recv).
Closes #9846 .
2022-10-31 16:38:18 +00:00
David Carlier
35b5aceff3
SO_ATTACH_REUSEPORT_CBPF filter update. SDK_AD_QUEUE support to attach to a queue.
...
Closes #9690
2022-10-15 11:22:26 +01:00
Arnaud Le Blanc
5b6f9df51a
Merge branch 'PHP-8.2'
...
* PHP-8.2:
[ci skip] NEWS
[ci skip] NEWS
[ci skip] NEWS
Return immediately when FD_SETSIZE is exceeded (#9602 )
2022-10-01 11:26:17 +02:00
Arnaud Le Blanc
246d13cd99
Merge branch 'PHP-8.1' into PHP-8.2
...
* PHP-8.1:
[ci skip] NEWS
[ci skip] NEWS
Return immediately when FD_SETSIZE is exceeded (#9602 )
2022-10-01 11:24:23 +02:00
Arnaud Le Blanc
d4b99542d5
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
[ci skip] NEWS
Return immediately when FD_SETSIZE is exceeded (#9602 )
2022-10-01 11:23:34 +02:00
Arnaud Le Blanc
80232de0e4
Return immediately when FD_SETSIZE is exceeded ( #9602 )
2022-10-01 11:20:43 +02:00
David Carlier
615b8006c4
socket module add SO_ATTACH_REUSEPORT_CPBF for Linux.
...
to be used in conjunction with SO_REUSPORT, giving a greater control
over how we bind a socket instead of the round robin workflow, we do
instead attach to the processor id as :
- we assign the processor_id to A in the BPF filter.
- then returns A.
in other words, a more modern version of SO_INCOMING_CPU (ie can have a per
worker notion we do not use here).
Closes #8062
2022-09-29 23:32:39 +01:00
Ilija Tovilo
743d3780c6
Add clang ASAN/UBSAN push job
...
Closes GH-9507
2022-09-14 23:55:46 +02:00
Bob Weinand
a01dd9feda
Revert "Port all internally used classes to use default_object_handlers"
...
This reverts commit 94ee4f9834
.
The commit was a bit too late to be included in PHP 8.2 RC1. Given it's a massive ABI break, we decide to postpone the change to PHP 8.3.
2022-09-14 11:13:23 +02:00
Bob Weinand
94ee4f9834
Port all internally used classes to use default_object_handlers
...
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-08-31 16:45:27 +02:00
Máté Kocsis
98e5c4e3a3
Declare ext/sockets constants in stubs ( #9349 )
2022-08-16 13:18:31 +02:00
David Carlier
9090e2602e
sockets ext for solaris update.
...
socket filter support, system can support up to 32 filters giving the possibility to retrive the full list.
Closes #8191 .
2022-07-25 19:28:25 +01:00
David Carlier
dedad408fe
sockets introduces socket_set_option SO_ZEROCOPY and MSG_ZEROCOPY for the socket_send* functions. it avoids copy b/w userland and kernel for both TCP and UDP protocols.
2022-07-10 20:06:52 +01:00
David Carlier
a193427333
Adds TCP_CONGESTION
socket option for Linux/FreeBSD.
...
Closes #8824 .
2022-06-30 19:43:09 +01:00
David CARLIER
6b02cabc8a
Add SO_SETFIB
FreeBSD socket option constant.
...
Aims to set the route table.
Closes #8742 .
2022-06-11 13:03:21 +01:00
David Carlier
d677cc13ce
Add SO_BPF_EXTENSIONS
flag to socket.
...
Returns the supported bpf extensions from the kernel. Linux only.
Closes GH-8713.
2022-06-08 05:14:57 +01:00
David CARLIER
f813520b50
Implements socket ancillary data on FreeBSD. ( #7708 )
...
using LOCAL_CREDS_PERSISTENT/SCM_CREDS2 instead so we also get the send process id.
2022-06-02 14:08:03 +01:00
David Carlier
30c8f3a80f
Fix GH-8674: sockets extension won't build for older Linux kernels
...
In abscence of the needed header, disable the feature altogether.
Closes GH-8677.
2022-06-01 17:33:36 +02:00
David CARLIER
b14215ab6c
sockets add openbsd's SO_RTABLE option, equivalent of Linux's SO_MARK. ( #8440 )
2022-05-27 13:55:34 +02:00
David CARLIER
d1c570f48c
Sockets: add constants TCP_KEEPALIVE, TCP_KEEPIDLE, TCP_KEEPINTVL, TCP_KEEPCNT ( #8473 )
2022-05-27 13:50:32 +02:00
David Carlier
2410e378c1
Add SO_MEMINFO socket option for gathering socket related info
2022-05-20 22:06:53 +01:00
David Carlier
1f4830f21a
Add TCP_NOTSENT_LOWAT socket option
...
Can be used to limit the amount of unsent data per socket.
Closes GH-8559.
2022-05-16 16:01:38 +02:00
Christoph M. Becker
e1a238333c
Merge branch 'PHP-8.1'
...
* PHP-8.1:
Fix ext/sockets build on Haiku
2022-01-04 14:13:27 +01:00
Christoph M. Becker
623b21220b
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Fix ext/sockets build on Haiku
2022-01-04 14:12:56 +01:00
David Carlier
09165ace37
Fix ext/sockets build on Haiku
...
The `SOCK_RDM` datagram option is unsupported on Haiku; instead `ifreq`
has direct access to `ifr_index`.
Closes GH-7849.
2022-01-04 14:10:50 +01:00
David Carlier
3414ae6c0c
sockets: add SO_INCOMING_CPU constant
...
get/set the cpu attached to a socket, no special treatment needed,
it is simply an integer.
Closes GH-7753.
2021-12-20 14:58:09 +01:00
Dmitry Stogov
90b7bde615
Use more compact representation for packed arrays.
...
- for packed arrays we store just an array of zvals without keys.
- the elements of packed array are accessible throuf as ht->arPacked[i]
instead of ht->arData[i]
- in addition to general ZEND_HASH_FOREACH_* macros, we introduced similar
familied for packed (ZEND_HASH_PACKED_FORECH_*) and real hashes
(ZEND_HASH_MAP_FOREACH_*)
- introduced an additional family of macros to access elements of array
(packed or real hashes) ZEND_ARRAY_ELEMET_SIZE, ZEND_ARRAY_ELEMET_EX,
ZEND_ARRAY_ELEMET, ZEND_ARRAY_NEXT_ELEMENT, ZEND_ARRAY_PREV_ELEMENT
- zend_hash_minmax() prototype was changed to compare only values
Because of smaller data set, this patch may show performance improvement
on some apps and benchmarks that use packed arrays. (~1% on PHP-Parser)
TODO:
- sapi/phpdbg needs special support for packed arrays (WATCH_ON_BUCKET).
- zend_hash_sort_ex() may require converting packed arrays to hash.
2021-11-03 15:18:26 +03:00
Joe Watkins
570d9b63e9
Not serializable flag permeation
2021-07-20 12:28:35 +02:00
David Carlier
4c873df7d5
sockets enabling SO_MARK socket option which is relatively similar
...
to FreeBSD's SO_USER_COOKIE giving a socket an identifier for packet filter,
giving a specific route table.
2021-07-16 12:18:24 +02:00
Patrick Allaert
aff365871a
Fixed some spaces used instead of tabs
2021-06-29 11:30:26 +02:00
David CARLIER
c4a005bb2d
exposing few macOS socket options to give hints how to handle data,
2021-06-22 09:43:56 -05:00