Changeset effd683 for tools


Ignore:
Timestamp:
11/25/09 20:05:14 (12 years ago)
Author:
Andreas Löf <andreas.lof@…>
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
Message:

still b0rken, was a missing '+'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/tracereplay/tracereplay.c

    r93928b7 reffd683  
    4242
    4343  if(count > 0) {
    44     sum += (*buff << 8);
     44    sum += *buff;
    4545  }
    4646 
    4747  while (sum>>16)
    4848    sum = (sum & 0xffff) + (sum >> 16);
    49   printf("%04X\n",sum);
     49
    5050  return ~sum;
    5151}
     
    5959  uint16_t protocol = ip->ip_p;
    6060
    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
    6570  temp = htons(protocol);
     71
    6672  sum += ~checksum(&temp,sizeof(uint16_t));
     73
    6774  temp = htons(length);
    6875  sum += ~checksum(&temp,sizeof(uint16_t));
     
    7380  void * transportheader = trace_get_payload_from_ip(ip,NULL,NULL);
    7481
    75   uint16_t * check = NULL;
    76   uint16_t tsum = 0;
    7782
    7883  printf("proto: %d\n",ip->ip_p);
     
    8590    printf("l3 payload length: %d\n",length); 
    8691    tsum = checksum(transportheader, length);
    87     int odd = 0;//length % 2;
    8892  }
    8993  else if(protocol == 6) {
     
    99103  printf("tsum: %04X\n", tsum);
    100104
    101   sum = ~tsum;
     105  sum += ~tsum;
    102106
    103107  while (sum>>16)
     
    106110  if(check != NULL) {
    107111    *check = (uint16_t)~sum;
    108   }
    109  
     112    printf("checksum: %04X\n",*check);
     113  }
     114 
     115
    110116
    111117}
Note: See TracChangeset for help on using the changeset viewer.