--- bin/dhcpd.pl 2009/07/26 13:58:39 3 +++ bin/dhcpd.pl 2009/07/26 15:16:52 6 @@ -14,7 +14,7 @@ my $debug = shift @ARGV; -our $server_ip; +our ( $server_ip, $next_file ); require "config.pl"; my $sock = IO::Socket::INET->new( @@ -31,7 +31,6 @@ my $_ip = 10; my $_mac2ip; -my $_ip_file; sub client_ip { my ( $mac ) = @_; @@ -73,6 +72,9 @@ my $mac = substr($dhcp->chaddr(),0,$dhcp->hlen()*2); my $ip = client_ip($mac); + my $file = $next_file; + $file = 'undionly.kpxe' if ! $file || $dhcp->getOptionValue(DHO_USER_CLASS()) ne 'gPXE'; + my $packet = new Net::DHCP::Packet( Op => BOOTREPLY(), Hops => $dhcp->hops(), @@ -83,7 +85,7 @@ Siaddr => $server_ip, Giaddr => $dhcp->giaddr(), Chaddr => $dhcp->chaddr(), - File => 'undionly.kpxe', + File => $file, # DHO_DHCP_MESSAGE_TYPE() => DHCPACK(), DHO_SUBNET_MASK() => '255.0.0.0', );