Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Target `.` in SRV records is returned as empty string instead

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

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

評価

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

調査の方向性

Start by tracing resolveAll() with Message::TYPE_SRV through the SRV response parsing path and compare handling of a target of "." with a normal hostname. Add a regression test for the _test2-style record and verify that the returned target is "." rather than an empty string.

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

説明

bug

Hey all,

Opening this ticket following the suggestion of a maintainer of movim in https://github.com/movim/movim/issues/1408, which uses this lib. I'm not very good at PHP so please bear with me 😅

I believe there might be something wrong the way react dns returns data from SRV records. I have set up two test SRV records as follows:

_test1._tcp.nadia.moe. 300 IN SRV 1 1 6969 nadia.moe.
_test2._tcp.nadia.moe. 300 IN SRV 1 1 0 .

They should return the expected when querying it:

22:43:36 ~/Staging/react-dns-repro $> dig +short SRV _test1._tcp.nadia.moe
1 1 6969 nadia.moe.
22:44:14 ~/Staging/react-dns-repro $> dig +short SRV _test2._tcp.nadia.moe
1 1 0 .

Note the literal . when resolving _test2._tcp.nadia.moe. This . character is not present in the response from React/DNS:

<?php

use React\Dns\Config\Config;
use React\Dns\Resolver\Factory;
use React\Dns\Model\Message;

require __DIR__ . '/vendor/autoload.php';

$config = Config::loadSystemConfigBlocking();
if (!$config->nameservers) {
    $config->nameservers[] = '8.8.8.8';
}

$factory = new Factory();
$resolver = $factory->create($config);

$name='_test1._tcp.nadia.moe';
$resolver->resolveAll($name, Message::TYPE_SRV)->then(function (array $ips) use ($name) {
    var_dump($ips);
}, function (Exception $e) use ($name) {
    echo 'No IPv4 addresses for ' . $name . ': ' . $e->getMessage() . PHP_EOL;
});

$name='_test2._tcp.nadia.moe';
$resolver->resolveAll($name, Message::TYPE_SRV)->then(function (array $ips) use ($name) {
    var_dump($ips);
}, function (Exception $e) use ($name) {
    echo 'No IPv4 addresses for ' . $name . ': ' . $e->getMessage() . PHP_EOL;
});
array(1) {
  [0]=>
  array(4) {
    ["priority"]=>
    int(1)
    ["weight"]=>
    int(1)
    ["port"]=>
    int(6969)
    ["target"]=>
    string(9) "nadia.moe"
  }
}
array(1) {
  [0]=>
  array(4) {
    ["priority"]=>
    int(1)
    ["weight"]=>
    int(1)
    ["port"]=>
    int(0)
    ["target"]=>
    string(0) ""
  }
}

In the response above, one would expect target to be . instead of the empty string.

This is somewhat relevant because . has a special meaning for SRV records: As per https://datatracker.ietf.org/doc/html/rfc2782, clients must check for this value specified as a target, and understand by it that the service is not provided and should not attempt connection. In the case of movim, it is doing that in https://github.com/movim/movim/blob/5aaacc6b2e05f89fa41007cf7378a4568f648dde/linker.php#L144, but this check is failing as react dns does not return ., but an empty string.

I'm not entirely sure wheter this is expected behavior, but in case it was, perhaps it is worth stating somewhere.

主要言語
PHP
スター
542
フォーク
62
PR マージ指標
30日以内にマージされた PR はありません

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

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

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

reactphp/dns のほかの issue

reactphp/dns の issue をすべて見る

似ている issue

PHP の issue をもっと見る

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

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