Page MenuHomeFreeBSD

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

Authored by imp on Fri, Sep 4, 7:08 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Sep 24, 2:42 PM
Unknown Object (File)
Sat, Sep 19, 3:31 AM
Unknown Object (File)
Thu, Sep 17, 6:22 PM
Unknown Object (File)
Wed, Sep 16, 9:23 AM
Unknown Object (File)
Wed, Sep 16, 2:46 AM
Unknown Object (File)
Tue, Sep 15, 11:44 PM
Unknown Object (File)
Tue, Sep 15, 6:53 PM
Unknown Object (File)
Tue, Sep 15, 4:53 PM
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 Not Applicable
Unit
Tests Not Applicable