Skip to content

resolve: a network query is made for the hostname when search domains are configured #23662

@gbsf

Description

@gbsf

systemd version the issue has been seen with

251.2

Used distribution

Archlinux

Linux kernel version used (uname -a)

Linux hostname 5.18.0-arch1-1 #1 SMP PREEMPT_DYNAMIC Tue, 24 May 2022 22:00:36 +0000 x86_64 GNU/Linux

CPU architecture issue was seen on

x86_64

Expected behaviour you didn't see

No network requests are made, according to the PROTOCOLS AND ROUTING section of systemd-resolved.service(8)

Unexpected behaviour you saw

If a search domain is configured (from DHCP, for example), systemd-resolved will attempt to query the network to resolve the machine hostname. Since hostname.searchdomain won't exist, no result is returned for this query.
Since apparently my ISP's router has a very broken DNS implementation, I get a timeout error instead. This timeout greatly increases the startup time for programs like Firefox, which attempt to resolve the hostname at launch.

Steps to reproduce the problem

  • Have a terrible router (optional)
  • Configure a search domain for the interface
  • Make sure the hostname isn't present in /etc/hosts
  • Run resolvectl query $(hostname)

Additional program output to the terminal or log subsystem illustrating the issue

systemd-resolved[153542]: Looking up RR for hostname IN A.
systemd-resolved[153542]: Looking up RR for hostname IN AAAA.
systemd-resolved[153542]: Cache miss for hostname.mygateway IN A
systemd-resolved[153542]: Firing regular transaction 40417 for <hostname.mygateway IN A> scope dns on wlan0/* (validate=yes).
systemd-resolved[153542]: Using feature level UDP+EDNS0 for transaction 40417.
systemd-resolved[153542]: Using DNS server 1.1.1.1 for transaction 40417.
systemd-resolved[153542]: Announcing packet size 1472 in egress EDNS(0) packet.
systemd-resolved[153542]: Emitting UDP, link MTU is 1500, socket MTU is 0, minimal MTU is 40
systemd-resolved[153542]: Sending query packet with id 40417 of size 47.
systemd-resolved[153542]: Cache miss for hostname.mygateway IN AAAA
systemd-resolved[153542]: Firing regular transaction 4147 for <hostname.mygateway IN AAAA> scope dns on wlan0/* (validate=yes).
systemd-resolved[153542]: Using feature level UDP+EDNS0 for transaction 4147.
systemd-resolved[153542]: Using DNS server 1.1.1.1 for transaction 4147.
systemd-resolved[153542]: Announcing packet size 1472 in egress EDNS(0) packet.
systemd-resolved[153542]: Emitting UDP, link MTU is 1500, socket MTU is 0, minimal MTU is 40
systemd-resolved[153542]: Sending query packet with id 4147 of size 47.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions