mirror of
https://github.com/danderson/netboot.git
synced 2025-10-16 01:51:19 +02:00
dhcp4: Fix handling of the boot filename.
This commit is contained in:
parent
551e4aee91
commit
d0f6cb0348
@ -148,7 +148,7 @@ func (p *Packet) Marshal() ([]byte, error) {
|
|||||||
optsInFile, optsInSname := false, false
|
optsInFile, optsInSname := false, false
|
||||||
v, err := p.Options.Byte(OptOverload)
|
v, err := p.Options.Byte(OptOverload)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
optsInFile, optsInFile = v&1 != 0, v&2 != 0
|
optsInFile, optsInSname = v&1 != 0, v&2 != 0
|
||||||
}
|
}
|
||||||
if optsInFile && p.BootFilename != "" {
|
if optsInFile && p.BootFilename != "" {
|
||||||
return nil, errors.New("DHCP option 52 says to use the 'file' field for options, but BootFilename is not empty")
|
return nil, errors.New("DHCP option 52 says to use the 'file' field for options, but BootFilename is not empty")
|
||||||
@ -217,8 +217,8 @@ func (p *Packet) Marshal() ([]byte, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ret.WriteString(p.BootServerName)
|
ret.WriteString(p.BootFilename)
|
||||||
for i := len(p.BootServerName); i < 128; i++ {
|
for i := len(p.BootFilename); i < 128; i++ {
|
||||||
ret.WriteByte(0)
|
ret.WriteByte(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user