Skip to content

Commit

Permalink
Bug appneta#346 unique IP all packets, not just first
Browse files Browse the repository at this point in the history
  • Loading branch information
fklassen committed Mar 23, 2017
1 parent f143cb0 commit ddb13eb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/send_packets.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ static void increment_iteration(tcpreplay_t *ctx)
{
tcpreplay_opt_t *options = ctx->options;

ctx->last_unique_iteration = ctx->unique_iteration;
++ctx->iteration;
if (options->unique_ip) {
assert(options->unique_loops > 0.0);
Expand All @@ -478,6 +479,7 @@ static void increment_iteration(tcpreplay_t *ctx)
void
send_packets(tcpreplay_t *ctx, pcap_t *pcap, int idx)
{

struct timeval print_delta, now, first_pkt_ts, pkt_ts_delta;
tcpreplay_opt_t *options = ctx->options;
COUNTER packetnum = 0;
Expand Down Expand Up @@ -560,9 +562,8 @@ send_packets(tcpreplay_t *ctx, pcap_t *pcap, int idx)

if (ctx->options->unique_ip && ctx->unique_iteration &&
ctx->unique_iteration > ctx->last_unique_iteration) {
ctx->last_unique_iteration = ctx->unique_iteration;
/* edit packet to ensure every pass has unique IP addresses */
fast_edit_packet(&pkthdr, &pktdata, ctx->unique_iteration,
fast_edit_packet(&pkthdr, &pktdata, ctx->unique_iteration - 1,
preload, datalink);
}

Expand Down Expand Up @@ -819,9 +820,8 @@ send_dual_packets(tcpreplay_t *ctx, pcap_t *pcap1, int cache_file_idx1, pcap_t *

if (ctx->options->unique_ip && ctx->unique_iteration &&
ctx->unique_iteration > ctx->last_unique_iteration) {
ctx->last_unique_iteration = ctx->unique_iteration;
/* edit packet to ensure every pass is unique */
fast_edit_packet(pkthdr_ptr, &pktdata, ctx->unique_iteration,
fast_edit_packet(pkthdr_ptr, &pktdata, ctx->unique_iteration - 1,
options->file_cache[cache_file_idx].cached, datalink);
}

Expand Down

0 comments on commit ddb13eb

Please sign in to comment.