use Net:capUtils;
use NetPacket::Ethernet;
use NetPacket::IP;
@approvedservers{"192.168.0.2","192.168.0.3"} = ();
$filt = "dst port 68";
die "Unable to perform
capture:".Net:cap::geterr($descript)."\n"
if (Net:capUtils::loop(\&grabipandcompare, FILTER =>
$filt));
sub grabipandcompare{
my ($arg,$hdr,$pkt) = @_ ;
$server_ip = NetPacket::IP->decode(
NetPacket::Ethernet::strip($pkt))->{'src_ip'};
warn "Rogue DHCP server: $server_ip!\n"
unless exists $approvedservers{$server_ip};
}