summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranonym <anonym@riseup.net>2017-03-19 00:04:21 +0100
committeranonym <anonym@riseup.net>2017-03-19 00:17:03 +0100
commitfdd50f83f44aa9f46f08ab8bbedf646b2efb3a06 (patch)
tree3ec37d36b64b23df27249a41220d4149c5062a5c
parent9c1809bdacdf6ba0b17a34ec023cdfa38126ffe4 (diff)
Test suite: refine debug info collection of #11508.
I have seen yet another: NoMethodError: undefined method `ip_saddr' for nil:NilClass So we now know that `ip_packet` is not `nil`, it just doesn't have the `ip_saddr` method (and probably not the `ip_daddr` one either) some how (feels strange for an IP packet to not have a source or destination address...). Refs: #11508
-rw-r--r--features/support/helpers/firewall_helper.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/features/support/helpers/firewall_helper.rb b/features/support/helpers/firewall_helper.rb
index 25029a2..97f0eeb 100644
--- a/features/support/helpers/firewall_helper.rb
+++ b/features/support/helpers/firewall_helper.rb
@@ -52,12 +52,15 @@ def pcap_connections_helper(pcap_file, opts = {})
sport: sport,
dport: dport,
}
- # It seems *Packet.parse can return nil despite *Packet.can_parse?
- # returning true. (#11508)
- if ip_packet
+ # It seems *Packet.parse can return an IP packet without source
+ # and/or destination address. (#11508)
+ begin
packet_info[:saddr] = ip_packet.ip_saddr
packet_info[:daddr] = ip_packet.ip_daddr
- else
+ rescue NoMethodError
+ # noop
+ end
+ if not(packet_info.has_key?(:saddr)) || not(packet_info.has_key?(:daddr))
puts "We were hit by #11508. PacketFu bug? Packet info: #{packet_info}"
end
connections << packet_info