File tree 2 files changed +10
-10
lines changed 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -98,14 +98,13 @@ ZEND_DECLARE_MODULE_GLOBALS(sockets)
98
98
#endif
99
99
100
100
#if defined(ETH_P_ALL )
101
- #define PHP_ETH_PROTO_CHECK (protocol , family ) \
102
- do { \
103
- /* We ll let EINVAL errno warning about miusage, too many protocols conflicts but AF_PACKET family works only with ETH_P_* constants */ \
104
- if ((protocol >= ETH_P_LOOP && protocol <= USHRT_MAX) && family == AF_PACKET) { \
105
- protocol = htons(protocol); \
106
- } \
107
- } \
108
- while (0)
101
+ #define PHP_ETH_PROTO_CHECK (protocol , family ) \
102
+ do { \
103
+ /* We ll let EINVAL errno warning about miusage, too many protocols conflicts */ \
104
+ if (protocol <= USHRT_MAX && family == AF_PACKET) { \
105
+ protocol = htons(protocol); \
106
+ } \
107
+ } while (0)
109
108
#else
110
109
#define PHP_ETH_PROTO_CHECK (protocol , family ) (0)
111
110
#endif
@@ -1180,7 +1179,7 @@ PHP_FUNCTION(socket_create)
1180
1179
RETURN_THROWS ();
1181
1180
}
1182
1181
1183
- PHP_ETH_PROTO_CHECK (protocol , protocol );
1182
+ PHP_ETH_PROTO_CHECK (protocol , domain );
1184
1183
1185
1184
object_init_ex (return_value , socket_ce );
1186
1185
php_sock = Z_SOCKET_P (return_value );
Original file line number Diff line number Diff line change 2
2
socket_getsockname from AF_PACKET socket
3
3
--EXTENSIONS--
4
4
sockets
5
+ posix
5
6
--SKIPIF--
6
7
<?php
7
8
@@ -18,7 +19,7 @@ if (!function_exists("posix_getuid") || posix_getuid() != 0) {
18
19
$ s_bind = socket_bind ($ s_c , 'lo ' );
19
20
var_dump ($ s_bind );
20
21
21
- // Connect to destination address
22
+ // sock_getsockname in this context gets the interface rather than the address.
22
23
$ s_conn = socket_getsockname ($ s_c , $ istr , $ iindex );
23
24
var_dump ($ s_conn );
24
25
var_dump ($ istr );
You can’t perform that action at this time.
0 commit comments