--- lib/PXElator/httpd.pm 2009/08/09 22:05:09 188
+++ lib/PXElator/httpd.pm 2009/08/10 16:36:16 193
@@ -212,17 +212,46 @@
print $client qq|
AMT
|, amt::info( $amt );
}
} else {
+
+ my $arp = {
+ map {
+ my @c = split(/\s+/,$_);
+ if ( $#c == 5 ) {
+ ( uc $c[3] => [ $c[0] , $c[5] ] )
+ } else {
+ }
+ } read_file('/proc/net/arp')
+ };
+
+ warn "# arp ",dump( $arp );
+
print $client $ok
, qq|Clients on $server::ip
|
- , html::table( -4,
- 'ip', 'mac', 'hostname', 'deploy',
+ , html::table( -5,
+ 'ip', 'hostname', 'mac', 'deploy', 'arp',
map {
my $ip = $_;
$ip =~ s{^.+/ip/}{};
- ( qq|$ip|, client::mac($ip), client::conf( $ip, 'hostname' ), html::tt client::conf( $ip, 'deploy' ) );
+ my $arp = $arp->{ client::mac $ip, 'clean' };
+ $arp = $arp ? $arp->[1] : '';
+ $arp =~ s{$ip}{};
+ (
+ qq|$ip|
+ , client::conf( $ip, 'hostname' )
+ , client::mac( $ip )
+ , html::tt( client::conf( $ip, 'deploy' ) )
+ , $arp
+ );
}
glob("$server::conf/ip/*")
)
+ , qq|ARP
|
+ , html::table( -3, 'mac', 'dev', 'ip',
+ map {
+ my $c = $arp->{$_};
+ ( html::tt( $_ ), $c->[1], $c->[0] )
+ } sort keys %$arp
+ )
;
}
} elsif ( $path =~ m{^/our/(\w+)/(\S+)} ) {
@@ -249,6 +278,10 @@
warn 'tap ', network::tap();
+ daemons::start_stop 'browser', $url;
+ daemons::start_stop $_ foreach ( qw/dhcpd tftpd dnsd/ );
+ daemons::start_stop 'kvm' unless $ENV{DEV}; # skip kvm statup when running on real device
+
my $server = IO::Socket::INET->new(
Proto => 'tcp',
LocalAddr => $server::ip,
@@ -259,10 +292,6 @@
print "url $url\n";
- daemons::start_stop 'browser', $url;
- daemons::start_stop $_ foreach ( qw/dhcpd tftpd dnsd/ );
- daemons::start_stop 'kvm' unless $ENV{DEV}; # skip kvm statup when running on real device
-
while (1) {
my $client = $server->accept() || next; # ALARM trickle us
my $request = <$client>;