Skip to content

Commit

Permalink
Merge pull request #460 from appneta/Bug_#421_maxsleep_option_broken
Browse files Browse the repository at this point in the history
#421 fix ms to ns conversion
  • Loading branch information
fklassen authored Jan 26, 2018
2 parents 64f6cd2 + 4424889 commit 7b49564
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- Unable to build with libpcap 1.8.1 (#430)
- tcpprep -S not working for large cache files (#423)
- Unable to tcprewrite range of ports with --portmap (#422)
- --maxsleep broken for values less than 1000 (#421)
- Avoid non-blocking behaviour when using STDIN (#416)
- pcap containing >1020 packets produces invalid cache file (#415)
- heap-buffer-overflow in get_l2protocol (#410)
Expand Down
2 changes: 1 addition & 1 deletion src/send_packets.c
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ static bool calc_sleep_time(tcpreplay_t *ctx, struct timeval *pkt_time_delta,
dbgx(3, "original packet delta pkt_time: " TIMEVAL_FORMAT, nap_for.tv_sec, nap_for.tv_usec);

TIMEVAL_TO_TIMESPEC(&nap_for, &ctx->nap);
dbgx(3, "original packet delta timv: " TIMESPEC_FORMAT, ctx->nap.tv_sec, ctx->nap.tv_nsec);
dbgx(3, "original packet delta time: " TIMESPEC_FORMAT, ctx->nap.tv_sec, ctx->nap.tv_nsec);
timesdiv_float(&ctx->nap, options->speed.multiplier);
dbgx(3, "original packet delta/div: " TIMESPEC_FORMAT, ctx->nap.tv_sec, ctx->nap.tv_nsec);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/tcpreplay_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ tcpreplay_post_args(tcpreplay_t *ctx, int argc)

if (HAVE_OPT(MAXSLEEP)) {
options->maxsleep.tv_sec = OPT_VALUE_MAXSLEEP / 1000;
options->maxsleep.tv_nsec = (OPT_VALUE_MAXSLEEP % 1000) * 1000;
options->maxsleep.tv_nsec = (OPT_VALUE_MAXSLEEP % 1000) * 1000 * 1000;
}

#ifdef ENABLE_VERBOSE
Expand Down

0 comments on commit 7b49564

Please sign in to comment.