summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6
diff options
context:
space:
mode:
authorAndrea Barberio <insomniac@slackware.it>2018-04-18 09:37:10 +0100
committerAndrea Barberio <insomniac@slackware.it>2018-04-18 09:37:10 +0100
commitafb709fb09feceb466d462a2e8a926970f4a2243 (patch)
tree24ab18422f3bf87c57422a0dfa734363635f6241 /dhcpv6
parent940e2977fb5c0781c6eddf3c0b62baeec7de6011 (diff)
Added missing field to user class, and added to ParseOption
Diffstat (limited to 'dhcpv6')
-rw-r--r--dhcpv6/option_userclass.go2
-rw-r--r--dhcpv6/options.go2
2 files changed, 4 insertions, 0 deletions
diff --git a/dhcpv6/option_userclass.go b/dhcpv6/option_userclass.go
index 6f62b23..98da207 100644
--- a/dhcpv6/option_userclass.go
+++ b/dhcpv6/option_userclass.go
@@ -23,6 +23,8 @@ func (op *OptUserClass) ToBytes() []byte {
buf := make([]byte, 6)
binary.BigEndian.PutUint16(buf[0:2], uint16(OPTION_USER_CLASS))
binary.BigEndian.PutUint16(buf[2:4], uint16(op.Length()))
+ // user-class-data has an internal data length field too..
+ binary.BigEndian.PutUint16(buf[4:6], uint16(len(op.userClass)))
buf = append(buf, op.userClass...)
return buf
}
diff --git a/dhcpv6/options.go b/dhcpv6/options.go
index ad52998..6962e16 100644
--- a/dhcpv6/options.go
+++ b/dhcpv6/options.go
@@ -102,6 +102,8 @@ func ParseOption(dataStart []byte) (Option, error) {
opt, err = ParseOptNetworkInterfaceId(optData)
case OPT_BOOTFILE_URL:
opt, err = ParseOptBootFileURL(optData)
+ case OPTION_USER_CLASS:
+ opt, err = ParseOptUserClass(optData)
default:
opt = &OptionGeneric{OptionCode: code, OptionData: optData}
}