mirror of
https://github.com/solemnwarning/ipxwrapper
synced 2024-12-30 16:45:37 +01:00
Ignore DNS/DHCP traffic in tests.
This commit is contained in:
parent
5d49ee60cb
commit
8c5752520e
@ -25,6 +25,8 @@ use NetPacket::IP;
|
||||
use NetPacket::UDP;
|
||||
use NetPacket::IPXWrapper;
|
||||
|
||||
my @IGNORE_PORTS = (53, 67, 68); # DNS and DHCP
|
||||
|
||||
sub new
|
||||
{
|
||||
my ($class, $dev) = @_;
|
||||
@ -56,6 +58,12 @@ sub read_available
|
||||
|
||||
my $udp = NetPacket::UDP->decode($ip->{data});
|
||||
|
||||
# NetPacket::IPXWrapper tries to validate packets are in fact
|
||||
# IPXWrapper packets, but I've seen it accept DNS packets that
|
||||
# just happen to have the right bytes in places, so we ignore
|
||||
# special ports we expect unrelated traffic on.
|
||||
return if(grep { $udp->{src_port} == $_ || $udp->{dest_port} == $_ } @IGNORE_PORTS);
|
||||
|
||||
my $ipx = NetPacket::IPXWrapper->decode($udp->{data});
|
||||
return unless(defined($ipx));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user