diff options
author | Pablo Mazzini <pmazzini@gmail.com> | 2018-04-06 21:46:03 +0100 |
---|---|---|
committer | insomniac <insomniacslk@users.noreply.github.com> | 2018-04-06 21:46:03 +0100 |
commit | 4f3c3e7e1776c130121a89414ec1034908aad967 (patch) | |
tree | 7e38f9ceb01146494abcb7b56c815edcad0def63 /dhcpv6/option_interfaceid.go | |
parent | f6a343e8c71a7dfe1f6a64d22cbd312db063d3f7 (diff) |
fix OptInterfaceId (#29)
Diffstat (limited to 'dhcpv6/option_interfaceid.go')
-rw-r--r-- | dhcpv6/option_interfaceid.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/dhcpv6/option_interfaceid.go b/dhcpv6/option_interfaceid.go index 4ba83f5..2634d9f 100644 --- a/dhcpv6/option_interfaceid.go +++ b/dhcpv6/option_interfaceid.go @@ -19,7 +19,7 @@ func (op *OptInterfaceId) Code() OptionCode { func (op *OptInterfaceId) ToBytes() []byte { buf := make([]byte, 4) binary.BigEndian.PutUint16(buf[0:2], uint16(OPTION_INTERFACE_ID)) - binary.BigEndian.PutUint16(buf[2:4], 2) + binary.BigEndian.PutUint16(buf[2:4], uint16(len(op.interfaceId))) buf = append(buf, op.interfaceId...) return buf } @@ -33,7 +33,7 @@ func (op *OptInterfaceId) SetInterfaceID(interfaceId []byte) { } func (op *OptInterfaceId) Length() int { - return 4 + len(op.interfaceId) + return len(op.interfaceId) } func (op *OptInterfaceId) String() string { @@ -44,6 +44,6 @@ func (op *OptInterfaceId) String() string { // The input data does not include option code and length bytes. func ParseOptInterfaceId(data []byte) (*OptInterfaceId, error) { opt := OptInterfaceId{} - opt.interfaceId = append([]byte(nil), data[4:]...) + opt.interfaceId = append([]byte(nil), data...) return &opt, nil } |