summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranonym <anonym@riseup.net>2019-06-19 16:39:01 +0200
committeranonym <anonym@riseup.net>2019-06-19 16:39:01 +0200
commit05ccafae970303b6f75ac76d96623be797043f5a (patch)
tree2b96b6be516a25ac941a6b8c8effb4cd8b3379d2
parent7ff6c1d2ff6a065a4d492f9b63ff198308a91e8b (diff)
Test suite: ignore RARP packets.test/16825-ignore-rarp
packetfu cannot parse these. Refs: #16825
-rw-r--r--features/support/helpers/firewall_helper.rb18
1 files changed, 15 insertions, 3 deletions
diff --git a/features/support/helpers/firewall_helper.rb b/features/support/helpers/firewall_helper.rb
index dc62edd..71364fe 100644
--- a/features/support/helpers/firewall_helper.rb
+++ b/features/support/helpers/firewall_helper.rb
@@ -6,6 +6,13 @@ def looks_like_dhcp_packet?(eth_packet, protocol, sport, dport, ip_packet)
ip_packet && ip_packet.ip_daddr == "255.255.255.255"
end
+def is_rarp_packet?(p)
+ # Details: https://www.netometer.com/qa/rarp.html#A13
+ p.force_encoding("UTF-8").start_with?(
+ "\xFF\xFF\xFF\xFF\xFF\xFFRT\x00\xAC\xDD\xEE\x805\x00\x01\b\x00\x06"
+ ) && (p[19] == "\x03" || p[19] == "\x04")
+end
+
# Returns the unique edges (based on protocol, source/destination
# address/port) in the graph of all network flows.
def pcap_connections_helper(pcap_file, opts = {})
@@ -18,9 +25,14 @@ def pcap_connections_helper(pcap_file, opts = {})
if PacketFu::EthPacket.can_parse?(p)
eth_packet = PacketFu::EthPacket.parse(p)
else
- raise FirewallAssertionFailedError.new(
- 'Found something that is not an ethernet packet'
- )
+ if is_rarp_packet?(p)
+ # packetfu cannot parse RARP, see #16825.
+ next
+ else
+ raise FirewallAssertionFailedError.new(
+ 'Found something that is not an ethernet packet'
+ )
+ end
end
sport = nil
dport = nil