Also check foor bzImage support in the ProxyDHCP stage. #51

Virtualbox inexplicably ships with an iPXE image that knows
how to speak HTTP, but cannot handle bzImage files. This is a
quick and dirty fix for that specific issue, while I work on
the more permanent fix of always chainloading into a known
good iPXE.
This commit is contained in:
David Anderson 2017-12-24 19:28:41 -08:00
parent c813cd6b8e
commit 81fbed5acf

View File

@ -121,6 +121,7 @@ func (s *Server) validateDHCP(pkt *dhcp4.Packet) (mach Machine, isIpxe bool, fwt
} }
// iPXE options // iPXE options
supportsHTTP, supportsBzImage := false, false
if len(pkt.Options[175]) > 0 { if len(pkt.Options[175]) > 0 {
bs := pkt.Options[175] bs := pkt.Options[175]
for len(bs) > 0 { for len(bs) > 0 {
@ -129,14 +130,18 @@ func (s *Server) validateDHCP(pkt *dhcp4.Packet) (mach Machine, isIpxe bool, fwt
} }
switch bs[0] { switch bs[0] {
case 19: case 19:
// This iPXE build supports HTTP, so is appropriate // This iPXE build supports HTTP.
// for going straight into the OS kernel, no need to supportsHTTP = true
// chainload our own. case 24:
isIpxe = true // This iPXE build supports bzImage.
supportsBzImage = true
} }
bs = bs[2+int(bs[1]):] bs = bs[2+int(bs[1]):]
} }
} }
// This firmware is an appropriate iPXE if it can speak HTTP and
// bzImage. If not, we'll chainload our own internal iPXE.
isIpxe = supportsHTTP && supportsBzImage
mach.MAC = pkt.HardwareAddr mach.MAC = pkt.HardwareAddr
mach.Arch = fwToArch[fwtype] mach.Arch = fwToArch[fwtype]