By "the loop continues" you mean tcpreplay does not exit? Can't imagine why that is- tcpreplay has never suppressed any of the SIGDIE/QUIT/etc signals and only uses SIGUSR1 to pause and SIGCONT to continue. Going to need more information about your system and what's going on (a screen cap of your terminal after the CTRL-C would help)
Anyways the way I'd do things is as root run this script: #!/bin/bash tcpreplay <args> pid=`jobs -l tcpreplay | cut -d " " -f 2` sleep XXXX kill -9 $pid Replace <args> with your arguments and XXXX with the number of seconds to let tcpreplay run On Mon, Jun 20, 2011 at 9:34 AM, Dileep Simha <dsi...@gmail.com> wrote: > I'm having another minor problem with running tcpreplay in an infinite loop. > I want to write a wrapper for tcpreplay that uses a time specification > rather than the number of loops. My idea was to run tcpreplay on an > infinite loop then send the CTRL-C signal to end it. However, even when I > run tcpreplay directly, and press CTRL-C, the loops continues. Here is > exactly what I am running on the command prompt: > sudo ./tcpreplay --topspeed --loop=0 --intf1=eth0 capture.pcap > Thanks > On Fri, Jun 17, 2011 at 2:24 PM, Aaron Turner <synfina...@gmail.com> wrote: >> >> src/tcpreplay.c >> >> >> On Fri, Jun 17, 2011 at 12:10 PM, Dileep Simha <dsi...@gmail.com> wrote: >> > Thank you for responding. I appreciate it a lot. >> > I am sorry, but I am not quite clear on what exactly I am modifying. >> > The >> > output you have given me seems to come from a diff (correct me if I am >> > wrong). I am assuming the + means that these are new segments of code >> > and >> > the other lines already exist in the original file. However, I can't >> > seem >> > to find >> > " >> > if (options.dualfile) { >> > /* process two files at a time for network taps */ >> > for (i = 0; i < argc; i += 2) { >> > " >> > in any of the files. I did a search file contents on the main directory >> > and >> > got no results for "dualfile" or "options.dualfile". What files exactly >> > am >> > I editing and what should I add. >> > Again, sorry for bothering you >> > - Dileep >> > On Fri, Jun 17, 2011 at 1:15 PM, Aaron Turner <synfina...@gmail.com> >> > wrote: >> >> >> >> I haven't tested this, other then to make sure it compiles, but I >> >> think it should do what you want: >> >> >> >> --- src/tcpreplay.c (revision 2540) >> >> +++ src/tcpreplay.c (working copy) >> >> @@ -152,8 +152,10 @@ >> >> /* main loop for non-bridge mode */ >> >> if (options.loop > 0) { >> >> while (options.loop--) { /* limited loop */ >> >> - >> >> - >> >> +#ifdef TCPREPLAY_EDIT >> >> + OPT_VALUE_SEED += options.loop; >> >> + tcpedit_post_args(&tcpedit); >> >> +#endif >> >> if (options.dualfile) { >> >> /* process two files at a time for network taps */ >> >> for (i = 0; i < argc; i += 2) { >> >> >> >> >> >> >> >> On Fri, Jun 17, 2011 at 10:29 AM, Dileep Simha <dsi...@gmail.com> >> >> wrote: >> >> > Thanks for the quick response. I appreciate it. >> >> > I'm using the loopback interface because a co-worker is working on >> >> > the >> >> > same >> >> > linux box as me and is doing tests on the other interfaces. >> >> > Would there be a simple way for me to modify the source code in order >> >> > to >> >> > re-randomize the ip address before each iteration or not? >> >> > - Dileep >> >> > >> >> > On Fri, Jun 17, 2011 at 12:23 PM, Aaron Turner <synfina...@gmail.com> >> >> > wrote: >> >> >> >> >> >> On Fri, Jun 17, 2011 at 9:57 AM, Dileep Simha <dsi...@gmail.com> >> >> >> wrote: >> >> >> > I have a question about the randomizing ip address function of >> >> >> > tcpreplay-edit. >> >> >> > When I run the following: ./tcpreplay-edit --intf1=lo --topspeed >> >> >> > --seed=10 >> >> >> > --loop=3 capture.pcap, >> >> >> > is the ip address randomized before every single loop or is it >> >> >> > just >> >> >> > done >> >> >> > once and then the same ip address sent over and over. I was going >> >> >> > to >> >> >> > check >> >> >> > this with --verbose flag but that keeps giving me an error >> >> >> >> >> >> Sorry about the verbose flag issue... been driving me nuts that one. >> >> >> >> >> >> As for seed & loop, basically you'll end up with the same IP >> >> >> addresses >> >> >> 3 times. Basically randomization is done by combining the seed + >> >> >> original IP to generate the new IP. In order for sessions not to >> >> >> break, the code makes sure that a given seed + IP always results in >> >> >> the same "randomized IP". >> >> >> >> >> >> FWIW, replaying over loopback is almost always the wrong thing to >> >> >> do. >> >> >> >> >> >> >> >> >> -- >> >> >> Aaron Turner >> >> >> http://synfin.net/ Twitter: @synfinatic >> >> >> http://tcpreplay.synfin.net/ - Pcap editing and replay tools for >> >> >> Unix & >> >> >> Windows >> >> >> Those who would give up essential Liberty, to purchase a little >> >> >> temporary >> >> >> Safety, deserve neither Liberty nor Safety. >> >> >> -- Benjamin Franklin >> >> >> "carpe diem quam minimum credula postero" >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> ------------------------------------------------------------------------------ >> >> >> EditLive Enterprise is the world's most technically advanced content >> >> >> authoring tool. Experience the power of Track Changes, Inline Image >> >> >> Editing and ensure content is compliant with Accessibility Checking. >> >> >> http://p.sf.net/sfu/ephox-dev2dev >> >> >> _______________________________________________ >> >> >> Tcpreplay-users mailing list >> >> >> Tcpreplay-users@lists.sourceforge.net >> >> >> https://lists.sourceforge.net/lists/listinfo/tcpreplay-users >> >> >> Support Information: http://tcpreplay.synfin.net/trac/wiki/Support >> >> > >> >> > >> >> > >> >> > >> >> > ------------------------------------------------------------------------------ >> >> > EditLive Enterprise is the world's most technically advanced content >> >> > authoring tool. Experience the power of Track Changes, Inline Image >> >> > Editing and ensure content is compliant with Accessibility Checking. >> >> > http://p.sf.net/sfu/ephox-dev2dev >> >> > _______________________________________________ >> >> > Tcpreplay-users mailing list >> >> > Tcpreplay-users@lists.sourceforge.net >> >> > https://lists.sourceforge.net/lists/listinfo/tcpreplay-users >> >> > Support Information: http://tcpreplay.synfin.net/trac/wiki/Support >> >> > >> >> >> >> >> >> >> >> -- >> >> Aaron Turner >> >> http://synfin.net/ Twitter: @synfinatic >> >> http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix & >> >> Windows >> >> Those who would give up essential Liberty, to purchase a little >> >> temporary >> >> Safety, deserve neither Liberty nor Safety. >> >> -- Benjamin Franklin >> >> "carpe diem quam minimum credula postero" >> >> >> >> >> >> >> >> ------------------------------------------------------------------------------ >> >> EditLive Enterprise is the world's most technically advanced content >> >> authoring tool. Experience the power of Track Changes, Inline Image >> >> Editing and ensure content is compliant with Accessibility Checking. >> >> http://p.sf.net/sfu/ephox-dev2dev >> >> _______________________________________________ >> >> Tcpreplay-users mailing list >> >> Tcpreplay-users@lists.sourceforge.net >> >> https://lists.sourceforge.net/lists/listinfo/tcpreplay-users >> >> Support Information: http://tcpreplay.synfin.net/trac/wiki/Support >> > >> > >> > >> > ------------------------------------------------------------------------------ >> > EditLive Enterprise is the world's most technically advanced content >> > authoring tool. Experience the power of Track Changes, Inline Image >> > Editing and ensure content is compliant with Accessibility Checking. >> > http://p.sf.net/sfu/ephox-dev2dev >> > _______________________________________________ >> > Tcpreplay-users mailing list >> > Tcpreplay-users@lists.sourceforge.net >> > https://lists.sourceforge.net/lists/listinfo/tcpreplay-users >> > Support Information: http://tcpreplay.synfin.net/trac/wiki/Support >> > >> >> >> >> -- >> Aaron Turner >> http://synfin.net/ Twitter: @synfinatic >> http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix & >> Windows >> Those who would give up essential Liberty, to purchase a little temporary >> Safety, deserve neither Liberty nor Safety. >> -- Benjamin Franklin >> "carpe diem quam minimum credula postero" >> >> >> ------------------------------------------------------------------------------ >> EditLive Enterprise is the world's most technically advanced content >> authoring tool. Experience the power of Track Changes, Inline Image >> Editing and ensure content is compliant with Accessibility Checking. >> http://p.sf.net/sfu/ephox-dev2dev >> _______________________________________________ >> Tcpreplay-users mailing list >> Tcpreplay-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/tcpreplay-users >> Support Information: http://tcpreplay.synfin.net/trac/wiki/Support > > > ------------------------------------------------------------------------------ > EditLive Enterprise is the world's most technically advanced content > authoring tool. Experience the power of Track Changes, Inline Image > Editing and ensure content is compliant with Accessibility Checking. > http://p.sf.net/sfu/ephox-dev2dev > _______________________________________________ > Tcpreplay-users mailing list > Tcpreplay-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/tcpreplay-users > Support Information: http://tcpreplay.synfin.net/trac/wiki/Support > -- Aaron Turner http://synfin.net/ Twitter: @synfinatic http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix & Windows Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety. -- Benjamin Franklin "carpe diem quam minimum credula postero" ------------------------------------------------------------------------------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ Tcpreplay-users mailing list Tcpreplay-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tcpreplay-users Support Information: http://tcpreplay.synfin.net/trac/wiki/Support