From a522f9c79da61c06205e30cc84b72fc86faae9a4 Mon Sep 17 00:00:00 2001 From: Utku Ozdemir Date: Wed, 5 Feb 2025 14:20:29 +0100 Subject: [PATCH] fix: serve iPXE binaries over http There are firmwares that require iPXE artifacts to be served over HTTP. We were retuning a DHCP response to them with a URL, but the files were not served on that URL. Serve these files so the iPXE process can succeed on those machines. Signed-off-by: Utku Ozdemir --- internal/provider/dhcp/proxy.go | 4 ++-- internal/provider/server/server.go | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/provider/dhcp/proxy.go b/internal/provider/dhcp/proxy.go index 7320813..59b8c82 100644 --- a/internal/provider/dhcp/proxy.go +++ b/internal/provider/dhcp/proxy.go @@ -253,10 +253,10 @@ func offerDHCP(req *dhcpv4.DHCPv4, apiAdvertiseAddress string, apiPort int, fwty resp.UpdateOption(dhcpv4.OptBootFileName("snp-arm64.efi")) case FirmwareX86HTTP: // This is completely standard HTTP-boot: just load a file from HTTP. - resp.UpdateOption(dhcpv4.OptBootFileName(fmt.Sprintf("http://%s/tftp/snp.efi", ipPort))) + resp.UpdateOption(dhcpv4.OptBootFileName(fmt.Sprintf("http://%s/tftp/amd64/snp.efi", ipPort))) case FirmwareARMHTTP: // This is completely standard HTTP-boot: just load a file from HTTP. - resp.UpdateOption(dhcpv4.OptBootFileName(fmt.Sprintf("http://%s/tftp/snp-arm64.efi", ipPort))) + resp.UpdateOption(dhcpv4.OptBootFileName(fmt.Sprintf("http://%s/tftp/arm64/snp.efi", ipPort))) case FirmwareUnsupported: fallthrough default: diff --git a/internal/provider/server/server.go b/internal/provider/server/server.go index 736c718..e697e5d 100644 --- a/internal/provider/server/server.go +++ b/internal/provider/server/server.go @@ -27,6 +27,7 @@ import ( "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/status" + "github.com/siderolabs/omni-infra-provider-bare-metal/internal/provider/constants" providertls "github.com/siderolabs/omni-infra-provider-bare-metal/internal/provider/tls" ) @@ -147,6 +148,7 @@ func newMultiHandler(configHandler, ipxeHandler, grpcHandler http.Handler, serve mux.Handle("/config", configHandler) mux.Handle("/ipxe", ipxeHandler) + mux.Handle("/tftp/", http.StripPrefix("/tftp/", http.FileServer(http.Dir(constants.IPXEPath+"/")))) if serveAssetsDir { mux.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir("/assets/"))))