diff --git a/.gitignore b/.gitignore index e111edb..5ba55dd 100644 --- a/.gitignore +++ b/.gitignore @@ -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));