NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/56598: dhcpcd now fails to detect carrier already present

>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


Home | Main Index | Thread Index | Old Index