]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Automatically open network device matching loaded image device path
authorMichael Brown <mcb30@ipxe.org>
Mon, 2 Mar 2026 00:08:18 +0000 (00:08 +0000)
committerMichael Brown <mcb30@ipxe.org>
Mon, 2 Mar 2026 00:08:18 +0000 (00:08 +0000)
It is unintuitive to have to include an "ifopen" at the start of an
autoexec.ipxe script.  Commit efe8126 ("[cachedhcp] Automatically open
network device matching cached DHCPACK") causes the chainloaded device
to be opened automatically, using the cached DHCPACK to identify the
chainloaded device.

In the case of a UEFI HTTP(S) boot, the firmware does not provide
access to the DHCPACK and we are forced to instead extract the very
limited amount of information encoded into the loaded image's device
path.

Mark the device matching the loaded image's device path to be opened
automatically, so that the chainloaded device will be opened in the
same way for both TFTP and HTTP(S) boots.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/interface/efi/efi_path.c

index 38f6f218433ae231cd893518ea3b6805433e3569..7d7091382c940ff485e58c36004b961a8f430ec8 100644 (file)
@@ -1120,6 +1120,9 @@ static int efi_path_net_probe ( struct net_device *netdev, void *priv ) {
                return 0;
        }
 
+       /* Mark network device to be opened automatically */
+       netdev->state |= NETDEV_AUTO_OPEN;
+
        /* Never override a real DHCP settings block */
        if ( find_child_settings ( netdev_settings ( netdev ),
                                   DHCP_SETTINGS_NAME ) ) {