Skip to content

DHCP options of DHCP server return bogus content, breaking network #2688

@alexpovel

Description

@alexpovel

Prerequisites

Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Issue Details

  • Version of AdGuard Home server:
    • v0.105.1
  • How did you install AdGuard Home:
    • Docker
  • How did you setup DNS configuration:
  • If it's a router or IoT, please write device model:
    • Raspberry Pi 4
  • CPU architecture:
    • ARM
  • Operating system and version:
    • Raspbian

Expected Behavior

The following DHCP config, part of AdGuardHome.yaml, worked in v0.104.3:

dhcp:
  enabled: true
  # The container will run in `network_mode = host`, so the interfaces have to agree:
  interface_name: eth0
  dhcpv4:
    gateway_ip: 192.168.0.1
    subnet_mask: 255.255.255.0
    range_start: 192.168.0.50
    range_end: 192.168.0.250
    lease_duration: 86400 # default: 86400 (24h)
    icmp_timeout_msec: 1000
    options:
      # https://github.com/AdguardTeam/AdGuardHome/wiki/DHCP#the-dhcpdhcpv4options-array-field
      # Options and numbers here:
      # https://www.iana.org/assignments/bootp-dhcp-parameters/bootp-dhcp-parameters.xhtml#options
      # Option #4 sets time server (NTP):
      - "4 ip 192.168.0.1"
      # Option #6 broadcasts the IP as the DNS server for DHCP clients to use:
      - "6 ip 192.168.0.2"
  dhcpv6:
    range_start: ""
    lease_duration: 86400
    ra_slaac_only: false
    ra_allow_slaac: false

where 192.168.0.2 is the AdGuardHome server's IP. Used to work like a charm! On DHCP clients, the following output used to be observable (this example is Debian 10):

# (Some irrelevant lines removed). 
$ cat /var/lib/dhcp/dhclient*.leases
lease {
  interface "eno1";
  fixed-address 192.168.0.4;
  option subnet-mask 255.255.255.0;
  option dhcp-lease-time 86400;
  option routers 192.168.0.1;
  option time-servers 192.168.0.1;
  option dhcp-message-type 5;
  option dhcp-server-identifier 192.168.0.2;
  option domain-name-servers 192.168.0.2;
  option fqdn.server-update true;
  option fqdn.rcode1 255;
  option fqdn.rcode2 255;
  renew 2 2021/02/16 08:06:23;
  rebind 2 2021/02/16 17:44:31;
  expire 2 2021/02/16 20:44:31;
}

and

$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.0.2

Actual Behavior

Example Client 1 (Debian 10 NUC)

Now, the output on a Debian 10 DHCP client is the following. This is what DHCP clients get told by AdGuardHome's DHCP server, as part of the DHCP options 4 and 6, see config above:

# (Most lines removed). 
$ cat /var/lib/dhcp/dhclient*.leases
lease {
  option time-servers 0.0.0.0,0.0.0.0,0.0.255.255,192.168.0.1;
  option domain-name-servers 0.0.0.0,0.0.0.0,0.0.255.255,192.168.0.2;
}

and

$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 0.0.0.0
nameserver 0.0.255.255
nameserver 192.168.0.2

How did 0.0.0.0 (twice) and 0.0.255.255 get in there? As a consequence of this, one of the errors I got was along the lines of

bash[1024]: ../../../../lib/isc/unix/socket.c:2173: internal_send: 0.0.255.255#53: Invalid argument

in journalctl of a service that tried to start up but couldn't. It tried to run DNS queries against 0.0.255.255 and obviously failed. Other services failed because they tried against 0.0.0.0.

Example Client 2 (Synology NAS)

Similar behaviour on this machine:

$ cat /etc/dhclient/ipv4/dhcpcd-eth0.info
IPADDR=192.168.0.3
NETMASK=255.255.255.0
NETWORK=192.168.0.0
BROADCAST=192.168.0.255
GATEWAY=192.168.0.1
DOMAIN=
DNS=0.0.0.0 0.0.0.0 0.0.255.255 192.168.0.2  # <----
DHCPSID=192.168.0.2
DHCPGIADDR=
DHCPSIADDR=

This causes the entire machine to fall on its face pretty hard.


I've rolled back to v0.104.3. The above is an issue that breaks my entire home network.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions