summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/ztpv6/parse_vendor_options.go
diff options
context:
space:
mode:
authorGerardo Poggio <gepoggio@fb.com>2023-06-12 09:42:15 +0100
committerGerardo Poggio <gepoggio@fb.com>2023-06-12 14:33:46 +0100
commitcb5419b1e557224267460a7ca12d0d32bd4882a9 (patch)
tree71fe52ce0bcea53d58e3c3d0b398c406a24e8c6c /dhcpv6/ztpv6/parse_vendor_options.go
parent49801966e6cb2cfc58a2bd98f69a9c182c1d4c18 (diff)
Add MLNX-OS ZTPv6 vendor data parsing
Signed-off-by: Gerardo Poggio <gepoggio@fb.com>
Diffstat (limited to 'dhcpv6/ztpv6/parse_vendor_options.go')
-rw-r--r--dhcpv6/ztpv6/parse_vendor_options.go12
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 {