-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --skip-pkts and --skip-to-secs to allow skipping packets when replaying #478
Add --skip-pkts and --skip-to-secs to allow skipping packets when replaying #478
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple changes required before I could accept this.
Also reviewing the use case for this. Why is this needed?
@@ -519,13 +519,28 @@ send_packets(tcpreplay_t *ctx, pcap_t *pcap, int idx) | |||
now_is_now = false; | |||
} | |||
|
|||
/* SKIP PACKETS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change must be also implemented in send_dual_packets()
/* MAIN LOOP | ||
* Keep sending while we have packets or until | ||
* we've sent enough packets | ||
*/ | ||
while (!ctx->abort && | ||
(pktdata = get_next_packet(ctx, pcap, &pkthdr, idx, prev_packet)) != NULL) { | ||
|
||
/* Skip packets */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also must be copied to This change must be also implemented in
send_dual_packets()`
We are using tcpreplay to replay video streams. We save video streams in chunks of 1 min. By being able to skip into pcap files we can easily jump back and forth in our recordings :) Do you want me to make a new pull request with the changes added to send_dial_packets()? (I'm not very experienced with github) |
Sorry for the delay. Just commit changes directly into this branch and push up. I'll try to get this into 4.4.0 if I see changes in the next few days. I plan a release by the end of January. |
Sorry for the late reply. Would you still like to merge this PR if I rebase and verify it still works ? |
I would not guarantee that I can get it in to 4.5, but a rebase and test cases would help. Please rebase and target from this branch I created for you https://github.com/appneta/tcpreplay/tree/PR_478_skip_feature_rebase_4.5.0. Also, new PRs will contain this checklist. Please apply it to the PR. https://github.com/appneta/tcpreplay/blob/PR_478_skip_feature_rebase_4.5.0/.github/PULL_REQUEST_TEMPLATE.md |
f26d87b
to
c79e648
Compare
Let me know what you think :) |
Did some testing in staging branch and decided to push to next release. This introduces new bugs:
Most likely the skip logic has to happen in the calling functions. Also, documentation needs improvement. |
Standards checklist:
Changes:
--skip-pkts x
as parameter totcpreplay
. It adds support for skipping the first X packets in a pcap file--skip-to-secs Y
as parameter totcpreplay
. It adds support for skipping until Y seconds into the pcap file. The seconds is absolute since since the unix epochOther comments:
We needed this in a project where we used a series of pcap files for storing sound and video recordings. If a user wanted to start a replay from a certain date and time we would know which pcap file to replay (based on the filename of the pcap file) and by using
--skip-to-seconds
we could jump to the date and time in the pcap file.