Skip to content

order: ipv4first doesn't seem to have effect in dns.lookup? #55391

@kt3k

Description

@kt3k

Version

22.7.0

Platform

Darwin 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:21 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T8103 arm64

Subsystem

dns

What steps will reproduce the bug?

Run:

import dns from "node:dns";
dns.lookup("localhost", { all: true, order: "ipv4first" }, console.log);

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

The script prints:

null [ { address: '127.0.0.1', family: 4 }, { address: '::1', family: 6 } ]

What do you see instead?

The script prints:

null [ { address: '::1', family: 6 }, { address: '127.0.0.1', family: 4 } ]

Additional information

The issue doesn't happen with dns.promises.lookup. The below script prints ipv4 address first:

import dns from "node:dns";
console.log(await dns.promises.lookup("localhost", { all:true, order: "ipv4first" }));

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.dnsIssues and PRs related to the dns subsystem.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions