From d0f6cb0348deae0a64fbeed13a5e9b0000ad9cf0 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 8 Aug 2016 20:45:57 -0700 Subject: [PATCH] dhcp4: Fix handling of the boot filename. --- dhcp4/packet.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dhcp4/packet.go b/dhcp4/packet.go index bf302af..bb0ccc6 100644 --- a/dhcp4/packet.go +++ b/dhcp4/packet.go @@ -148,7 +148,7 @@ func (p *Packet) Marshal() ([]byte, error) { optsInFile, optsInSname := false, false v, err := p.Options.Byte(OptOverload) if err == nil { - optsInFile, optsInFile = v&1 != 0, v&2 != 0 + optsInFile, optsInSname = v&1 != 0, v&2 != 0 } if optsInFile && p.BootFilename != "" { 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 } } else { - ret.WriteString(p.BootServerName) - for i := len(p.BootServerName); i < 128; i++ { + ret.WriteString(p.BootFilename) + for i := len(p.BootFilename); i < 128; i++ { ret.WriteByte(0) } }