Changeset bab946c for tools/traceanon/traceanon.cc
- Timestamp:
- 01/15/19 16:47:20 (2 years ago)
- Branches:
- develop
- Children:
- e9fe6ac
- Parents:
- edd0448
- File:
-
- 1 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 }
Note: See TracChangeset
for help on using the changeset viewer.