summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/option_interfaceid.go
diff options
context:
space:
mode:
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
}