Skip to content

Commit

Permalink
www: update and fixes to get_oui_full_vendor() to use local DB
Browse files Browse the repository at this point in the history
Asus querying the OUI database stored on their own server would fail when
accessing the webui over https (due to their database being
only reachable over http).  Keep a local copy on the router instead.

Remove the old OUI db implementation (which was JS-based), switching
to the new JSON db.

Allow querying MACs that do not belong to a networkmap client (so
querying site survey MACs is possible).
  • Loading branch information
RMerl committed Feb 7, 2021
1 parent e32cc37 commit a09b2ae
Show file tree
Hide file tree
Showing 2 changed files with 29,037 additions and 27,863 deletions.
35 changes: 7 additions & 28 deletions release/src/router/www/client_function.js
Expand Up @@ -71,28 +71,6 @@ var client_convRSSI = function(val) {
return result;
};

/* ouiDB lookup code */
var ouiClientListArray = new Array();
ouiClientListArray = Session.get("ouiDB");
if(ouiClientListArray == undefined) {
ouiClientListArray = [];
//Download OUI DB
setTimeout(function() {
var ouiBDjs = document.createElement("script");
ouiBDjs.type = "application/javascript";
ouiBDjs.src = "/js/ouiDB.js";
window.document.body.appendChild(ouiBDjs);
}, 1000);
}

function updateManufacturer(_ouiDBArray) {
ouiClientListArray = [];
ouiClientListArray = _ouiDBArray;
Session.set("ouiDB", _ouiDBArray);
}

/* End ouiDB lookup code */

var ipState = new Array();
ipState["Static"] = "<#BOP_ctype_title5#>";
ipState["DHCP"] = "<#BOP_ctype_title1#>";
Expand Down Expand Up @@ -3167,7 +3145,7 @@ function retOverLibStr(client){
if(client.isITunes)
overlibStr += "<p><#Device_service_iTune#></p>YES";
if(client.isWL > 0){
overlibStr += "<p><#Wireless_Radio#>:</p>" + wl_nband_title[client.isWL-1] + " (" + client.rssi + " dBm)";
overlibStr += "<p><#Wireless_Radio#>:</p>" + isWL_map[client.isWL]["text"].replace("G", " GHz") + " (" + client.rssi + " dBm)";
if(stainfo_support) {
overlibStr += "<p>Tx Rate:</p>" + ((client.curTx != "") ? client.curTx : "-");
overlibStr += "<p>Rx Rate:</p>" + ((client.curRx != "") ? client.curRx : "-");
Expand All @@ -3191,7 +3169,7 @@ function ajaxCallJsonp(target){
}

function oui_query_full_vendor(mac){
if(clientList[mac].vendor != "") {
if(clientList[mac] != undefined && clientList[mac].vendor != "") {
setTimeout(function(){
var overlibStrTmp = retOverLibStr(clientList[mac]);
overlibStrTmp += "<p><span>.....................................</span></p><p style='margin-top:5px'><#Manufacturer#> :</p>";
Expand All @@ -3200,10 +3178,12 @@ function oui_query_full_vendor(mac){
}, 1);
}
else {
if('<% nvram_get("x_Setting"); %>' == '1' && wanConnectStatus && clientList[mac].internetState) {
var queryStr = mac.replace(/\:/g, "").splice(6,6,"");
var overlibStrTmp = retOverLibStr(clientList[mac]);
$.getJSON("http://nw-dlcdnet.asus.com/plugin/js/ouiDB.json", function(data){
if (clientList[mac] != undefined)
var overlibStrTmp = retOverLibStr(clientList[mac]);
else
var overlibStrTmp = "<p><#MAC_Address#>:</p>" + mac.toUpperCase();
$.getJSON("/js/ouiDB.json", function(data){
if(data != "" && data[queryStr] != undefined){
if(overlib.isOut) return nd();
var vendor_name = data[queryStr].trim();
Expand All @@ -3212,7 +3192,6 @@ function oui_query_full_vendor(mac){
return overlib(overlibStrTmp);
}
});
}
}
}

Expand Down

0 comments on commit a09b2ae

Please sign in to comment.