diff options
Diffstat (limited to 'dhcpv6/option_iaaddress.go')
-rw-r--r-- | dhcpv6/option_iaaddress.go | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/dhcpv6/option_iaaddress.go b/dhcpv6/option_iaaddress.go index 072ba65..bc56254 100644 --- a/dhcpv6/option_iaaddress.go +++ b/dhcpv6/option_iaaddress.go @@ -69,22 +69,20 @@ func (op *OptIAAddress) LongString(indent int) string { op.Code(), op.IPv6Addr, op.PreferredLifetime, op.ValidLifetime, op.Options.LongString(indent)) } -// ParseOptIAAddress builds an OptIAAddress structure from a sequence -// of bytes. The input data does not include option code and length -// bytes. -func ParseOptIAAddress(data []byte) (*OptIAAddress, error) { - var opt OptIAAddress +// FromBytes builds an OptIAAddress structure from a sequence of bytes. The +// input data does not include option code and length bytes. +func (op *OptIAAddress) FromBytes(data []byte) error { buf := uio.NewBigEndianBuffer(data) - opt.IPv6Addr = net.IP(buf.CopyN(net.IPv6len)) + op.IPv6Addr = net.IP(buf.CopyN(net.IPv6len)) var t1, t2 Duration t1.Unmarshal(buf) t2.Unmarshal(buf) - opt.PreferredLifetime = t1.Duration - opt.ValidLifetime = t2.Duration + op.PreferredLifetime = t1.Duration + op.ValidLifetime = t2.Duration - if err := opt.Options.FromBytes(buf.ReadAll()); err != nil { - return nil, err + if err := op.Options.FromBytes(buf.ReadAll()); err != nil { + return err } - return &opt, buf.FinError() + return buf.FinError() } |