]> The Tcpdump Group git mirrors - libpcap/commitdiff
Check for the "break the loop" condition in the inner loop for TPACKET_V3.
authorGuy Harris <[email protected]>
Mon, 3 Oct 2016 06:58:40 +0000 (23:58 -0700)
committerGuy Harris <[email protected]>
Mon, 3 Oct 2016 06:58:40 +0000 (23:58 -0700)
Otherwise, if a callback calls pcap_breakloop(), the inner loop won't
terminate.

pcap-linux.c

index b51f5e50c911f6d66f8804d755828094720aa221..924df42af06156b38aaa989a2febc1e25203ec47 100644 (file)
@@ -5093,7 +5093,7 @@ again:
                        packets_to_read = max_packets - pkts;
                }
 
-               while (packets_to_read--) {
+               while (packets_to_read-- && !handle->break_loop) {
                        struct tpacket3_hdr* tp3_hdr = (struct tpacket3_hdr*) handlep->current_packet;
                        ret = pcap_handle_packet_mmap(
                                        handle,