Commit graph

952 commits

Author SHA1 Message Date
David Carlier
f714aa49ee ext/sockets: addiong few constants for NetBSD.
SOCK_CONN_DGRAM (and its alias SOCK_DCCP) for connection orientated
datagram.
2024-03-17 21:39:43 +00:00
David Carlier
7f8465ab22 Merge branch 'PHP-8.3' 2024-03-06 11:39:48 +00: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
Peter Kokot
23844538d1
Use preprocessor to check for AI_V4MAPPED, AI_ALL and AI_IDN (#13513)
The preprocessor macros defined in some header can be checked, using
Autoconf's AC_COMPILE_IFELSE, or with simpler AC_CHECK_DECL(S), or even
better and simpler directly in the C code.
2024-02-26 16:38:00 +01:00
Peter Kokot
7d295cbefb Check socket extension functions in a single Autoconf macro 2024-02-26 12:32:43 +01:00
Peter Kokot
0039446fee
Check for struct ucred with AC_CHECK_TYPES (#13510)
The AC_CHECK_TYPES can be used to check for the struct ucred. By
default it defines the symbol HAVE_STRUCT_UCRED instead of
ANC_CREDS_UCRED.
2024-02-25 23:02:17 +01:00
Peter Kokot
c1d6cf37e9
Check for struct cmsgcred with AC_CHECK_TYPES (#13507)
The AC_CHECK_TYPES can be used to check for the struct cmsgcred. By
default it defines the symbol HAVE_STRUCT_CMSGCRED instead of
ANC_CREDS_CMSGCRED.
2024-02-25 22:33:44 +01:00
Máté Kocsis
f2e199e878
Implement "support doc comments for internal classes and functions" (#13266)
Fixes #13130
2024-02-25 08:41:31 +01:00
Jorg Sowa
9c4beac8d3 Remove inet_aton
This removes the deprecated inet_aton and its Windows implementation.
The inet_aton can be replaced with platform agnostic inet_pton.

Closes GH-13479
2024-02-23 23:16:43 +01:00
Jorg Adam Sowa
e630aacf79
Remove HAVE_INET_PTON (#13410) 2024-02-21 00:43:56 +00:00
Máté Kocsis
10957e498c
Do not generate frameless info items when func info generation is disabled
While here, I fixed newlines around arginfo and function entry generation. Previously, newlines were repeated.
2024-02-18 11:39:00 +01:00
Peter Kokot
b5c3cbf94b
Check sockaddr_storage.ss_family with AC_CHECK_MEMBERS (#13407)
This simplifies the check. On AIX 6 and newer, the ss_family is
available, if compiled without defining COMPAT_43 (BSD 4.3
compatibility).
2024-02-16 14:24:55 +01:00
Peter Kokot
25923987b5
Refactor PHP_SOCKADDR_CHECKS (#13406)
Instead of the project macro, the sockaddr_storage and sockaddr.sa_len
can be checked with the AC_CHECK_TYPES and AC_CHECK_MEMBERS by including
the sys/socket.h. Some systems (~1988) didn't include the sys/types.h in
the socket.h (obsolete on current systems).

These macros by default define the HAVE_STRUCT_SOCKADDR_STORAGE and
HAVE_STRUCT_SOCKADDR_SA_LEN.
2024-02-16 13:29:20 +01:00
David CARLIER
453f5ab053
ext/sockets: enabling multicast group for ipv4 on freebsd. (#13240)
bug#75721 patch from jonathan@tangential.ca.

MCAST_JOIN_GROUP/MCAST_LEAVE_GROUP socket option for the RFC 3678
support does not work on freebsd, using IP_ADD_MEMBERSHIP instead.
2024-01-31 06:58:27 +00:00
Peter Kokot
52dba99d47 Sync headers installation
This syncs the installed sapi and extension headers on *nix and Windows
systems by installing only what is intended outside of php-src.

- ext/gd: without gd_arginfo.h and gd_compat.h
- ext/hash: php_hash_joaat.h and php_hash_fnv.h added also on Windows
  installation; xxhash/xxhash.h added on both installations as it is
  included in php_hash_xxhash.h; Include path for xxhash.h changed to
  relative so the php_hash_xxhash.h can be included outside of php-src;
  Redundant include flags removed
- ext/iconv: without iconv_arginfo.h
- ext/mysqli: mysqli_mysqlnd.h was missing on Windows
- ext/phar: php_phar.h was missing on Windows
- ext/sodium: php_libsodium.h was missing on *nix
- ext/xml: without xml_arginfo.h
- sapi/cli: cli.h was missing on Windows

Closes GH-13210
Closes GH-13213
2024-01-28 19:50:55 +01:00
David Carlier
b02f95adae ext/sockets: adding windows SO_EXCLUSIVEADDRUSE constant.
Close GH-13030
2023-12-28 15:38:58 +00:00
David CARLIER
931a8b0739
inet_ntop requirement check at configure time instead (#12700) 2023-11-17 16:01:46 +00:00
David Carlier
44f9c226aa following-up on GH-12551: removing inet_ntoa usage
Close GH-12554
2023-11-06 12:05:56 +00:00
Peter Kokot
7d485aa628
ext/sockets: Clean header checks (#12607)
- Unused header checks removed:
  HAVE_NETINET_TCP_H and HAVE_SYS_UN_H are not used in the code.
- Duplicate linux/filter.h check removed:
  HAVE_LINUX_FILTER_H is already defined in ext/sockets.
2023-11-04 15:12:16 +00:00
David Carlier
1c8943bc78 cleanup inet_ntoa usage.
starting with the socket extension. PHP 8 requires windows vista/2008
minimum, even more exotic systems like solaris or haiku supports
inet_ntop, so there is no need to keep supporting this old interface.

Close GH-12551
2023-10-29 15:54:20 +00:00
Ilija Tovilo
f39b5c4c25
Close PHP tags in tests
Closes GH-12422
2023-10-18 17:34:10 +02: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
Michael Orlitzky
ce8c07e942
ext/sockets/tests/mcast_ipv6_*.phpt: suppress no-ipv6 warning (#11651)
These three tests try to create an ipv6 socket with socket_create() to
determine if they should be skipped. On certain systems lacking ipv6
support, however, the call to socket_create() itself raises a warning:

  BORK Warning: socket_create(): Unable to create socket [97]: Address
  family not supported by protocol in ...

The output is "borked" because the return value (false) is expected
but the text of the warning is not. This commit uses the error control
operator (@) to hide the warning. Afterwards the tests are skipped
normally on such a system.
2023-07-10 16:19:12 +02:00
Ilija Tovilo
45ffa773c8
Merge branch 'PHP-8.2'
* PHP-8.2:
  xfail socket zerocopy test on Cirrus + arm
2023-06-29 08:49:07 +02:00
Ilija Tovilo
838f6bffff
xfail socket zerocopy test on Cirrus + arm
Closes GH-11553
2023-06-29 08:48:48 +02:00
divinity76
4918765d54
SKIP_(SLOW|ONLINE)_TESTS (#11479)
it was missing the SKIP_ONLINE_TESTS check for windows.
2023-06-19 19:44:03 +01:00
Javier Eguiluz
732d92c0e5
[skip ci] Fix various typos and grammar issues (#11143) 2023-04-28 11:05:32 +02:00
David Carlier
7b4b40f06f ext/sockets: addig Linux's IP_BIND_ADDRESS_NO_PORT.
Delay ephemeral port number attribution at connect time rather
than at bind's one.

Close GH-11119.
2023-04-26 19:26:29 +01:00
David CARLIER
6c532df705 ext/sockets adding FreeBSD's SO_REUSEPORT_LB constant.
SO_REUSEPORT_LB is, in fact, closer to the classical Linux's SO_REUSEPORT.

Close GH-11038
2023-04-08 17:35:10 +01:00
Niels Dossche
b606e44abc
Silence compiler warnings in ext/sockets/conversions.c (#10974)
These values will be initialised, but the compiler can't see it.
Write a dummy value to silence this.

Closes GH-10959.
2023-03-29 22:18:29 +02:00
Niels Dossche
efdbb4715e Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix uninitialized variable accesses in sockets/conversions
2023-03-29 19:52:25 +02:00
Niels Dossche
8a1cbdd7df Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix uninitialized variable accesses in sockets/conversions
2023-03-29 19:47:38 +02:00
Niels Dossche
b8755a7559 Fix uninitialized variable accesses in sockets/conversions
This was first pointed out in GH-10959.
The from_zval_... functions don't always write to the pointer, in particular
it is necessary to check for an error before using the value. Otherwise
we can access an uninitialized value and that's UB (and dangerous).

Note: this does *NOT* get rid of the compiler warning. Even though there
is error checking now, the compiler isn't smart enough to figure out
that the values can not be used uninitialized.

Closes GH-10966.
2023-03-29 19:44:30 +02:00
David CARLIER
fbaa2eb059 ext/sockets: add TCP_REPAIR to silently close a connection.
Closes GH-10724.
2023-02-27 22:56:06 +00:00
David Carlier
19a7281efa sockets add SO_RERROR/SO_ZEROIZE/SO_SPLICE net/openbsd's constants.
Closes GH-10563.
2023-02-12 21:55:55 +00: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
David Carlier
908d954de0 sockets updlite protocol support, with checksum coverage settings.
Close GH-10468
2023-01-29 18:19:54 +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
f8f7fd2db1 sockets add AF_DIVERT constant.
Allow to bind a socket to a divert port without being concerned
by its address. for ipfw filter purpose (SO_USER_COOKIE constant).
FreeBSD only.

Close GH-10415.
2023-01-22 22:48:45 +00:00
Christoph M. Becker
c8955c078a
Revert GH-10220
Cf. <https://github.com/php/php-src/pull/10220#issuecomment-1383739816>.

This reverts commit ecc880f491.
This reverts commit 588a07f737.
This reverts commit f377e15751.
This reverts commit b4ba16fe18.
This reverts commit 694ec1deea.
This reverts commit 6b34de8eba.
This reverts commit aa1cd02a43.
This reverts commit 308fd311ea.
This reverts commit 16203b53e1.
This reverts commit 738fb5ca54.
This reverts commit 9fdbefacd3.
This reverts commit cd4a7c1d90.
This reverts commit 928685eba2.
This reverts commit 01e5ffc85c.
2023-01-16 12:27:33 +01:00
David Carlier
9198e8894b socket DF flag on UDP socket via IP_MTU_DISCOVER on Linux and IP_DONTFRAGMENT on FreeBSD for path MTU discovery purpose.
idea proposal via ml :
https://marc.info/?l=php-internals&m=167329288509393&w=2

Close GH-10282
2023-01-12 22:22:30 +00:00
Max Kellermann
308fd311ea ext/{standard,json,random,...}: add missing includes 2023-01-10 14:19:03 +00:00
David Carlier
9c2572565a sockets adding TCP_QUICKACK constant.
having tigher control on ACK delays, difference is the setting
is `volatile` as it can be turned off by the kernel if not set
 explicitally set otherwise on the socket.

Closes GH-10145.
2022-12-22 14:50:33 +00: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