/[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 8 by dpavlin, Mon Jul 27 11:46:44 2009 UTC revision 12 by dpavlin, Mon Jul 27 22:18:51 2009 UTC
# Line 14  die "need to run $0 as root like this\ns Line 14  die "need to run $0 as root like this\ns
14    
15  my $debug = shift @ARGV;  my $debug = shift @ARGV;
16    
17  our ( $server_ip, $next_file );  our ( $server_ip, $file, $next_file );
 require "config.pl";  
18    
19  my $sock = IO::Socket::INET->new(  my $sock = IO::Socket::INET->new(
20          LocalPort       => 67,          LocalPort       => 67,
# Line 53  sub client_ip { Line 52  sub client_ip {
52    
53  while (1) {  while (1) {
54    
55            require "config.pl"; # refresh config
56    
57          print "waiting for DHCP requests on ",$sock->sockhost,":",$sock->sockport,"\n";          print "waiting for DHCP requests on ",$sock->sockhost,":",$sock->sockport,"\n";
58    
59          my $buf;          my $buf;
# Line 73  while (1) { Line 74  while (1) {
74                  my $mac = substr($dhcp->chaddr(),0,$dhcp->hlen()*2);                  my $mac = substr($dhcp->chaddr(),0,$dhcp->hlen()*2);
75                  my $ip = client_ip($mac);                  my $ip = client_ip($mac);
76    
77                  my $file =  $next_file;                  if ( ! $file ) {
78                  $file = 'undionly.kpxe' if ! $file || $dhcp->getOptionValue(DHO_USER_CLASS()) ne 'gPXE';                          if ( $dhcp->getOptionValue(DHO_USER_CLASS()) ne 'gPXE' ) {
79                                    $file = 'undionly.kpxe';
80                            } else {
81                                    $file = $next_file;
82                            }
83                    }
84    
85                  my $packet = new Net::DHCP::Packet(                  my $packet = new Net::DHCP::Packet(
86                          Op              => BOOTREPLY(),                          Op              => BOOTREPLY(),

Legend:
Removed from v.8  
changed lines
  Added in v.12

  ViewVC Help
Powered by ViewVC 1.1.26