diff options
Diffstat (limited to 'dhcpv6/ztpv6/parse_vendor_options.go')
-rw-r--r-- | dhcpv6/ztpv6/parse_vendor_options.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/dhcpv6/ztpv6/parse_vendor_options.go b/dhcpv6/ztpv6/parse_vendor_options.go index f1508fd..caa4e2f 100644 --- a/dhcpv6/ztpv6/parse_vendor_options.go +++ b/dhcpv6/ztpv6/parse_vendor_options.go @@ -33,8 +33,16 @@ func ParseVendorData(packet dhcpv6.DHCPv6) (*VendorData, error) { vData := []string{} if opt17 != nil { - vo := opt17.(*dhcpv6.OptVendorOpts).VendorOpts - for _, opt := range vo { + vendorOptsOption := opt17.(*dhcpv6.OptVendorOpts) + + // MLNX-OS has the relevant information spread over different sub-options + // of option 17 so the usual approach doesn't work + if vendorOptsOption.EnterpriseNumber == uint32(iana.EnterpriseIDMellanoxTechnologiesLTD) { + return getMellanoxVendorData(vendorOptsOption) + } + + // rest of vendors use a single sub-option so we stringify them and parse them below + for _, opt := range vendorOptsOption.VendorOpts { vData = append(vData, string(opt.(*dhcpv6.OptionGeneric).OptionData)) } } else { |