summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2020-11-15 22:28:00 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2020-11-15 22:28:00 +0100
commit036bc77e8dc9967f766ea5a852690283d96eb9ab (patch)
tree999107a7ef776fe63508242766617f1254539650
parent4799fcead6336fa158b79317f7c7f92180d98f9d (diff)
parentb9db5aa4670ecc457af481ca41cb591f165b6852 (diff)
Merge branches 'routes-proto' and 'link-local-neigh'build
-rw-r--r--modules/luci-mod-status/htdocs/luci-static/resources/view/status/routes.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/routes.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/routes.js
index fa2315fb55..243a9bccf8 100644
--- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/routes.js
+++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/routes.js
@@ -26,6 +26,20 @@ function applyMask(addr, mask, v6) {
v6 ? '%x:%x:%x:%x:%x:%x:%x:%x' : '%d.%d.%d.%d', words);
}
+function eui48ToIPv6LinkLocal(eui48) {
+ var eui48_arr = eui48.toLowerCase().split(":");
+
+ if ( eui48.length != (3*6-1) || eui48_arr.length != 6 )
+ return null;
+
+ eui48_arr.splice(3, 0, "ff", "fe")
+ eui48_arr[0] = (parseInt(eui48_arr[0], 16)^2).toString(16)
+
+ var eui64_arr = [eui48_arr[0]+eui48_arr[1], eui48_arr[2]+eui48_arr[3], eui48_arr[4]+eui48_arr[5], eui48_arr[6]+eui48_arr[7]];
+ var eui64 = eui64_arr.map(x => x.replace(/^0+/, '')).join(":");
+ return "fe80::" + eui64;
+}
+
return view.extend({
load: function() {
return Promise.all([
@@ -89,7 +103,7 @@ return view.extend({
flags = m ? m[2].trim().split(/\s+/) : [],
state = (m ? m[3] : null) || 'FAILED';
- if (!addr || state == 'FAILED' || addr.match(/^fe[89a-f][0-9a-f]:/))
+ if (!addr || state == 'FAILED')
continue;
for (var j = 0; j < flags.length; j += 2)
@@ -98,6 +112,9 @@ return view.extend({
if (!flags.lladdr)
continue;
+ if (v6 && addr.match(/^fe[89a-f][0-9a-f]:/) && eui48ToIPv6LinkLocal(flags.lladdr) == addr)
+ continue;
+
var net = this.getNetworkByDevice(networks, flags.dev, addr, v6 ? 128 : 32, v6);
res.push([