Page MenuHomeFreeBSD

stand/efihttp: Support arbitrary http[N]://host[:port]/path devspecs
Needs ReviewPublic

Authored by imp on Fri, Sep 4, 7:08 PM.
Tags
None
Referenced Files
F170578085: D59423.id.diff
Sat, Sep 5, 12:01 PM
F170578026: D59423.id.diff
Sat, Sep 5, 12:01 PM
F170563724: D59423.id.diff
Sat, Sep 5, 10:35 AM
F170556072: D59423.diff
Sat, Sep 5, 9:43 AM
F170524341: D59423.id185867.diff
Sat, Sep 5, 5:54 AM
Subscribers

Details

Summary

Until now, the "http" device only worked when firmware itself booted
loader.efi via EFI HTTP Boot: efihttp_dev_init() required a URI node on
the loader's own boot device path, and every fetch went to that same
server. Add a second form, using the parse_uri() helper from libsa/dev.c,
that works anywhere: http[N]://host[:port]/path (N is a network interface
unit, defaulting to 0). This lets a devspec like this be used as rootdev,
in loader.conf, or interactively, independent of how loader.efi itself
was booted.

Network configuration is shared, loader-wide state (the myip/netmask/
gateip/nameip globals from net.h): if something has already configured
them (e.g. tftp/nfs via net_open()), the http device just reuses those
values, applying them to EFI_IP4_CONFIG2_PROTOCOL as a static address. If
nothing has, it drives IP4Config2's own DHCP directly instead of calling
netdev's net_open(): net_open() opens the NIC's SNP
EFI_OPEN_PROTOCOL_EXCLUSIVE, which would disconnect the Mnp/Ip4/.../
HttpDxe driver chain this code depends on. That chain is also commonly
disconnected already by whatever chained us here (e.g. iPXE excludes and
exclusively opens SNP for its own raw I/O), so reconnect it explicitly
with ConnectController() before giving up.

The legacy EFI HTTP Boot path is untouched.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 76554
Build 73437: arc lint + arc unit