/[pxelator]/lib/PXElator/dhcpd.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/dhcpd.pm

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

revision 63 by dpavlin, Thu Jul 30 16:16:18 2009 UTC revision 67 by dpavlin, Thu Jul 30 21:31:30 2009 UTC
# Line 26  use Net::DHCP::Packet; Line 26  use Net::DHCP::Packet;
26  use Net::DHCP::Constants 0.67;  use Net::DHCP::Constants 0.67;
27    
28  use server;  use server;
29    my $debug = server::debug;
30  use pxe;  use pxe;
31    
 my $debug = 1;  
   
32  if ( ! $server::ip ) {  if ( ! $server::ip ) {
33          my $server_ip = `/sbin/ifconfig`;          my $server_ip = `/sbin/ifconfig`;
34          $server_ip =~ s/^.+?addr:([\d\.]+).*$/$1/gs;          $server_ip =~ s/^.+?addr:([\d\.]+).*$/$1/gs;
# Line 92  sub process_packet { Line 91  sub process_packet {
91          my $dhcp = Net::DHCP::Packet->new($buf);          my $dhcp = Net::DHCP::Packet->new($buf);
92          $dhcp->comment( $transaction++ );          $dhcp->comment( $transaction++ );
93    
94          warn "recv: ", $dhcp->toString;          warn "recv: ", $dhcp->toString if $debug;
95    
96          my $mac = substr($dhcp->chaddr(),0,$dhcp->hlen()*2);          my $mac = substr($dhcp->chaddr(),0,$dhcp->hlen()*2);
97          my $ip = client_ip($mac);          my $ip = client_ip($mac);
# Line 155  sub process_packet { Line 154  sub process_packet {
154          warn ">> $mac == $ip server: $server::ip", $pxe::file ? " pxe file: $pxe::file\n" : "\n";          warn ">> $mac == $ip server: $server::ip", $pxe::file ? " pxe file: $pxe::file\n" : "\n";
155    
156          $packet = new Net::DHCP::Packet( %$packet );          $packet = new Net::DHCP::Packet( %$packet );
157          warn "## ",$packet->toString(),"\n" if $debug;          warn "send ",$packet->toString() if $debug;
158    
159          my $reply = IO::Socket::INET->new(          my $reply = IO::Socket::INET->new(
160                  LocalAddr => $server::ip,                  LocalAddr => $server::ip,

Legend:
Removed from v.63  
changed lines
  Added in v.67

  ViewVC Help
Powered by ViewVC 1.1.26