summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-firewall/htdocs/luci-static/resources
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-app-firewall/htdocs/luci-static/resources')
-rw-r--r--applications/luci-app-firewall/htdocs/luci-static/resources/tools/firewall.js31
1 files changed, 23 insertions, 8 deletions
diff --git a/applications/luci-app-firewall/htdocs/luci-static/resources/tools/firewall.js b/applications/luci-app-firewall/htdocs/luci-static/resources/tools/firewall.js
index ebdd345c98..1f2eff3747 100644
--- a/applications/luci-app-firewall/htdocs/luci-static/resources/tools/firewall.js
+++ b/applications/luci-app-firewall/htdocs/luci-static/resources/tools/firewall.js
@@ -392,12 +392,25 @@ return baseclass.extend({
},
transformHostHints: function(family, hosts) {
- var choice_values = [], choice_labels = {};
+ var choice_values = [],
+ choice_labels = {},
+ ip6addrs = {},
+ ipaddrs = {};
+
+ for (var mac in hosts) {
+ L.toArray(hosts[mac].ipaddrs).forEach(function(ip) {
+ ipaddrs[ip] = mac;
+ });
+
+ L.toArray(hosts[mac].ip6addrs).forEach(function(ip) {
+ ip6addrs[ip] = mac;
+ });
+ }
if (!family || family == 'ipv4') {
- L.sortedKeys(hosts, 'ipv4', 'addr').forEach(function(mac) {
- var val = hosts[mac].ipv4,
- txt = hosts[mac].name || mac;
+ L.sortedKeys(ipaddrs, null, 'addr').forEach(function(ip) {
+ var val = ip,
+ txt = hosts[ipaddrs[ip]].name || ipaddrs[ip];
choice_values.push(val);
choice_labels[val] = E([], [ val, ' (', E('strong', {}, [txt]), ')' ]);
@@ -405,9 +418,9 @@ return baseclass.extend({
}
if (!family || family == 'ipv6') {
- L.sortedKeys(hosts, 'ipv6', 'addr').forEach(function(mac) {
- var val = hosts[mac].ipv6,
- txt = hosts[mac].name || mac;
+ L.sortedKeys(ip6addrs, null, 'addr').forEach(function(ip) {
+ var val = ip,
+ txt = hosts[ip6addrs[ip]].name || ip6addrs[ip];
choice_values.push(val);
choice_labels[val] = E([], [ val, ' (', E('strong', {}, [txt]), ')' ]);
@@ -497,7 +510,9 @@ return baseclass.extend({
L.sortedKeys(hosts).forEach(function(mac) {
o.value(mac, E([], [ mac, ' (', E('strong', {}, [
- hosts[mac].name || hosts[mac].ipv4 || hosts[mac].ipv6 || '?'
+ hosts[mac].name ||
+ (hosts[mac].ipaddrs && hosts[mac].ipaddrs.length && hosts[mac].ipaddrs[0]) ||
+ (hosts[mac].ip6addrs && hosts[mac].ip6addrs.length && hosts[mac].ip6addrs[0]) || '?'
]), ')' ]));
});