/[pxelator]/lib/PXElator/httpd.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/PXElator/httpd.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 327 by dpavlin, Fri Aug 28 19:41:16 2009 UTC revision 330 by dpavlin, Fri Aug 28 22:29:08 2009 UTC
# Line 269  warn "XXX pids = ", dump( $daemons::pids Line 269  warn "XXX pids = ", dump( $daemons::pids
269                          if ( my $amt = client::conf( $ip, 'amt' ) ) {                          if ( my $amt = client::conf( $ip, 'amt' ) ) {
270                                  print $client qq|<h2>AMT</h2>|, amt::info( $amt, $ip );                                  print $client qq|<h2>AMT</h2>|, amt::info( $amt, $ip );
271                          }                          }
272    
273                  } else {                  } else {
274    
275                          my $arp = {                          my $arp = client::arp_mac_dev;
276                                  map {                          my @ips = client::all_ips;
                                         my @c = split(/\s+/,$_);  
                                         if ( $#c == 5 ) {  
                                                 client::save_ip_mac( $c[0], $c[3] );  
                                                 ( uc $c[3] => $c[5] )  
                                         } else {  
                                         }  
                                 } read_file('/proc/net/arp')  
                         };  
277    
278                          warn "# arp ",dump( $arp );                          my $ping;
279                            $ping = ping::fping( @ips ) if $param->{ping};
280    
281                          print $client ok                          print $client ok
282                                  , qq|<h2>Clients on $server::ip</h2>|                                  , qq|<h2>Clients on $server::ip</h2>|
# Line 292  warn "XXX pids = ", dump( $daemons::pids Line 286  warn "XXX pids = ", dump( $daemons::pids
286                                                  my $ip = $_;                                                  my $ip = $_;
287                                                  my $conf = client::all_conf( $ip );                                                  my $conf = client::all_conf( $ip );
288                                                  my $mac = delete $conf->{mac} || '';                                                  my $mac = delete $conf->{mac} || '';
289                                                    my $style;
290                                                    $style
291                                                            = 'style="color:'
292                                                            . ( $ping->{$ip} ? 'green' : 'red' )
293                                                            . '"'
294                                                            if $ping;
295                                                  (                                                  (
296                                                          qq|<a name=$ip href=/client/$ip>$ip</a>|                                                          qq|<a $style name=$ip href=/client/$ip>$ip</a>|
297                                                          , format::mac( $mac => 'html' )                                                          , format::mac( $mac => 'html' )
298                                                          , $arp->{$mac}                                                          , $arp->{$mac}
299                                                          , delete $conf->{hostname}                                                          , delete $conf->{hostname}
300                                                          , delete $conf->{deploy}                                                          , delete $conf->{deploy}
301                                                          , ( %$conf ? html::pre_dump( $conf ) : qq|<a href=/nmap?scan=$ip>nmap</a>| )                                                          , ( %$conf ? html::pre_dump( $conf ) : qq|<a href=/nmap?scan=$ip>nmap</a>| )
302                                                  );                                                  );
303                                          } client::all_ips                                          } @ips
304                                  )                                  )
305                                  ;                                  ;
306                            print $client qq|
307                                    <form method=get>
308                                    <input type=submit name=ping value=ping>
309                                    </form>
310                            |;
311                  }                  }
312          } elsif ( $path =~ m{^/brctl} ) {          } elsif ( $path =~ m{^/brctl} ) {
313                  print $client ok                  print $client ok
# Line 371  sub start { Line 376  sub start {
376    
377                  if ($request =~ m{^GET (/.*) HTTP/1.[01]}) {                  if ($request =~ m{^GET (/.*) HTTP/1.[01]}) {
378                          my $path = $1;                          my $path = $1;
379                            $path =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge;
380                          my $param;                          my $param;
381                          if ( $path =~ s{\?(.+)}{} ) {                          if ( $path =~ s{\?(.+)}{} ) {
382                                  foreach my $p ( split(/[&;]/, $1) ) {                                  foreach my $p ( split(/[&;]/, $1) ) {

Legend:
Removed from v.327  
changed lines
  Added in v.330

  ViewVC Help
Powered by ViewVC 1.1.26