Commit Graph

493 Commits

Author SHA1 Message Date
Anatol Belski
2da1c805ec ported ext/sockets 2014-08-19 13:22:27 +02:00
Anatol Belski
63d3f0b844 basic macro replacements, all at once 2014-08-19 08:07:31 +02:00
Xinchen Hui
f7f411e4e2 It's okey for use a stack value here (deleted immediately after use) 2014-08-14 12:26:45 +08:00
Dmitry Stogov
b108267f2c Merge branch 'master' into phpng
* master: (41 commits)
  Update copyright year to 2014
  Update copyright year to 2014
  Update copyright year to 2014
  Update copyright year to 2014
  Update copyright year to 2014
  Update copyright year to 2014
  Update copyright year to 2014
  NEWS
  Fix Request #67453 Allow to unserialize empty data.
  Update copyright year to 2014
  Update copyright year for re2c generated files
  Update copyright year to 2014
  Update copyright year for re2c files as well
  Fix patch for bug #67436
  fix failed test
  Fix test on modern distro where old unsecure algo are disabled in openssl config. Testing recent algo should be enough to check this function.
  Added tests for bug 67436
  Fixed wrong XFAIL test - already fixed
  Fix typo in Bug #67406 NEWS entry
  Fix typo in Bug #67406 NEWS entry
  ...

Conflicts:
	Zend/zend_compile.c
	ext/session/session.c
	ext/standard/array.c
	ext/standard/http_fopen_wrapper.c
	tests/classes/bug63462.phpt
2014-06-18 17:50:27 +04:00
Lior Kaplan
1222f51ebd Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Update copyright year to 2014
  Update copyright year to 2014
  Update copyright year to 2014
  Update copyright year to 2014
2014-06-18 00:14:18 +03:00
Lior Kaplan
728c554f93 Update copyright year to 2014 2014-06-18 00:12:33 +03:00
Dmitry Stogov
c1965f58d4 Use reference counting instead of zval duplication 2014-06-05 16:04:11 +04:00
Xinchen Hui
3cbdcdc2c8 Fixed several tests failes 2014-05-18 12:02:54 +08:00
Pierre Joye
c0bd24b502 Z_TYPE_PP > Z_TYPE_P 2014-05-17 05:44:26 +02:00
Xinchen Hui
489da59b08 Refactoring socket (only compilable now) 2014-05-17 10:23:46 +08:00
Dmitry Stogov
17d027ed47 Split IS_BOOL into IS_FALSE and IS_TRUE 2014-04-30 18:32:42 +04:00
Xinchen Hui
c081ce628f Bump year 2014-01-03 11:08:10 +08:00
Xinchen Hui
47c9027772 Bump year 2014-01-03 11:06:16 +08:00
Xinchen Hui
c0d060f5c0 Bump year 2014-01-03 11:04:26 +08:00
Felipe Pena
37897e258d Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  - Fixed bug #66381 (__ss_family was changed on AIX 5.3)
2014-01-01 09:56:49 -02:00
Felipe Pena
5967fb194f - Fixed bug #66381 (__ss_family was changed on AIX 5.3) 2014-01-01 09:55:14 -02:00
Anatol Belski
f0cf312d8c Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  added missing prototype
2013-12-11 14:16:07 +01:00
Anatol Belski
edf601a41f added missing prototype 2013-12-11 14:15:40 +01:00
Felipe Pena
a2f478cd94 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  - Fixed bug #65923 (ext/socket assumes AI_V4MAPPED is defined)
2013-11-30 11:40:42 -02:00
Felipe Pena
78f69a2b4f - Fixed bug #65923 (ext/socket assumes AI_V4MAPPED is defined) 2013-11-30 11:39:57 -02:00
Rasmus Lerdorf
259c74654c Merge branch 'PHP-5.5'
* PHP-5.5:
  Trivial Coverity fix
2013-10-19 17:56:21 -07:00
Rasmus Lerdorf
4a205092f7 Trivial Coverity fix 2013-10-19 17:55:34 -07:00
Michael Wallner
bc16dfda1f Merge branch 'PHP-5.5'
* PHP-5.5:
  fix bug #65808 	the socket_connect() won't work with IPv6 address
  5.4.22-dev now
2013-10-02 15:56:09 +02:00
Michael Wallner
2ba3926815 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  fix bug #65808 	the socket_connect() won't work with IPv6 address
  5.4.22-dev now

Conflicts:
	configure.in
	ext/sockets/sockets.c
	main/php_version.h
2013-10-02 15:55:38 +02:00
Michael Wallner
9209c19f8f fix bug #65808 the socket_connect() won't work with IPv6 address 2013-10-02 15:19:25 +02:00
Anatol Belski
c6651942ce Merge branch 'PHP-5.5'
* PHP-5.5:
  fix header include
  new NEWS for next release
2013-07-18 15:29:17 +02:00
Anatol Belski
d8dd4d9b02 fix header include
stddef.h is needed to have offsetof macros on windows (at least)
2013-07-18 15:28:20 +02:00
Gustavo Lopes
2443df37fd Merge branch 'PHP-5.5'
* PHP-5.5:
  NEWS for 710150c and e2744f1
  socket: support unix paths in the abstract namespace
  socket: fix bug #65260 (SCM_RIGHTS)
2013-07-16 00:03:00 +02:00
Gustavo Lopes
710150ccb7 socket: support unix paths in the abstract namespace
Those starting with '\0'.
2013-07-15 23:57:51 +02:00
Gustavo Lopes
e2744f1aa3 socket: fix bug #65260 (SCM_RIGHTS)
The data for messages of type SOL_SOCKET/SCM_RIGHTS was not being
passed correctly. There were actually two bugs: (1) the number of file
descriptors being passed was being read incorrectly (the length of the
cmsg array was being read instead of that of its 'data' element), as a
result it was generally being reported as always three elements
('level', 'type' and 'data') and (2) the allocated block for writing
the file descriptors was being acessed incorrectly because a 1-based
counter was being used as if it was 0-based.

Any of these two bugs would probably be enough to cause heap
corruption.
2013-07-15 23:57:49 +02:00
Veres Lajos
b79b13b4ef less serious compatAbility fixes 2013-07-15 00:21:39 -07:00
Veres Lajos
d17e8ac32f less serious compatAbility fixes 2013-07-15 00:19:39 -07:00
Veres Lajos
227556c6a2 less serious compatAbility fixes 2013-07-15 00:17:35 -07:00
Stanislav Malyshev
e02b41d25c Merge branch 'PHP-5.5'
* PHP-5.5:
  Implements feature Bug #63472 ability to set SO_BINDTODEVICE on socket.
2013-06-23 15:26:30 -07:00
Stanislav Malyshev
1beb24bd6f Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Implements feature Bug #63472 ability to set SO_BINDTODEVICE on socket.

Conflicts:
	ext/sockets/sockets.c
2013-06-23 15:26:14 -07:00
Damjan Cvetko
a0b4348abc Implements feature Bug #63472 ability to set SO_BINDTODEVICE on socket. 2013-06-23 15:20:54 -07:00
Anatol Belski
bc656cde04 Merge branch 'PHP-5.5'
* PHP-5.5:
  Fixed error handling for ext/sockets under win
2013-05-16 19:29:42 +02:00
Anatol Belski
d565e8f0eb Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Fixed error handling for ext/sockets under win
2013-05-16 19:29:25 +02:00
Anatol Belski
8dec06ea2a Fixed error handling for ext/sockets under win
WSAGetLastError() must be the very next call after a socket
function had an invalid return. Any function call inbetween
will clear the error information.
2013-05-16 19:23:31 +02:00
Gustavo Lopes
8687332e08 Fix bug #64506: fix build with --disable-ipv6 2013-05-08 19:58:27 +02:00
Gustavo Lopes
ab38bf1931 Merge branch 'PHP-5.5'
* PHP-5.5:
  Fix bug #64506: fix build with --disable-ipv6
2013-05-08 19:57:23 +02:00
Gustavo Lopes
6f3c3862ca Fix bug #64506: fix build with --disable-ipv6 2013-05-08 19:56:40 +02:00
Sara Golemon
e836f8e38f Oops 2013-04-30 19:43:52 -07:00
Sara Golemon
e217db8e69 Harden loopback tests
These tests depend on being able to bind port 31337.
Try a range of ports until one binds or we give up trying.
2013-04-30 19:30:55 -07:00
Xinchen Hui
082741814a skip if no IPv6 support 2013-03-05 17:18:13 +08:00
Xinchen Hui
e5d0dc24d2 Fix tests temporary
seems IPV6_PKTINFO are not avaiable in some OS
2013-03-05 16:56:00 +08:00
Xinchen Hui
1978dae309 Skip test on Apple 2013-03-05 14:02:28 +08:00
Xinchen Hui
3f67d5ae43 Revert "Fixed Bug #64340 (sockets tests failed) Patch by Reeze"
build break, will only leave the test script fix first

This reverts commit f2246f352f.
2013-03-05 13:58:20 +08:00
Xinchen Hui
46e612ada4 Merge branch 'PHP-5.4' into PHP-5.5 2013-03-03 11:25:29 +08:00
Xinchen Hui
9bda6a25a5 Fix test (skip on unable to create socket) 2013-03-03 11:24:45 +08:00
Xinchen Hui
f2246f352f Fixed Bug #64340 (sockets tests failed) Patch by Reeze
Add __APPLE_USE_RFC_3542 for OS X 10.7 because IPv6 options are incompatible with RFC 2292.
2013-03-03 10:51:04 +08:00
Gustavo Lopes
59ec22b370 sendrecvmsg_shutdown function moved to mshutdown
The function php_socket_sendrecvmsg_shutdown() should have been called in
MSHUTDOWN, not RSHUTDOWN.

Bug only on TSRM builds.

Should fix bug #64287.
2013-02-24 03:50:38 +01:00
Gustavo Lopes
189fbfd53b Fix ext/sockets build with phpize
Fixes bug #64285
2013-02-24 00:49:25 +01:00
Gustavo Lopes
91538e4e13 Cleanup some multicast code; fix for mac os x?
When I moved some stuff from sockets.c to multicast.c, I did not copy
some conditional defines for systems without the RFC 3678 API.

I moved such defines to multicast.h so both sockets.c and multicast.c
can benefit from them and I prefixed them with PHP_ so that it's less
confusing: now PHP_MCAST_* are defined to either the MCAST_* RFC 3678
APIs or to legacy APIs and MCAST_* always mean the (possibly undefined)
system definitions.
2013-02-17 22:42:58 +01:00
Gustavo Lopes
8771c265a4 Fix test on Windows.
Windows complains of invalid parameters because the socket is not bound.
The test expected the error to be EAGAIN/EWOULDBLOCK. Moved the call down,
after the socket is bound.
2013-02-03 02:03:00 +01:00
Gustavo Lopes
af1b90d62b Fix bug and hopefully build on WinSDK 6.1
There build was failing on rmtools on the sockets extension for two reasons:

  1. IPV6_TCLASS and IPV6_RECVTCLASS not being defined. These are probably
  recent additions to SDK. Windows 7 doesn't event seem to have complete
  support for IPV6_TCLASS, not accepting in WSASendMsg(). The parts that
  needed this constant were not guarded by #ifdefs. They are now.

  2. The constants EWOULDBLOCK and EINPROGRESS not being defined. These
  were only defined in php_network.h, outside of the extension, and not
  all source files included this header. Nevertheless, a macro defined in
  php_sockets.h needed these constants. When this macro was used in files
  that did not include php_network.h, the compilation would fail.
  Surprisingly, the build did not fail when using the 7.1 Windows SDK
  (more likely, the CRT headers used in VC10), as somehow errno.h was
  being included through some other standard header. This would make the
  constant EWOULDBLOCK defined; however, it would be defined to the wrong
  value. In the winsock context, WSAEWOULDBLOCK should be used instead.
  Because we have difficulty using Windows-only constants in the code, we
  (re)define EWOULDBLOCK to WSAEWOULDBLOCK. This has the obvious
  disavantage we may miss problems like this again in the future.
2013-02-03 01:36:14 +01:00
Gustavo Lopes
03b1da5d7a php_strerror in ext/sockets renamed in 5.5 2013-02-02 18:39:47 +01:00
Gustavo Lopes
0110662ae9 Move macro back to .c file
Because it depends on a static function on that .c file.
2013-02-02 18:32:38 +01:00
Gustavo Lopes
b11777ca2a Merge branch 'sendrecvmsg_rebase_55' into PHP-5.5
* sendrecvmsg_rebase_55: (31 commits)
  Fix multicast.c not defining errno on Windows
  Fix non-Windows build
  send/recvmsg() support for Windows
  Remove some pre-vista code
  Revert "Payload of HOPLIMIT/TCLASS are 8-bit"
  Ensure memory is initialized
  Payload of HOPLIMIT/TCLASS are 8-bit
  Fix buf in string -> int conv.
  Build fixes; accept names for if_index
  Refactoring: move stuff to new conversions.c
  Support sticky IPV6_PKTINFO
  Rename some functions for consistency
  Destroy ancillary registry on shutdown
  Move some multicast stuff to multicast.c
  Fix mcast_ipv6_send test
  Check return of fstat()
  Fix build on Mac OS X
  Register extra MSG_* constants
  Add test for CMSG_RIGHTS
  Add test for CMSG_CREDENTIALS message
  ...
2013-02-02 16:50:38 +01:00
Gustavo Lopes
e2fc17c833 Fix multicast.c not defining errno on Windows
Small cleanups in includes as well.
2013-02-02 16:38:09 +01:00
Gustavo Lopes
608254fa57 Fix non-Windows build 2013-02-02 16:38:09 +01:00
Gustavo Lopes
7066cc7267 send/recvmsg() support for Windows 2013-02-02 16:38:09 +01:00
Gustavo Lopes
95f8d34f9c Revert "Payload of HOPLIMIT/TCLASS are 8-bit"
This reverts commit 61a5ec7381ba5388a52926779fe3f58af0caea83.

I checked Linux and OpenBSD and both use integers to write the
IPV6_TCLASS messages and they don't force any endianness. This is
despite RFC 3542 explicitly saying the first byte of cmsg_data will
have the result. In any case, it doesn't make any difference in
little-endian archs.
2013-02-02 16:38:08 +01:00
Gustavo Lopes
5c0a8b1a2a Ensure memory is initialized 2013-02-02 16:38:08 +01:00
Gustavo Lopes
f10baf14ed Payload of HOPLIMIT/TCLASS are 8-bit 2013-02-02 16:38:08 +01:00
Gustavo Lopes
c846fcef68 Fix buf in string -> int conv. 2013-02-02 16:38:08 +01:00
Gustavo Lopes
bd580db373 Build fixes; accept names for if_index 2013-02-02 16:38:08 +01:00
Gustavo Lopes
4414b33abd Refactoring: move stuff to new conversions.c 2013-02-02 16:38:08 +01:00
Gustavo Lopes
66ea024587 Support sticky IPV6_PKTINFO 2013-02-02 16:38:08 +01:00
Gustavo Lopes
b18bd8904e Rename some functions for consistency 2013-02-02 16:38:07 +01:00
Gustavo Lopes
8fb1aa6184 Destroy ancillary registry on shutdown 2013-02-02 16:38:07 +01:00
Gustavo Lopes
51394f76a5 Move some multicast stuff to multicast.c 2013-02-02 16:38:07 +01:00
Gustavo Lopes
3e515a2fd9 Fix mcast_ipv6_send test 2013-02-02 16:38:07 +01:00
Gustavo Lopes
5bf7b08efd Check return of fstat() 2013-02-02 16:38:07 +01:00
Gustavo Lopes
190a0ed713 Fix build on Mac OS X
By deactivating unsupported features on this OS.
2013-02-02 16:38:07 +01:00
Gustavo Lopes
51e65667f5 Register extra MSG_* constants 2013-02-02 16:38:06 +01:00
Gustavo Lopes
74cf40c2fd Add test for CMSG_RIGHTS 2013-02-02 16:38:06 +01:00
Gustavo Lopes
7fc4671df9 Add test for CMSG_CREDENTIALS message 2013-02-02 16:38:06 +01:00
Gustavo Lopes
a85d7f28f6 Added support for AF_UNIX messages
Added constants: SCM_RIGHTS, SCM_CREDENTIALS and SO_PASSCRED.

The function socket_cmsg_space() was modified to support message types with
variable size. Its new signature is:
int socket_cmsg_space(int $level, int $type, int $n)
where $n is the number of repetable elements that the message is composed of.
2013-02-02 16:38:06 +01:00
Gustavo Lopes
131245474b Redactor to expose socket_import_file_descriptor() 2013-02-02 16:38:06 +01:00
Gustavo Lopes
b3effa60c7 Improve imported socket family detection
Also added constant SO_FAMILY.
2013-02-02 16:38:06 +01:00
Gustavo Lopes
17540788ad Added missing return statements 2013-02-02 16:38:06 +01:00
Gustavo Lopes
0f849fe2aa Add test and slightly tweak another 2013-02-02 16:38:06 +01:00
Gustavo Lopes
73ab2385cb Support for IPV6_HOPLIMIT and IPV6_TCLASS 2013-02-02 16:38:05 +01:00
Gustavo Lopes
b27c22d627 Fix bug in from_zval_write_control_array() 2013-02-02 16:38:05 +01:00
Gustavo Lopes
b06f00477c Fix bug converting zval sockaddr
The bug ocurred when the family was not specified but was instead guessed.
2013-02-02 16:38:05 +01:00
Gustavo Lopes
806a6e6399 Add IPV6_UNICAST_HOPS option constant. 2013-02-02 16:38:05 +01:00
Gustavo Lopes
eb4b1f6d46 Add test for recvmsg() 2013-02-02 16:38:05 +01:00
Gustavo Lopes
5e51c85143 Wrap recvmsg() and sendmsg()
This introduces two new functions:

int socket_recvmsg(resource $socket, array &$msghdr, int $flags)
int socket_sendmsg(resource $socket, array $msghdr, int $flags)

The arrays representing struct msghdr follow the native counterpart
closely: structs are mapped to arrays, fields to array elements whose
key is the name of the field without the prefix (e.g. "name" instead
of "msg_name") and array are mapped to sequential numeric PHP arrays.

Right now the only type of ancillary data supported is fot the
level/type pair IPPROTO_IPV6/IPV6_PKTINFO.

I also refactored out the name resolution functions and made
sockets_strerror() a global function.
2013-02-02 16:38:05 +01:00
Gustavo Lopes
ac47448abb Ignore warnings on EAGAIN/EWOULDBLOCK/EINPROGRESS
See bug #63570
2013-02-02 15:43:05 +01:00
Gustavo Lopes
e8f0e863ae Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Fix wrong blocking state being set
  Fix tests (Windows)
  Remove a Windows only warning
  Move & improve PHP_SOCKET_ERROR def
  Move some declarations to sockets.c
  Fix overbroad skipif include
2013-02-02 15:32:03 +01:00
Gustavo Lopes
ac6342bbc0 Fix wrong blocking state being set 2013-02-02 15:29:18 +01:00
Gustavo Lopes
40663ede83 Fix tests (Windows) 2013-02-02 15:29:18 +01:00
Gustavo Lopes
9283b8aea4 Move & improve PHP_SOCKET_ERROR def 2013-02-02 15:29:11 +01:00
Gustavo Lopes
97d656fc82 Move some declarations to sockets.c 2013-02-02 14:06:23 +01:00
Gustavo Lopes
a100c25ea4 Fix overbroad skipif include 2013-02-02 14:06:23 +01:00
Remi Collet
4608341303 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Mark this test as requiring internet connecion.
2013-01-31 14:39:42 +01:00
Remi Collet
9d75bf35e9 Mark this test as requiring internet connecion. 2013-01-31 14:38:39 +01:00
Remi Collet
4ad5c82016 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Fix failed test: sys_errlist[116] have changed on recent glibc (Fedora 18) old: Stale NFS file handle new: Stale file handle
2013-01-31 14:25:43 +01:00
Remi Collet
f7362232f4 Fix failed test: sys_errlist[116] have changed on recent glibc (Fedora 18)
old: Stale NFS file handle
new: Stale file handle
2013-01-31 14:22:56 +01:00