Changeset 846 for trunk/tools/traceanon/traceanon.c
- Timestamp:
- 06/01/06 14:28:00 (7 years ago)
- File:
-
- 1 edited
-
trunk/tools/traceanon/traceanon.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/traceanon/traceanon.c
r838 r846 44 44 /* Ok this is remarkably complicated 45 45 * 46 * We want to change one, or the other IP address, while preserving the47 * checksum. TCP and UDP both include the faux header in their checksum48 * c alculations, so you have to update them too. ICMP is even worse --49 * it can include the original IP packet that caused the error! So anonymise50 * that too, but remember that it's travelling in the opposite direction so51 * we need to encrypt the destination and source instead of the sourceand52 * destination!46 * We want to change one, or the other IP address, while preserving 47 * the checksum. TCP and UDP both include the faux header in their 48 * checksum calculations, so you have to update them too. ICMP is 49 * even worse -- it can include the original IP packet that caused the 50 * error! So anonymise that too, but remember that it's travelling in 51 * the opposite direction so we need to encrypt the destination and 52 * source instead of the source and destination! 53 53 */ 54 54 void encrypt_ips(struct libtrace_ip *ip,bool enc_source,bool enc_dest) … … 85 85 86 86 if (icmp) { 87 /* These are error codes that return the IP packet internally */ 88 if (icmp->type == 3 || icmp->type == 5 || icmp->type == 11) { 87 /* These are error codes that return the IP packet 88 * internally 89 */ 90 if (icmp->type == 3 91 || icmp->type == 5 92 || icmp->type == 11) { 89 93 encrypt_ips( 90 (struct libtrace_ip*)icmp+91 sizeof(struct libtrace_icmp),92 enc_dest,93 enc_source);94 (struct libtrace_ip*)icmp+ 95 sizeof(struct libtrace_icmp), 96 enc_dest, 97 enc_source); 94 98 } 95 99 } … … 162 166 return 1; 163 167 } 164 165 if (optind == argc) { 166 /* no output specified, output in same format to stdout */ 168 169 if (optind +1>= argc) { 170 /* no output specified, output in same format to 171 * stdout 172 */ 167 173 asprintf(&output,"%s:-","erf"); 168 174 writer = trace_create_output(output); … … 179 185 if (trace_start(trace)==-1) { 180 186 trace_perror(trace,"trace_start"); 187 return 1; 181 188 } 182 189 if (trace_start_output(writer)==-1) {
Note: See TracChangeset
for help on using the changeset viewer.
