Changeset bab946c
- Timestamp:
- 01/15/19 16:47:20 (2 years ago)
- Branches:
- develop
- Children:
- e9fe6ac
- Parents:
- edd0448
- Location:
- tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/traceanon/traceanon.cc
r8e11beb rbab946c 46 46 }; 47 47 48 bool enc_source = false;49 bool enc_dest 48 bool enc_source_opt = false; 49 bool enc_dest_opt = false; 50 50 enum enc_type_t enc_type = ENC_NONE; 51 51 char *key = NULL; … … 54 54 trace_option_compresstype_t compress_type = TRACE_OPTION_COMPRESSTYPE_NONE; 55 55 56 struct libtrace_t * trace = NULL;56 struct libtrace_t *inptrace = NULL; 57 57 58 58 static void cleanup_signal(int signal) … … 60 60 (void)signal; 61 61 // trace_pstop isn't really signal safe because its got lots of locks in it 62 trace_pstop( trace);62 trace_pstop(inptrace); 63 63 } 64 64 … … 182 182 ip6 = trace_get_ip6(packet); 183 183 184 if (ipptr && (enc_source || enc_dest)) {185 encrypt_ips(anon, ipptr,enc_source ,enc_dest);184 if (ipptr && (enc_source_opt || enc_dest_opt)) { 185 encrypt_ips(anon, ipptr,enc_source_opt,enc_dest_opt); 186 186 ipptr->ip_sum = 0; 187 } else if (ip6 && (enc_source || enc_dest)) {188 encrypt_ipv6(anon, ip6, enc_source , enc_dest);187 } else if (ip6 && (enc_source_opt || enc_dest_opt)) { 188 encrypt_ipv6(anon, ip6, enc_source_opt, enc_dest_opt); 189 189 } 190 190 … … 197 197 198 198 udp = trace_get_udp(packet); 199 if (udp && (enc_source || enc_dest)) {199 if (udp && (enc_source_opt || enc_dest_opt)) { 200 200 udp->check = 0; 201 201 } 202 202 203 203 tcp = trace_get_tcp(packet); 204 if (tcp && (enc_source || enc_dest)) {204 if (tcp && (enc_source_opt || enc_dest_opt)) { 205 205 tcp->check = 0; 206 206 } 207 207 208 208 icmp6 = trace_get_icmp6(packet); 209 if (icmp6 && (enc_source || enc_dest)) {209 if (icmp6 && (enc_source_opt || enc_dest_opt)) { 210 210 icmp6->checksum = 0; 211 211 } … … 357 357 case 'Z': compress_type_str=optarg; break; 358 358 case 'z': level = atoi(optarg); break; 359 case 's': enc_source =true; break;360 case 'd': enc_dest =true; break;359 case 's': enc_source_opt=true; break; 360 case 'd': enc_dest_opt =true; break; 361 361 case 'c': 362 362 if (key!=NULL) { … … 442 442 443 443 /* open input uri */ 444 trace = trace_create(argv[optind]);445 if (trace_is_err( trace)) {446 trace_perror( trace,"trace_create");444 inptrace = trace_create(argv[optind]); 445 if (trace_is_err(inptrace)) { 446 trace_perror(inptrace,"trace_create"); 447 447 exitcode = 1; 448 448 goto exitanon; … … 463 463 * special case to have. 464 464 */ 465 trace_set_combiner( trace, &combiner_ordered, (libtrace_generic_t){0});465 trace_set_combiner(inptrace, &combiner_ordered, (libtrace_generic_t){0}); 466 466 467 467 pktcbs = trace_create_callback_set(); … … 475 475 trace_set_starting_cb(repcbs, init_output); 476 476 477 trace_set_perpkt_threads( trace, maxthreads);477 trace_set_perpkt_threads(inptrace, maxthreads); 478 478 479 479 if (filterstring) { … … 481 481 } 482 482 483 if (filter && trace_config( trace, TRACE_OPTION_FILTER, filter) == -1)483 if (filter && trace_config(inptrace, TRACE_OPTION_FILTER, filter) == -1) 484 484 { 485 trace_perror( trace, "Configuring input filter");485 trace_perror(inptrace, "Configuring input filter"); 486 486 exitcode = 1; 487 487 goto exitanon; 488 488 } 489 489 490 if (trace_pstart( trace, output, pktcbs, repcbs)==-1) {491 trace_perror( trace,"trace_start");490 if (trace_pstart(inptrace, output, pktcbs, repcbs)==-1) { 491 trace_perror(inptrace,"trace_start"); 492 492 exitcode = 1; 493 493 goto exitanon; … … 502 502 503 503 // Wait for the trace to finish 504 trace_join( trace);504 trace_join(inptrace); 505 505 506 506 exitanon: … … 509 509 if (repcbs) 510 510 trace_destroy_callback_set(repcbs); 511 if ( trace)512 trace_destroy( trace);511 if (inptrace) 512 trace_destroy(inptrace); 513 513 return exitcode; 514 514 } -
tools/tracertstats/tracertstats.c
r1800ee3 rbab946c 80 80 struct output_data_t *output = NULL; 81 81 82 uint64_t count;83 uint64_t bytes;82 uint64_t totalcount; 83 uint64_t totalbytes; 84 84 85 85 struct libtrace_t *currenttrace; … … 178 178 } 179 179 while ((glob_last_ts >> 32) < (ts >> 32)) { 180 report_results(glob_last_ts >> 32, count, bytes, stats); 181 count = 0; 182 bytes = 0; 180 report_results(glob_last_ts >> 32, totalcount, totalbytes, 181 stats); 182 totalcount = 0; 183 totalbytes = 0; 183 184 for (j = 0; j < filter_count; j++) 184 185 filters[j].count = filters[j].bytes = 0; 185 186 glob_last_ts = ts; 186 187 } 187 count += res->total.count;188 totalcount += res->total.count; 188 189 packets_seen += res->total.count; 189 bytes += res->total.bytes;190 totalbytes += res->total.bytes; 190 191 for (j = 0; j < filter_count; j++) { 191 192 filters[j].count += res->filters[j].count; … … 344 345 stats = trace_get_statistics(trace, stats); 345 346 } 346 report_results((glob_last_ts >> 32), count,bytes, stats);347 report_results((glob_last_ts >> 32), totalcount, totalbytes, stats); 347 348 if (trace_is_err(trace)) 348 349 trace_perror(trace,"%s",uri); -
tools/tracesplit/tracesplit.c
r4c5bbfc rbab946c 52 52 uint64_t filescreated = 0; 53 53 uint16_t snaplen = 0; 54 int jump =0;54 int jumpopt=0; 55 55 int verbose=0; 56 56 int compress_level=-1; … … 324 324 325 325 /* Support "jump"ping to the nth IP header. */ 326 if (jump ) {326 if (jumpopt) { 327 327 /* Skip headers */ 328 struct libtrace_packet_t *newpacket = perform_jump(*packet, jump );328 struct libtrace_packet_t *newpacket = perform_jump(*packet, jumpopt); 329 329 if (newpacket) { 330 330 /* If an IP header was found on the nth layer down … … 404 404 case 'i': interval=atoi(optarg); 405 405 break; 406 case 'j': jump =atoi(optarg);406 case 'j': jumpopt=atoi(optarg); 407 407 break; 408 408 case 'm': maxfiles=atoi(optarg); -
tools/tracestats/tracestats.c
r02d13cb rbab946c 54 54 #include <pthread.h> 55 55 56 struct libtrace_t * trace = NULL;56 struct libtrace_t *inptrace = NULL; 57 57 58 58 static void cleanup_signal(int signal UNUSED) 59 59 { 60 if ( trace)61 trace_pstop( trace);60 if (inptrace) 61 trace_pstop(inptrace); 62 62 } 63 63 … … 196 196 libtrace_callback_set_t *pktcbs, *rescbs; 197 197 198 trace = trace_create(uri);199 200 if (trace_is_err( trace)) {201 trace_perror( trace,"Failed to create trace");198 inptrace = trace_create(uri); 199 200 if (trace_is_err(inptrace)) { 201 trace_perror(inptrace,"Failed to create trace"); 202 202 return; 203 203 } … … 214 214 215 215 if (threadcount != 0) 216 trace_set_perpkt_threads( trace, threadcount);216 trace_set_perpkt_threads(inptrace, threadcount); 217 217 218 218 /* Start the trace as a parallel trace */ 219 if (trace_pstart( trace, NULL, pktcbs, rescbs)==-1) {220 trace_perror( trace,"Failed to start trace");219 if (trace_pstart(inptrace, NULL, pktcbs, rescbs)==-1) { 220 trace_perror(inptrace,"Failed to start trace"); 221 221 return; 222 222 } 223 223 224 224 /* Wait for all threads to stop */ 225 trace_join( trace);226 227 if (trace_is_err( trace))228 trace_perror( trace,"%s",uri);229 230 trace_destroy( trace);225 trace_join(inptrace); 226 227 if (trace_is_err(inptrace)) 228 trace_perror(inptrace,"%s",uri); 229 230 trace_destroy(inptrace); 231 231 trace_destroy_callback_set(pktcbs); 232 232 trace_destroy_callback_set(rescbs);
Note: See TracChangeset
for help on using the changeset viewer.