diff options
Diffstat (limited to 'dhcpv4/dhcpv4.go')
-rw-r--r-- | dhcpv4/dhcpv4.go | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/dhcpv4/dhcpv4.go b/dhcpv4/dhcpv4.go index 98f0eae..0f2a5b4 100644 --- a/dhcpv4/dhcpv4.go +++ b/dhcpv4/dhcpv4.go @@ -5,7 +5,6 @@ import ( "encoding/binary" "errors" "fmt" - "log" "net" "strings" @@ -472,29 +471,6 @@ func (d *DHCPv4) Summary() string { return ret } -// ValidateOptions runs sanity checks on the DHCPv4 packet and prints a number -// of warnings if something is incorrect. -func (d *DHCPv4) ValidateOptions() { - // TODO find duplicate options - foundOptionEnd := false - for _, opt := range d.Options { - if foundOptionEnd { - if opt.Code() == OptionEnd { - log.Print("Warning: found duplicate End option") - } - if opt.Code() != OptionEnd && opt.Code() != OptionPad { - log.Printf("Warning: found option %v (%v) after End option", opt.Code(), opt.Code().String()) - } - } - if opt.Code() == OptionEnd { - foundOptionEnd = true - } - } - if !foundOptionEnd { - log.Print("Warning: no End option found") - } -} - // IsOptionRequested returns true if that option is within the requested // options of the DHCPv4 message. func (d *DHCPv4) IsOptionRequested(requested OptionCode) bool { @@ -553,9 +529,7 @@ func (d *DHCPv4) ToBytes() []byte { // The magic cookie. buf.WriteBytes(magicCookie[:]) - - for _, opt := range d.Options { - buf.WriteBytes(opt.ToBytes()) - } + d.Options.Marshal(buf) + buf.Write8(uint8(OptionEnd)) return buf.Data() } |