Commit dd855a69 authored by Ray Bellis's avatar Ray Bellis

fix and improve unknown vendor handling

parent 16f0705c
......@@ -220,17 +220,13 @@ function vsa(vendor_id, sub_id)
throw new TypeError('dictionary VSA attribute sub-id not an integer');
let vendor = vendors.get(vendor_id);
if (!vendor) {
return new Vendor(vendor_id, `Vendor${vendor_id}`);
let dict = vsas.get(vendor_id);
if (dict && dict.has(sub_id)) {
return dict.get(sub_id);
} else {
let name = `${}-Unknown-${sub_id}`;
return new DictionaryEntry(vendor, name, sub_id, "octets");
let vnd = vendor(vendor_id);
let name = `${}-Unknown-${sub_id}`;
return new DictionaryEntry(vnd, name, sub_id, "octets");
......@@ -289,6 +285,11 @@ function vendor(id)
throw new TypeError(`Dictionary vendor value not an integer: ${id}`);
// create default Vendor object if not found
if (!vendors.has(id)) {
vendors.set(id, new Vendor(vendor_id, `Vendor${vendor_id}`));
return vendors.get(id);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment