diff options
Diffstat (limited to 'dhcpv6')
-rw-r--r-- | dhcpv6/option_userclass.go | 2 | ||||
-rw-r--r-- | dhcpv6/options.go | 2 |
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} } |