global-functions: $GetMacVendor: improve error handling

The API returns 404 on unknown mac vendor... We can just catch error,
but not decide whether it is connection error or unknown vendor.

Try without mac address - on error we have a connection issue.
This commit is contained in:
Christian Hesse 2021-02-24 22:05:43 +01:00
parent eaeda375e2
commit 274af98886

View file

@ -380,6 +380,13 @@
("https://api.macvendors.com/" . [ :pick $Mac 0 8 ]) output=user as-value ]->"data");
:return $Vendor;
} on-error={
:do {
/ tool fetch check-certificate=yes-without-crl ("https://api.macvendors.com/") \
output=none as-value;
$LogPrintExit2 debug $0 ("The mac vendor is not known in database.") false;
} on-error={
$LogPrintExit2 warning $0 ("Failed getting mac vendor.") false;
}
:return "unknown vendor";
}
}