338 |
|
|
339 |
} else { |
} else { |
340 |
|
|
341 |
|
print $client ok qq|<h2>Clients on $server::ip</h2>|; |
342 |
|
|
343 |
my @ping; |
my @ping; |
344 |
if ( my $host = $param->{ping_target} ) { |
if ( my $host = $param->{ping_target} ) { |
345 |
@ping = ( $host ); |
@ping = ( $host ); |
350 |
my $ping = ping::fping( @ping ) if @ping; |
my $ping = ping::fping( @ping ) if @ping; |
351 |
my $arp = client::arp_mac_dev; |
my $arp = client::arp_mac_dev; |
352 |
|
|
353 |
print $client ok |
my @clients; |
354 |
, qq|<h2>Clients on $server::ip</h2>| |
|
355 |
, html::table( -5, |
foreach my $ip ( client::all_ips ) { |
356 |
'ip', 'mac', 'dev', 'hostname', 'conf', |
|
357 |
map { |
my $conf = client::all_conf( $ip ); |
358 |
my $ip = $_; |
my $mac = delete $conf->{mac} || ''; |
359 |
my $conf = client::all_conf( $ip ); |
|
360 |
my $mac = delete $conf->{mac} || ''; |
next unless $arp->{$mac} || $param->{all}; |
361 |
my $style; |
|
362 |
$style |
my $style |
363 |
= 'style="color:' |
= 'style="color:' |
364 |
. ( $ping->{$ip} ? 'green' : 'red' ) |
. ( $ping->{$ip} ? 'green' : 'red' ) |
365 |
. '"' |
. '"' |
366 |
if $ping; |
if $ping; |
367 |
$style ||= ''; |
|
368 |
my $ip_text = qq|<tt>$ip</tt>|; |
$style ||= ''; |
369 |
$ip_text = qq|<tt><b>$ip</b></tt>| if ip::in_dhcp_range($ip); |
my $ip_text = qq|<tt>$ip</tt>|; |
370 |
( |
$ip_text = qq|<tt><b>$ip</b></tt>| if ip::in_dhcp_range($ip); |
371 |
qq|<a $style name=$ip target=client href=/client/$ip>$ip_text</a>| |
|
372 |
, format::mac( $mac => 'html' ) |
push @clients |
373 |
, $arp->{$mac} |
, qq|<a $style name=$ip target=client href=/client/$ip>$ip_text</a>| |
374 |
, delete $conf->{hostname} |
, format::mac( $mac => 'html' ) |
375 |
, html::conf( $ip, $conf, 'inline' ) |
, $arp->{$mac} |
376 |
) |
, delete $conf->{hostname} |
377 |
} client::all_ips |
, html::conf( $ip, $conf, 'inline' ) |
|
) |
|
378 |
; |
; |
379 |
|
} |
380 |
|
|
381 |
|
my $all = $param->{all} ? 0 : 1; |
382 |
|
|
383 |
|
print $client html::table( -5, 'ip', 'mac', qq|<a href="?all=$all">dev</a>|, 'hostname', 'conf', @clients ); |
384 |
print $client qq| |
print $client qq| |
385 |
<form method=get> |
<form method=get> |
386 |
<input type=text name=ping_target size=15> |
<input type=text name=ping_target size=15> |