From 25affdbb193c4005bca1becc6f3931cbce483361 Mon Sep 17 00:00:00 2001 From: Chris Hand Date: Thu, 29 Jan 2015 11:24:18 -0500 Subject: [PATCH] Stop sending and exit when limit is reached - Fixed check for when the limit is reached so we don't send an extra packet - Set the abort flag so the program exits --- src/send_packets.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/send_packets.c b/src/send_packets.c index 9def00182..cdbc7c7cf 100644 --- a/src/send_packets.c +++ b/src/send_packets.c @@ -491,8 +491,10 @@ send_packets(tcpreplay_t *ctx, pcap_t *pcap, int idx) return; /* stop sending based on the limit -L? */ - if (limit_send > 0 && ctx->stats.pkts_sent > (COUNTER)limit_send) + if (limit_send > 0 && ctx->stats.pkts_sent >= (COUNTER)limit_send) { + ctx->abort = true; break; + } packetnum++; #if defined TCPREPLAY || defined TCPREPLAY_EDIT @@ -704,8 +706,10 @@ send_dual_packets(tcpreplay_t *ctx, pcap_t *pcap1, int cache_file_idx1, pcap_t * return; /* stop sending based on the limit -L? */ - if (limit_send > 0 && ctx->stats.pkts_sent > (COUNTER)limit_send) + if (limit_send > 0 && ctx->stats.pkts_sent >= (COUNTER)limit_send) { + ctx->abort = true; break; + } packetnum++;