diff options
Diffstat (limited to 'dhcpv6/options.go')
-rw-r--r-- | dhcpv6/options.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/dhcpv6/options.go b/dhcpv6/options.go index bf523dd..f8445bb 100644 --- a/dhcpv6/options.go +++ b/dhcpv6/options.go @@ -208,12 +208,10 @@ func (o *Options) FromBytesWithParser(data []byte, parser OptionParser) error { // Consume, but do not Copy. Each parser will make a copy of // pertinent data. optData := buf.Consume(length) - if err := buf.Error(); err != nil { - return fmt.Errorf("Unable to read payload of option code %d with option length %d: %v", code, length, err) - } + opt, err := parser(code, optData) if err != nil { - return fmt.Errorf("Unable to parse option code %d with option length %d : %v [data %x]", code, length, err, optData) + return err } *o = append(*o, opt) } |