IPv6 iPXE support

* Parse address and port with netip w/ tests
* Add Authority to provisioning templates based on remote IP family
  (name based on RFC 3986)
* Add IPv6 support to the default iPXE (tested)
* Update `grub.cfg.ww` to use Authority (untested)

Co-authored-by: Dacian Reece-Stremtan <dacianstremtan@gmail.com>
Co-authored-by: Timothy Middelkoop <tmiddelkoop@internet2.edu>
Signed-off-by: Timothy Middelkoop <tmiddelkoop@internet2.edu>
This commit is contained in:
Dacian Reece-Stremtan
2025-08-01 13:43:57 -05:00
committed by Jonathon Anderson
parent beb77278c6
commit efd63aecd4
8 changed files with 117 additions and 12 deletions

View File

@@ -2,7 +2,7 @@ package warewulfd
import (
"net/http"
"strconv"
"net/netip"
"strings"
"github.com/pkg/errors"
@@ -44,9 +44,12 @@ func parseReq(req *http.Request) (parserInfo, error) {
ret.efifile = path_parts[2]
}
ret.hwaddr = hwaddr
ret.ipaddr = strings.Split(req.RemoteAddr, ":")[0]
ret.remoteport, _ = strconv.Atoi(strings.Split(req.RemoteAddr, ":")[1])
remoteAddrPort, err := netip.ParseAddrPort(req.RemoteAddr)
if err != nil {
return ret, errors.New("could not parse remote address")
}
ret.ipaddr = remoteAddrPort.Addr().String()
ret.remoteport = int(remoteAddrPort.Port())
if len(req.URL.Query()["assetkey"]) > 0 {
ret.assetkey = req.URL.Query()["assetkey"][0]
}