[php-src] Issue #11662: ext/sockets/tests/bug63000.phpt fails when multicast disabled
| From: | orlitzky | Date: | Mon, 10 Jul 2023 13:54:59 +0000 |
| Subject: | [php-src] Issue #11662: ext/sockets/tests/bug63000.phpt fails when multicast disabled | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244933@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11662
Author: orlitzky
### Description
This test tries to set a multicast socket option,
```
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_bind($socket, '0.0.0.0', 31057);
$so = socket_set_option($socket, IPPROTO_IP, MCAST_JOIN_GROUP, array(
"group" => '224.0.0.251',
"interface" => 0,
));
var_dump($so);
```
but even on Linux, the ability to do so is not guaranteed. For example, if you run the test in its
own network namespace,
```
$ unshare -n sapi/cli/php ./run-tests.php ext/sockets/tests/bug63000.phpt
```
you'll get an error,
```
---- EXPECTED OUTPUT
bool(true)
---- ACTUAL OUTPUT
Warning: socket_set_option(): Unable to set socket option [19]: No such device in ...bug63000.php on
line 5
bool(false)
---- FAILED
```
The reason is that multicast first has to be enabled on a "new" network interface.
Specifically, both of the following seem necessary,
```
$ ifconfig lo multicast
$ route add -net 224.0.0.0 netmask 224.0.0.0 lo
```
before the test will work.
I'm not really sure what the best way around this is. A simpler test for basic multicast
support in SKIPIF?
### PHP Version
php-8.2.8
### Operating System
_No response_