--- lib/PXElator/httpd.pm 2009/08/09 21:13:36 185 +++ lib/PXElator/httpd.pm 2009/08/10 16:36:16 193 @@ -184,36 +184,74 @@ my $ip = $1 || $client->peerhost; if ( $ip ne $server::ip ) { my $hostname = client::conf( $ip, 'hostname' => $param->{hostname} ); - my $deploy = client::conf( $ip, 'deploy' => $param->{deploy} ); + + my @table = ( + 'ip' => $ip, + 'hostname' => qq||, + ); + + my $deploy; + + if ( my $mac = client::mac( $ip ) ) { + $deploy = client::conf( $ip, 'deploy' => $param->{deploy} ); + push @table, ( + 'mac' => $mac, + 'deploy' => html::select( 'deploy', $deploy, config::available ) + ); + $deploy = qq|

PXElinux

| . html::pre( config::for_ip( $ip ) ); + } + print $client $ok , qq|
| - , html::table( 2, - 'ip' => $ip, - 'mac' => client::mac( $ip ), - 'hostname' => qq||, - 'deploy' => html::select( 'deploy', $deploy, config::available ), - ) + , html::table( 2, @table ), , qq|
| - , qq|

PXElinux $deploy

|
-				, config::for_ip( $ip )
-				, qq|
| + , $deploy ; if ( my $amt = client::conf( $ip, 'amt' ) ) { - print $client amt::info( $amt ); + 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+)} ) { @@ -240,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, @@ -250,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>;