X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/4ef684093db97124d3c3d57b855fc844d02a379b..59c8969854a8dee33006af0eca98fa5135492801:/test/generateload.c diff --git a/test/generateload.c b/test/generateload.c index c3a40b6..0b32199 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; @@ -286,7 +284,7 @@ int main(int argc, char *argv[]) break; case 'm' : max_packets = atoi(optarg); - if (packet_length < 64) + if (max_packets < 50) { printf("You must send at least 50 packets.\n"); return -1; @@ -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 @@ -1025,9 +1023,9 @@ void reader_thread(int updfd)/*{{{*/ controlfree(r); break; case CONFNAK : - // Ack whatever address we are given - it's ours - r = ppp_ipcp(s, CONFACK, time(NULL) % 255); - ppp_lcp_add_option(r, 3, 4, address); // Request 0.0.0.0 + // Request whatever address we are given - it's ours + r = ppp_ipcp(s, CONFREQ, time(NULL) % 255); + ppp_lcp_add_option(r, 3, 4, address); ppp_send(r); controlfree(r); printf("Session %d: %s\n", s, inet_toa(address));