maybe_download_initmd() configured net0, the first interface the
firmware lists, which need not be the one the loader was booted from.
On a machine with several interfaces net0 may have no link or no DHCP
server, and the loader then waits for a DHCP reply there, printing
nothing, until the firmware's boot watchdog resets the machine. If
net0 does answer, later opens of the boot interface reuse the socket
configured on the wrong one.
Configure the interface the loader was loaded from instead: walk up
the device path of the loader's device handle to the first device the
loader knows, as find_currdev() does. The MAC address alone does not
identify the interface. A network boot program that drives the NIC
through the firmware's SNP, iPXE for one, holds that SNP exclusively
and loads the loader from beneath its own SNP, which has the same MAC
address. Say so when no device matches instead of skipping the
initmd silently.
Fetch an http:// initmd through the same interface. Such a URL names
no unit, so efihttp fetched it through net0.
Skip the initmd under HTTP boot, where the walk finds http0 on the
boot NIC. Opening that NIC's SNP disconnected the firmware HTTP stack
the loader boots through, so every HTTP boot failed, whether or not
DHCP offered an initmd: the loader could not read from http0 and
returned to the firmware.
Reported by: Patrick Sanderson
Fixes: d48e9bff8c02 ("loader.efi: fetch initmd specified by DHCP")
Sponsored by: Rubicon Communications, LLC ("Netgate")