dhcpcd: dhcpcd crashes every 5 days

For over a year now, dhcpcd crashes every 5 days. I “solved” this by running a ksh script every 30 minutes that starts it up when it is not running.

Basic machine info:

router$ uname -a
OpenBSD router.philomathiclife.com 7.2 GENERIC.MP#6 amd64
router$ dhcpcd --version
dhcpcd 9.4.1
Copyright (c) 2006-2021 Roy Marples
Compiled in features: INET ARP ARPing IPv4LL INET6 DHCPv6 AUTH PRIVSEP
router$ cat /etc/dhcpcd.conf
noipv6rs
denyinterfaces !(em0)
allowinterfaces em0
script ""
interface em0
	duid
	iaid 0
	ia_na 0
	ia_pd 0/::/60
	ipv6rs
	leasetime -1
	nooption domain_name,domain_name_servers,domain_search,fqdn,host_name,ntp_servers,time_offset,time_servers
	option rapid_commit
	persistent
	require dhcp_server_identifier
	waitip 6
	waitip 4

Error that is logged to /var/log/daemon when it crashes:

Jan 26 03:24:19 router dhcpcd[41538]: ps_inet_dodispatch: Connection reset by peer
Jan 26 03:24:19 router dhcpcd[41538]: control_free: No such file or directory
Jan 26 03:24:19 router dhcpcd[41538]: ps_sendpsmmsg: Destination address required
Jan 26 03:24:19 router dhcpcd[41538]: ps_dostop: Destination address required

I ran sysctl kern.nosuidcoredump=2, but unfortunately no crash dump was created in /var/crash/dhcpcd.

I allow all egress traffic, ICMPv6 and ICMP ingress traffic, IPv6 UDP ingress traffic on the external interface destined to port 546, and IPv4 UDP ingress traffic on the external interface destined to port 68. I am not sure what additional information is useful. When dhcpcd is started up, the following is logged to /var/log/daemon:

Jan 26 03:43:01 router dhcpcd[11791]: dhcpcd-9.4.1 starting
Jan 26 03:43:01 router dhcpcd[56722]: DUID 00:04:1c:02:1b:03:0d:04:e7:05:08:06:5c:07:00:08:00:09
Jan 26 03:43:01 router dhcpcd[56722]: em0: IAID 00:00:00:00
Jan 26 03:43:02 router dhcpcd[56722]: em0: rebinding lease of 71.229.183.31
Jan 26 03:43:02 router dhcpcd[56722]: em0: probing address 71.229.183.31/22
Jan 26 03:43:02 router dhcpcd[56722]: em0: soliciting an IPv6 router
Jan 26 03:43:02 router dhcpcd[56722]: em0: rebinding prior DHCPv6 lease
Jan 26 03:43:04 router dhcpcd[56722]: em0: REPLY6 received from fe80::201:5cff:fe63:ee46
Jan 26 03:43:04 router dhcpcd[56722]: em0: adding address 2001:558:6040:83:a99d:b51a:6dd1:632c/128
Jan 26 03:43:04 router dhcpcd[56722]: em0: renew in 141184, rebind in 244864, expire in 313984 seconds
Jan 26 03:43:04 router dhcpcd[56722]: lo0: adding reject route to 2601:283:4403:ce80::/60 via ::1
Jan 26 03:43:04 router dhcpcd[56722]: em0: delegated prefix 2601:283:4403:ce80::/60
Jan 26 03:43:05 router dhcpcd[56722]: em0: Router Advertisement from fe80::201:5cff:fe63:ee46
Jan 26 03:43:05 router dhcpcd[56722]: em0: adding route to 2001:558:4070:83::/64 via fe80::201:5cff:fe63:ee46
Jan 26 03:43:05 router dhcpcd[56722]: em0: adding route to 2001:558:5021:32::/64 via fe80::201:5cff:fe63:ee46
Jan 26 03:43:05 router dhcpcd[56722]: em0: adding route to 2001:558:6040:83::/64 via fe80::201:5cff:fe63:ee46
Jan 26 03:43:05 router dhcpcd[56722]: em0: adding route to 2001:558:803a:47::/64 via fe80::201:5cff:fe63:ee46
Jan 26 03:43:05 router dhcpcd[56722]: em0: adding default route via fe80::201:5cff:fe63:ee46
Jan 26 03:43:07 router dhcpcd[56722]: em0: leased 71.229.183.31 for 224363 seconds
Jan 26 03:43:07 router dhcpcd[56722]: em0: adding route to 71.229.180.0/22
Jan 26 03:43:07 router dhcpcd[56722]: em0: adding default route via 71.229.180.1

Potentially relevant: when I run dhcpcd -U em0, it times out more often than not between the Neighbor Discovery info and the DHCPv6 info. Regardless if it times out, /var/log/daemon shows:

Jan 27 17:59:58 router dhcpcd[56722]: control command: dhcpcd -U em0
Jan 27 17:59:58 router dhcpcd[56722]: control_free: No such file or directory
Jan 27 18:00:03 router dhcpcd[56722]: control_free: No such file or directory

Not sure if the control_free error being one of the errors that is shown when crashing is important.

router$ dhcpcd -U em0
reason=CARRIER
interface=em0
protocol=link
if_configured=true
ifcarrier=up
ifmetric=0
ifwireless=0
ifflags=34883
ifmtu=1500

reason=RENEW
interface=em0
protocol=dhcp
ip_address=71.229.183.31
subnet_cidr=22
network_number=71.229.180.0
subnet_mask=255.255.252.0
routers=71.229.180.1
broadcast_address=255.255.255.255
dhcp_lease_time=345600
dhcp_message_type=5
dhcp_server_identifier=96.113.84.152
dhcp_renewal_time=172800
dhcp_rebinding_time=302400

reason=ROUTERADVERT
interface=em0
protocol=ra
nd1_from=fe80::201:5cff:fe63:ee46
nd1_acquired=360690
nd1_now=360690
nd1_hoplimit=64
nd1_flags=MO
nd1_lifetime=1800
nd1_prefix_information1_length=64
nd1_prefix_information1_flags=
nd1_prefix_information1_vltime=604800
nd1_prefix_information1_pltime=302400
nd1_prefix_information1_prefix=2001:558:4070:83::
nd1_prefix_information2_length=64
nd1_prefix_information2_flags=
nd1_prefix_information2_vltime=604800
nd1_prefix_information2_pltime=302400
nd1_prefix_information2_prefix=2001:558:5021:32::
nd1_prefix_information3_length=64
nd1_prefix_information3_flags=
nd1_prefix_information3_vltime=604800
nd1_prefix_information3_pltime=302400
nd1_prefix_information3_prefix=2001:558:6040:83::
nd1_prefix_information4_length=64
nd1_prefix_information4_flags=
nd1_prefix_information4_vltime=604800
nd1_prefix_information4_pltime=302400
nd1_prefix_information4_prefix=2001:558:803a:47::

reason=REBIND6
interface=em0
protocol=dhcp6
dhcp6_client_id=00041c021b030d04e70508065c0700080009
dhcp6_server_id=000100011caae03b40a8f02e8ef4
dhcp6_ia_na1_iaid=00000000
dhcp6_ia_na1_t1=141184
dhcp6_ia_na1_t2=244864
dhcp6_ia_na1_ia_addr1=2001:558:6040:83:a99d:b51a:6dd1:632c
dhcp6_ia_na1_ia_addr1_pltime=313984
dhcp6_ia_na1_ia_addr1_vltime=313984
dhcp6_ia_pd1_iaid=00000000
dhcp6_ia_pd1_t1=141184
dhcp6_ia_pd1_t2=244864
dhcp6_ia_pd1_prefix1_pltime=313984
dhcp6_ia_pd1_prefix1_vltime=313984
dhcp6_ia_pd1_prefix1_length=60
dhcp6_ia_pd1_prefix1=2601:283:4403:ce80::

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 33 (10 by maintainers)

Commits related to this issue

Most upvoted comments

I re-compiled master and kept privsep. I’ll report back in a week if it hasn’t crashed.

Could I get you to add debug to the top of your /etc/dhcpcd.conf please and restart dhcpcd? It will give a log more debug output and hopefully the last point before it crashes. Optionally add logfile /var/log/dhcpcd.log as well to get just the dhcpcd logs.

You’ll need to restart dhcpcd for it to take effect.

Does dhcpcd allow DHCP servers to send data from a port that is not 67? I know it is a very common misconception that DHCP servers MUST/SHOULD send traffic from port 67, but RFC 2131 makes no requirements or recommendations on what the source ports are. Similarly, RFC 8415 makes no requirements or recommendations on the source ports for DHCPv6 (i.e., servers can send data from a port that is not 547).

Stating this another way, RFC 2131 only says that servers MUST send traffic to port 68 on the client, the client MUST send traffic to port 67 on the server, RFC 8415 states servers MUST send traffic to port 546 on the client, and clients MUST send traffic to port 547 on the server.

I introduced checking the source port when I was improving the BPF code, but you’re right there is no mention of what the source port must be so I’ve removed the check in the above commit on the master branch.

The first kernel warning is an OpenBSD header that needs fixing in OpenBSD. The last warning is fine - OpenBSD is correctly telling us this but a random determinstic value is what we want per RFC 3927 section 2.1 The other warning are about the facilities dhcpcd wants that OpenBSD lacks. None of the warnings shown should cause dhcpcd to crash.

Have you been able to get a crashdump with privsep disabled yet?

Does dhcpcd allow DHCP servers to send data from a port that is not 67? I know it is a very common misconception that DHCP servers MUST/SHOULD send traffic from port 67, but RFC 2131 makes no requirements or recommendations on what the source ports are. Similarly, RFC 8415 makes no requirements or recommendations on the source ports for DHCPv6 (i.e., servers can send data from a port that is not 547).

Stating this another way, RFC 2131 only says that servers MUST send traffic to port 68 on the client, the client MUST send traffic to port 67 on the server, RFC 8415 states servers MUST send traffic to port 546 on the client, and clients MUST send traffic to port 547 on the server.

OK. I won’t run that tcpdump then. I went ahead and ran the following:

router$ git clone https://github.com/NetworkConfiguration/dhcpcd && cd dhcpcd/ && ./configure && ./make
router$ su root
Password:
router# rcctl stop dhcpcd && ifconfig em0 down && ifconfig em0 -inet6 && ifconfig em0 -inet && rm -rf /var/run/dhcpcd && mv /usr/local/sbin/dhcpcd /home/zack/dhcp && mv src/dhcpcd /usr/local/sbin && chown root:daemon /usr/local/sbin/dhcpcd && rcctl start dhcpcd

I will report back.