NetBSD Problem Report #56598

From  Sun Jan  2 11:10:44 2022
Return-Path: <>
Received: from ( [])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id A537F1A9239
	for <>; Sun,  2 Jan 2022 11:10:44 +0000 (UTC)
Message-Id: <>
Date: Sun,  2 Jan 2022 13:10:33 +0200 (EET)
From: (Andreas Gustafsson)
Reply-To: (Andreas Gustafsson)
Subject: dhcpcd now fails to detect carrier already present
X-Send-Pr-Version: 3.95

>Number:         56598
>Category:       bin
>Synopsis:       dhcpcd now fails to detect carrier already present
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 02 11:15:00 +0000 2022
>Originator:     Andreas Gustafsson
>Release:        NetBSD-current, source date >= 2020.

System: NetBSD
Architecture: x86_64
Machine: amd64

On a freshly installed and booted NetBSD-current system connected to
an Ethernet network with a DHCP server but not yet configured to use
it, you used to be able to run dhcpcd and then immediately use the
network, for example in a shell script like this:

  ftp http://www.example/...

This no longer works: dhcpcd will now report "no interfaces have a
carrier" even though there is an interface that does, and the ftp
command will fail because no interface has a routable address (yet).

When this happens, dhcpcd enters the background and will eventually
succeed in leasing an address, but by then it's too late for the
script which has already failed.

The problem can be worked around by either inserting a sleep between
the two commands or specifying the "-w" option to dhcpcd, but neither
should be necessary when the interface does in fact already have a
carrier.  Also, printing the message "no interfaces have a carrier"
when one does is confusing to say the least.

The problem appeared with this set of commits:

  2020. roy src/external/bsd/dhcpcd/dist/src/arp.c
  2020. roy src/external/bsd/dhcpcd/dist/src/defs.h
  2020. roy src/external/bsd/dhcpcd/dist/src/duid.c
  2020. roy src/external/bsd/dhcpcd/dist/src/if.c
  2020. roy src/external/bsd/dhcpcd/dist/src/dhcpcd.h
  2020. roy src/external/bsd/dhcpcd/dist/src/if-options.h
  2020. roy src/external/bsd/dhcpcd/dist/src/if.h
  2020. roy src/external/bsd/dhcpcd/dist/src/privsep-bpf.c
  2020. roy src/external/bsd/dhcpcd/dist/src/privsep-inet.c
  2020. roy src/external/bsd/dhcpcd/dist/src/privsep-inet.h
  2020. roy src/external/bsd/dhcpcd/dist/src/dhcp.c 1.41
  2020. roy src/external/bsd/dhcpcd/dist/src/dhcp6.c 1.24
  2020. roy src/external/bsd/dhcpcd/dist/src/dhcpcd.c 1.44
  2020. roy src/external/bsd/dhcpcd/dist/src/if-bsd.c 1.25
  2020. roy src/external/bsd/dhcpcd/dist/src/ipv6.c 1.15
  2020. roy src/external/bsd/dhcpcd/dist/src/ipv6nd.c 1.25
  2020. roy src/external/bsd/dhcpcd/dist/src/logerr.c 1.10
  2020. roy src/external/bsd/dhcpcd/dist/src/privsep.c 1.9
  2020. roy src/external/bsd/dhcpcd/dist/src/script.c 1.11


Install emulators/qemu and misc/py-anita from pkgsrc and run:

  $ anita interact
  login: root
  # dhcpcd; ifconfig -a

Note the "no interfaces have a carrier" message from dhcpcd and the
lack of an IP address on wm0.

Alternatively, install -current on real hardware using sysinst,
without specifying a network configuration for the installed system,
connect a physical Ethernet interface to a network, verify that the
link LED of the interface is lit, and run the same test:

  login: root
  # dhcpcd; ifconfig -a


NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD:,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.