X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/3b2aece7c57ea8e7bac74373fc2bfee3852199a7..9980203b66c51ddaaa10ab6fa58bb2aff92828a2:/test/generateload.c?ds=sidebyside diff --git a/test/generateload.c b/test/generateload.c index c3a40b6..a58d5f2 100644 --- a/test/generateload.c +++ b/test/generateload.c @@ -231,8 +231,6 @@ void sigint(int signal); void clean_shutdown(); void print_report(); -pthread_t pthread_reader; - int ns = 0, nr = 0; int udpfd; int t = 0; @@ -647,14 +645,14 @@ __u16 checksum(unsigned char *addr, int count) for (; count > 1; count -= 2) { - sum += ntohs(*(u32 *)addr); + sum += ntohs(*(u16 *)addr); addr += 2; } - if (count > 1) sum += *(unsigned char *)addr; + if (count > 0) sum += *(unsigned char *)addr; // take only 16 bits out of the 32 bit sum and add up the carries - while (sum >> 16) + if (sum >> 16) sum = (sum & 0xFFFF) + (sum >> 16); // one's complement the result