diff options
author | Pablo Mazzini <pmazzini@gmail.com> | 2018-11-09 13:20:15 +0000 |
---|---|---|
committer | Pablo Mazzini <pmazzini@gmail.com> | 2018-11-09 13:20:15 +0000 |
commit | 97ac7895b423edbaa1944062542ea9f76faa7f06 (patch) | |
tree | b338fd98ede411c6d4a4230d12dfb6945e897fea /dhcpv4/ztp/ztp.go | |
parent | 57e9968838278e198d2f7cb5964eac098a4c32bd (diff) |
return nil vendor data
Diffstat (limited to 'dhcpv4/ztp/ztp.go')
-rw-r--r-- | dhcpv4/ztp/ztp.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/dhcpv4/ztp/ztp.go b/dhcpv4/ztp/ztp.go index 3d19bc3..ecd6469 100644 --- a/dhcpv4/ztp/ztp.go +++ b/dhcpv4/ztp/ztp.go @@ -42,7 +42,7 @@ func parseV4VendorClass(packet *dhcpv4.DHCPv4) (*VendorData, error) { case strings.HasPrefix(vc, "Arista;"): p := strings.Split(vc, ";") if len(p) < 4 { - return vd, errVendorOptionMalformed + return nil, errVendorOptionMalformed } vd.VendorName = p[0] @@ -54,7 +54,7 @@ func parseV4VendorClass(packet *dhcpv4.DHCPv4) (*VendorData, error) { case strings.HasPrefix(vc, "ZPESystems:"): p := strings.Split(vc, ":") if len(p) < 3 { - return vd, errVendorOptionMalformed + return nil, errVendorOptionMalformed } vd.VendorName = p[0] @@ -77,6 +77,8 @@ func parseV4VendorClass(packet *dhcpv4.DHCPv4) (*VendorData, error) { // No separator was found. Attempt serial number from the hostname if opt := packet.GetOneOption(dhcpv4.OptionHostName); opt != nil { vd.Serial = opt.(*dhcpv4.OptHostName).HostName + } else { + return nil, errVendorOptionMalformed } } else { vd.Serial = vc[sepIdx+1:] |