php / php/php-src

ext/sockets/tests/bug63000.phpt fails when multicast disabled

オープン
#11,662 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Bug Category: Tests Extension: sockets Status: Verified
主要言語
C
スター
40.4k
フォーク
8.1k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

ext/sockets/tests/bug63000.phpt から始め、run-tests.php を使用して sapi/cli/php で実行します。Issue で説明されている unshare -n のケースも含めてください。既存のテスト動作を確認し、multicast が利用できない場合に結果が適切になるようにしつつ、multicast がサポートされている場合のカバレッジを維持します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
php
領域
networking, testing-qa
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。