diff options
| author | 杨威 <[email protected]> | 2020-08-05 11:53:56 +0800 |
|---|---|---|
| committer | 杨威 <[email protected]> | 2020-08-05 11:53:56 +0800 |
| commit | 9fa3c0ae5bcdc5297a130843cff21c0926642819 (patch) | |
| tree | 4d012c8072f6a4061315c780c31092a515ed850d | |
| parent | 95f324d4deec6e27af2194d27e2c5985d55fc6b0 (diff) | |
| -rw-r--r-- | .gitignore | 21 | ||||
| -rw-r--r-- | src/tcpreplay.c | 81 |
2 files changed, 58 insertions, 44 deletions
@@ -4,3 +4,24 @@ tcpburst GPATH GRTAGS GTAGS +*.o +*.Po +*.a +Makefile +test/config +src/tcprewrite +src/tcpreplay-edit +src/tcpprep +src/tcpreplay +src/tcpbridge +src/stamp-h1 +src/defines.h +src/config.h +libopts/.libs/libopts.la +libopts/.deps/libopts_la-libopts.Plo +libopts/libopts.la +libopts/libopts_la-libopts.lo +libtool +doxygen.cfg +config.status +config.log diff --git a/src/tcpreplay.c b/src/tcpreplay.c index 000e631..c4e1c0e 100644 --- a/src/tcpreplay.c +++ b/src/tcpreplay.c @@ -1639,7 +1639,7 @@ static void *replay_files_thread(void *arg) marsio_thread_init(tcpburst_marsio4_instance); if(0 == loop){ - loop = 1; /* 至少一次 */ + while(1)replay_file(0); } for(i = 0; i < loop; i++){ replay_file(0); @@ -1748,50 +1748,43 @@ main(int argc, char *argv[]) if (gettimeofday(&begin, NULL) < 0) errx(-1, "gettimeofday() failed: %s", strerror(errno)); - /* main loop for non-bridge mode */ - if (options.loop > 0) { - while (options.loop--) { /* limited loop */ - /* process each pcap file in order */ - for (i = 0; i < argc; i++) { - /* reset cache markers for each iteration */ - cache_byte = 0; - cache_bit = 0; -#ifdef MARSIO - if(12 == send_pkt_driver_mode){ - pthread_t pid; - pthread_create(&pid, NULL, replay_files_thread, (void *)options.loop); - pthread_join(pid, NULL); - }else{ - replay_file(i); - } -#else - replay_file(i); -#endif - } - } - } - else { - /* loop forever */ - while (1) { - for (i = 0; i < argc; i++) { - /* reset cache markers for each iteration */ - cache_byte = 0; - cache_bit = 0; -#ifdef MARSIO - if(12 == send_pkt_driver_mode){ - pthread_t pid; - pthread_create(&pid, NULL, replay_files_thread, (void *)options.loop); - pthread_join(pid, NULL); - }else{ - replay_file(i); - } -#else - replay_file(i); -#endif - } - } - } + if (12 == send_pkt_driver_mode) + { +#ifdef MARSIO + pthread_t pid; + pthread_create(&pid, NULL, replay_files_thread, (void *)options.loop); + pthread_join(pid, NULL); +#else + errx(-1, "send_pkt_driver_mode == %s, but tcp_burst did not compiled with %s", "MARSIO", "MARSIO"); +#endif + } + else + { + /* main loop for non-bridge mode */ + if (options.loop > 0) { + while (options.loop--) { /* limited loop */ + /* process each pcap file in order */ + for (i = 0; i < argc; i++) { + /* reset cache markers for each iteration */ + cache_byte = 0; + cache_bit = 0; + replay_file(i); + } + } + } + else { + /* loop forever */ + while (1) { + for (i = 0; i < argc; i++) { + /* reset cache markers for each iteration */ + cache_byte = 0; + cache_bit = 0; + replay_file(i); + } + } + } + } if (bytes_sent > 0) { if (gettimeofday(&end, NULL) < 0) errx(-1, "Unable to gettimeofday(): %s", strerror(errno)); |
