mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-07 04:36:52 -10:00
loader.efi: Retain standalone network configuration
DHCP initmd discovery used net_configure() to open and configure SNP, then immediately closed the socket and released the protocol. Selecting net0 as currdev subsequently required another exclusive SNP attach, which may hang on some EDK II firmware. Keep the configured socket available for ordinary network consumers so NFS boot can reuse it. Add an explicit deconfiguration operation and invoke it only when an initmd URL requires handing SNP back to the firmware network stack. Signed-off-by: Krzysztof Galazka <[email protected]> Reviewed by: imp Assisted by: Github Copilot (GPT-5.6 Sol) Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D59999
This commit is contained in:
1 parent
c4640126f1
commit
48b29e9e54
3 files changed
+30
-6
No files matched your search
+27
-6
@@ -176,21 +176,42 @@ net_open(struct open_file *f, ...)
|
||||
int
|
||||
net_configure(struct devdesc *dev)
|
||||
{
|
||||
int error, sock;
|
||||
int error;
|
||||
|
||||
sock = netif_open(dev);
|
||||
if (sock < 0)
|
||||
if (netdev_sock >= 0)
|
||||
return (0);
|
||||
|
||||
netdev_sock = netif_open(dev);
|
||||
if (netdev_sock < 0)
|
||||
return (ENXIO);
|
||||
|
||||
error = 0;
|
||||
if (rootip.s_addr == 0)
|
||||
error = net_getparams(sock);
|
||||
error = net_getparams(netdev_sock);
|
||||
if (error == 0)
|
||||
net_setparams(sock);
|
||||
netif_close(sock);
|
||||
net_setparams(netdev_sock);
|
||||
if (error != 0) {
|
||||
netif_close(netdev_sock);
|
||||
netdev_sock = -1;
|
||||
return (error);
|
||||
}
|
||||
|
||||
netdev_name = strdup(dev->d_dev->dv_name);
|
||||
if (netdev_name == NULL) {
|
||||
netif_close(netdev_sock);
|
||||
netdev_sock = -1;
|
||||
return (ENOMEM);
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
void
|
||||
net_deconfigure(void)
|
||||
{
|
||||
|
||||
net_cleanup();
|
||||
}
|
||||
|
||||
static int
|
||||
net_close(struct open_file *f)
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
extern struct devsw netdev;
|
||||
|
||||
int net_configure(struct devdesc *);
|
||||
void net_deconfigure(void);
|
||||
uint32_t net_parse_rootpath(void);
|
||||
|
||||
#endif
|
||||
@@ -245,6 +245,8 @@ maybe_download_initmd(void)
|
||||
if (url == NULL || *url == '\0')
|
||||
return;
|
||||
|
||||
/* Release SNP so the firmware network stack can fetch the image. */
|
||||
net_deconfigure();
|
||||
printf("Downloading initmd from %s\n", url);
|
||||
error = download_md_image(url);
|
||||
if (error != 0 && error != ECANCELED)
|
||||
|
||||
Reference in new issue
Block a user