--- lib/PXElator/dhcpd.pm 2009/08/06 20:14:43 167 +++ lib/PXElator/dhcpd.pm 2009/08/06 21:31:10 168 @@ -18,7 +18,6 @@ use IO::Socket::INET; use File::Slurp; use Data::Dump qw/dump/; -use Net::Ping; use lib '..'; use Net::DHCP::Packet; @@ -35,7 +34,7 @@ warn "server ip $server::ip range: $server::ip_from - $server::ip_to\n"; -my $addr = $server::ip_from; +use client; sub client_ip { my ( $mac ) = @_; @@ -49,16 +48,7 @@ return $ip; } - my $p = Net::Ping->new; - - my $prefix = $server::ip; - $prefix =~ s{\.\d+$}{.}; - my $ip = $prefix . $addr; - - while ( -e "$conf/ip/$ip" || $p->ping( $ip ) ) { - $ip = $prefix . $addr++; - die "all addresses allocated!" if $addr == $server::ip_to; - } + my $ip = client::next_ip; write_file "$conf/mac/$mac", $ip; @@ -156,7 +146,7 @@ } } - warn "W: options requested but missing: ",dump( @missing ); + warn "W: options requested but missing: ",dump( @missing ),$/; foreach my $opt ( 'magic', 'config_file', 'path_prefix', 'reboot_time' ) { my $DH0 = eval 'DHO_PXELINUX_' . uc $opt;