10
10
11
11
var Hosts , Remotehosts , Remoteinfo , Localinfo , Clients ;
12
12
13
+ var dns_cache = [ ] ;
14
+
15
+ function SplitWlan ( wlan ) {
16
+ var wlansplit = [ ] ;
17
+ if ( typeof wlan . split ( '#' ) [ 1 ] !== 'undefined' ) {
18
+ wlansplit = wlan . split ( '#' ) ;
19
+ if ( typeof dns_cache [ wlansplit [ 0 ] ] !== 'undefined' ) {
20
+ wlansplit [ 0 ] = dns_cache [ wlansplit [ 0 ] ] ;
21
+ }
22
+ } else {
23
+ wlansplit [ 0 ] = _ ( 'This AP' ) ;
24
+ wlansplit [ 1 ] = wlan ;
25
+ }
26
+ return wlansplit ;
27
+ }
28
+
13
29
14
30
function collectHearingClient ( client_table_entries , mac ) {
15
31
if ( typeof Clients [ mac ] !== 'undefined' ) {
@@ -24,8 +40,10 @@ function collectHearingClient(client_table_entries, mac) {
24
40
SSID = Remoteinfo [ wlanc ] [ 'ssid' ] ;
25
41
freq = Remoteinfo [ wlanc ] [ 'freq' ] ;
26
42
}
43
+ var wlansplit = SplitWlan ( wlanc ) ;
27
44
client_table_entries . push ( [
28
- '<nobr>' + wlanc + '</nobr>' ,
45
+ '<nobr>' + '%h' . format ( wlansplit [ 0 ] ) + '</nobr>' ,
46
+ '<nobr>' + '%h' . format ( wlansplit [ 1 ] ) + '</nobr>' ,
29
47
SSID ,
30
48
freq ,
31
49
Clients [ mac ] [ wlanc ] [ 'connected' ] === true ? 'Yes' : 'No' ,
@@ -57,7 +75,8 @@ var HearingMap = form.DummyValue.extend({
57
75
) ;
58
76
var client_table = E ( 'table' , { 'class' : 'table cbi-section-table' , 'id' :'client_table' + macn } , [
59
77
E ( 'tr' , { 'class' : 'tr table-titles' } , [
60
- E ( 'th' , { 'class' : 'th' , 'style' : 'width:35%' } , _ ( 'IP & Interface' , 'Combination of IP and interface name in usteer overview' ) ) ,
78
+ E ( 'th' , { 'class' : 'th' } , _ ( 'AP' , 'Name or IP address of access point' ) ) ,
79
+ E ( 'th' , { 'class' : 'th' } , _ ( 'Interface name' , 'interface name in usteer overview' ) ) ,
61
80
E ( 'th' , { 'class' : 'th' , 'style' : 'width:25%' } , _ ( 'SSID' ) ) ,
62
81
E ( 'th' , { 'class' : 'th' , 'style' : 'width:15%' } , _ ( 'Frequency' , 'BSS operating frequency in usteer overview' ) ) ,
63
82
E ( 'th' , { 'class' : 'th' , 'style' : 'width:15%' } , _ ( 'Connected' , 'Connection state in usteer overview' ) ) ,
@@ -74,10 +93,14 @@ var HearingMap = form.DummyValue.extend({
74
93
} ) ;
75
94
76
95
96
+
97
+
77
98
function collectWlanAPInfoEntries ( connectioninfo_table_entries , wlanAPInfos ) {
78
99
for ( var wlan in wlanAPInfos ) {
100
+ var wlansplit = SplitWlan ( wlan ) ;
79
101
connectioninfo_table_entries . push ( [
80
- '<nobr>' + wlan + '</nobr>' ,
102
+ '<nobr>' + '%h' . format ( wlansplit [ 0 ] ) + '</nobr>' ,
103
+ '<nobr>' + '%h' . format ( wlansplit [ 1 ] ) + '</nobr>' ,
81
104
wlanAPInfos [ wlan ] [ 'bssid' ] ,
82
105
wlanAPInfos [ wlan ] [ 'ssid' ] ,
83
106
wlanAPInfos [ wlan ] [ 'freq' ] ,
@@ -133,8 +156,10 @@ function collectWlanAPInfos(compactconnectioninfo_table_entries, wlanAPInfos) {
133
156
) ;
134
157
}
135
158
}
159
+ var wlansplit = SplitWlan ( wlan ) ;
136
160
compactconnectioninfo_table_entries . push ( [
137
- '<nobr>' + wlan + '</nobr>' ,
161
+ '<nobr>' + '%h' . format ( wlansplit [ 0 ] ) + '</nobr>' ,
162
+ '<nobr>' + '%h' . format ( wlansplit [ 1 ] ) + '</nobr>' ,
138
163
wlanAPInfos [ wlan ] [ 'ssid' ] ,
139
164
wlanAPInfos [ wlan ] [ 'freq' ] ,
140
165
wlanAPInfos [ wlan ] [ 'load' ] ,
@@ -144,22 +169,54 @@ function collectWlanAPInfos(compactconnectioninfo_table_entries, wlanAPInfos) {
144
169
}
145
170
} ;
146
171
172
+ var callNetworkRrdnsLookup = rpc . declare ( {
173
+ object : 'network.rrdns' ,
174
+ method : 'lookup' ,
175
+ params : [ 'addrs' , 'timeout' , 'limit' ] ,
176
+ expect : { '' : { } }
177
+ } ) ;
178
+
179
+
147
180
function collectRemoteHosts ( remotehosttableentries , Remotehosts ) {
181
+ const getUndefinedDnsCacheIPs = ( Remotehosts , dns_cache ) =>
182
+ Object . keys ( Remotehosts ) . filter ( IPaddr => ! dns_cache . hasOwnProperty ( IPaddr ) ) ;
183
+
184
+ var ipAddrs = getUndefinedDnsCacheIPs ( Remotehosts , dns_cache ) ;
185
+
186
+ L . resolveDefault ( callNetworkRrdnsLookup ( ipAddrs , 1000 , 1000 ) , { } ) . then ( function ( replies ) {
187
+ for ( var address of ipAddrs ) {
188
+ if ( ! address )
189
+ continue ;
190
+ if ( replies [ address ] ) {
191
+ dns_cache [ address ] = replies [ address ] ;
192
+ continue ;
193
+ } else {
194
+ dns_cache [ address ] = Hosts [
195
+ Object . keys ( Hosts ) . find ( mac =>
196
+ ( ( typeof Hosts [ mac ] [ 'name' ] !== 'undefined' ) &&
197
+ ( ( Object . keys ( Hosts [ mac ] [ 'ip6addrs' ] ) . find ( IPaddr2 => ( address === Hosts [ mac ] [ 'ip6addrs' ] [ IPaddr2 ] ) ) ) ||
198
+ ( Object . keys ( Hosts [ mac ] [ 'ipaddrs' ] ) . find ( IPaddr2 => ( address === Hosts [ mac ] [ 'ipaddrs' ] [ IPaddr2 ] ) ) ) ) )
199
+ )
200
+ ] [ 'name' ] ;
201
+ }
202
+ }
203
+ } ) ;
204
+
148
205
for ( var IPaddr in Remotehosts ) {
149
- remotehosttableentries . push ( [ IPaddr , Remotehosts [ IPaddr ] [ 'id' ] ] ) ;
150
- }
206
+ remotehosttableentries . push ( [ IPaddr , '%h' . format ( dns_cache [ IPaddr ] ) , Remotehosts [ IPaddr ] [ 'id' ] ] ) ;
207
+ }
151
208
}
152
209
153
210
154
211
var Clientinfooverview = form . DummyValue . extend ( {
155
-
156
212
renderWidget : function ( ) {
157
213
var body = E ( [
158
214
E ( 'h3' , _ ( 'Remote hosts' ) )
159
215
] ) ;
160
216
var remotehost_table = E ( 'table' , { 'class' : 'table cbi-section-table' , 'id' : 'remotehost_table' } , [
161
217
E ( 'tr' , { 'class' : 'tr table-titles' } , [
162
218
E ( 'th' , { 'class' : 'th' } , _ ( 'IP address' ) ) ,
219
+ E ( 'th' , { 'class' : 'th' } , _ ( 'Hostname' ) ) ,
163
220
E ( 'th' , { 'class' : 'th' } , _ ( 'Identifier' ) )
164
221
] )
165
222
] ) ;
@@ -172,7 +229,8 @@ var Clientinfooverview = form.DummyValue.extend({
172
229
) ;
173
230
var connectioninfo_table = E ( 'table' , { 'class' : 'table cbi-section-table' , 'id' : 'connectioninfo_table' } , [
174
231
E ( 'tr' , { 'class' : 'tr table-titles' } , [
175
- E ( 'th' , { 'class' : 'th' } , _ ( 'IP & Interface name' , 'Combination of IP and interface name in usteer overview' ) ) ,
232
+ E ( 'th' , { 'class' : 'th' } , _ ( 'AP' , 'Name or IP address of access point' ) ) ,
233
+ E ( 'th' , { 'class' : 'th' } , _ ( 'Interface name' , 'interface name in usteer overview' ) ) ,
176
234
E ( 'th' , { 'class' : 'th' } , _ ( 'BSSID' ) ) ,
177
235
E ( 'th' , { 'class' : 'th' } , _ ( 'SSID' ) ) ,
178
236
E ( 'th' , { 'class' : 'th' } , _ ( 'Frequency' , 'BSS operating frequency in usteer overview' ) ) ,
@@ -192,7 +250,8 @@ var Clientinfooverview = form.DummyValue.extend({
192
250
body . appendChild ( connectioninfo_table ) ;
193
251
var compactconnectioninfo_table = E ( 'table' , { 'class' : 'table cbi-section-table' , 'id' : 'compactconnectioninfo_table' } , [
194
252
E ( 'tr' , { 'class' : 'tr table-titles' } , [
195
- E ( 'th' , { 'class' : 'th' } , _ ( 'IP & Interface name' , 'Combination of IP and interface name in usteer overview' ) ) ,
253
+ E ( 'th' , { 'class' : 'th' } , _ ( 'AP' , 'Name or IP address of access point' ) ) ,
254
+ E ( 'th' , { 'class' : 'th' } , _ ( 'Interface name' , 'interface name in usteer overview' ) ) ,
196
255
E ( 'th' , { 'class' : 'th' } , _ ( 'SSID' ) ) ,
197
256
E ( 'th' , { 'class' : 'th' } , _ ( 'Frequency' , 'BSS operating frequency in usteer overview' ) ) ,
198
257
E ( 'th' , { 'class' : 'th' } , _ ( 'Load' , 'Channel load in usteer overview' ) ) ,
0 commit comments