summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/option_interfaceid.go
diff options
context:
space:
mode:
authorPablo Mazzini <pmazzini@gmail.com>2018-04-06 21:46:03 +0100
committerinsomniac <insomniacslk@users.noreply.github.com>2018-04-06 21:46:03 +0100
commit4f3c3e7e1776c130121a89414ec1034908aad967 (patch)
tree7e38f9ceb01146494abcb7b56c815edcad0def63 /dhcpv6/option_interfaceid.go
parentf6a343e8c71a7dfe1f6a64d22cbd312db063d3f7 (diff)
fix OptInterfaceId (#29)
Diffstat (limited to 'dhcpv6/option_interfaceid.go')
-rw-r--r--dhcpv6/option_interfaceid.go6
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
}