} else {
+ print $client ok qq|<h2>Clients on $server::ip</h2>|;
+
my @ping;
if ( my $host = $param->{ping_target} ) {
@ping = ( $host );
my $ping = ping::fping( @ping ) if @ping;
my $arp = client::arp_mac_dev;
- print $client ok
- , qq|<h2>Clients on $server::ip</h2>|
- , html::table( -5,
- 'ip', 'mac', 'dev', 'hostname', 'conf',
- map {
- my $ip = $_;
- my $conf = client::all_conf( $ip );
- my $mac = delete $conf->{mac} || '';
- my $style;
- $style
- = 'style="color:'
- . ( $ping->{$ip} ? 'green' : 'red' )
- . '"'
- if $ping;
- $style ||= '';
- my $ip_text = qq|<tt>$ip</tt>|;
- $ip_text = qq|<tt><b>$ip</b></tt>| if ip::in_dhcp_range($ip);
- (
- qq|<a $style name=$ip target=client href=/client/$ip>$ip_text</a>|
- , format::mac( $mac => 'html' )
- , $arp->{$mac}
- , delete $conf->{hostname}
- , html::conf( $ip, $conf, 'inline' )
- )
- } client::all_ips
- )
+ my @clients;
+
+ foreach my $ip ( client::all_ips ) {
+
+ my $conf = client::all_conf( $ip );
+ my $mac = delete $conf->{mac} || '';
+
+ next unless $arp->{$mac} || $param->{all};
+
+ my $style
+ = 'style="color:'
+ . ( $ping->{$ip} ? 'green' : 'red' )
+ . '"'
+ if $ping;
+
+ $style ||= '';
+ my $ip_text = qq|<tt>$ip</tt>|;
+ $ip_text = qq|<tt><b>$ip</b></tt>| if ip::in_dhcp_range($ip);
+
+ push @clients
+ , qq|<a $style name=$ip target=client href=/client/$ip>$ip_text</a>|
+ , format::mac( $mac => 'html' )
+ , $arp->{$mac}
+ , delete $conf->{hostname}
+ , html::conf( $ip, $conf, 'inline' )
;
+ }
+
+ my $all = $param->{all} ? 0 : 1;
+
+ print $client html::table( -5, 'ip', 'mac', qq|<a href="?all=$all">dev</a>|, 'hostname', 'conf', @clients );
print $client qq|
<form method=get>
<input type=text name=ping_target size=15>