summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/option_vendor_opts.go
diff options
context:
space:
mode:
Diffstat (limited to 'dhcpv6/option_vendor_opts.go')
-rw-r--r--dhcpv6/option_vendor_opts.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/dhcpv6/option_vendor_opts.go b/dhcpv6/option_vendor_opts.go
index 11811c0..8412fd9 100644
--- a/dhcpv6/option_vendor_opts.go
+++ b/dhcpv6/option_vendor_opts.go
@@ -38,16 +38,15 @@ func (op *OptVendorOpts) LongString(indent int) string {
return fmt.Sprintf("%s: EnterpriseNumber=%v VendorOptions=%s", op.Code(), op.EnterpriseNumber, op.VendorOpts.LongString(indent))
}
-// ParseOptVendorOpts builds an OptVendorOpts structure from a sequence of bytes.
-// The input data does not include option code and length bytes.
-func ParseOptVendorOpts(data []byte) (*OptVendorOpts, error) {
- var opt OptVendorOpts
+// FromBytes builds an OptVendorOpts structure from a sequence of bytes. The
+// input data does not include option code and length bytes.
+func (op *OptVendorOpts) FromBytes(data []byte) error {
buf := uio.NewBigEndianBuffer(data)
- opt.EnterpriseNumber = buf.Read32()
- if err := opt.VendorOpts.FromBytesWithParser(buf.ReadAll(), vendParseOption); err != nil {
- return nil, err
+ op.EnterpriseNumber = buf.Read32()
+ if err := op.VendorOpts.FromBytesWithParser(buf.ReadAll(), vendParseOption); err != nil {
+ return err
}
- return &opt, buf.FinError()
+ return buf.FinError()
}
// vendParseOption builds a GenericOption from a slice of bytes