Changeset effd683
- Timestamp:
- 11/25/09 20:05:14 (13 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
- Children:
- 58e2f74
- Parents:
- 93928b7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/tracereplay/tracereplay.c
r93928b7 reffd683 42 42 43 43 if(count > 0) { 44 sum += (*buff << 8);44 sum += *buff; 45 45 } 46 46 47 47 while (sum>>16) 48 48 sum = (sum & 0xffff) + (sum >> 16); 49 printf("%04X\n",sum); 49 50 50 return ~sum; 51 51 } … … 59 59 uint16_t protocol = ip->ip_p; 60 60 61 uint16_t temp; 62 63 sum += ~checksum(&ip->ip_src,sizeof(uint32_t)); 64 sum += ~checksum(&ip->ip_dst,sizeof(uint32_t)); 61 uint16_t temp = 0; 62 63 uint16_t * check = NULL; 64 uint16_t tsum = 0; 65 66 67 sum += ~checksum(&ip->ip_src.s_addr,sizeof(uint32_t)); 68 sum += ~checksum(&ip->ip_dst.s_addr,sizeof(uint32_t)); 69 65 70 temp = htons(protocol); 71 66 72 sum += ~checksum(&temp,sizeof(uint16_t)); 73 67 74 temp = htons(length); 68 75 sum += ~checksum(&temp,sizeof(uint16_t)); … … 73 80 void * transportheader = trace_get_payload_from_ip(ip,NULL,NULL); 74 81 75 uint16_t * check = NULL;76 uint16_t tsum = 0;77 82 78 83 printf("proto: %d\n",ip->ip_p); … … 85 90 printf("l3 payload length: %d\n",length); 86 91 tsum = checksum(transportheader, length); 87 int odd = 0;//length % 2;88 92 } 89 93 else if(protocol == 6) { … … 99 103 printf("tsum: %04X\n", tsum); 100 104 101 sum = ~tsum;105 sum += ~tsum; 102 106 103 107 while (sum>>16) … … 106 110 if(check != NULL) { 107 111 *check = (uint16_t)~sum; 108 } 109 112 printf("checksum: %04X\n",*check); 113 } 114 115 110 116 111 117 }
Note: See TracChangeset
for help on using the changeset viewer.