diff --git a/CMakeLists.txt b/CMakeLists.txt index f025bb6..eb18c97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,6 @@ add_executable(netem main.c utils.c ts.c tc.c - tcp.c dist.c dist-maketable.c ) diff --git a/probe.c b/probe.c index 7dcda3c..798c25a 100644 --- a/probe.c +++ b/probe.c @@ -33,7 +33,6 @@ #include "ts.h" #include "timing.h" #include "config.h" -#include "tcp.h" #include "utils.h" #include "hist.h" @@ -65,7 +64,7 @@ int probe_tcp(int sd, unsigned short dport, struct timespec *ts) thdr.source = htons(sport); thdr.dest = htons(dport); thdr.doff = 5; - thdr.check = tcp_csum((unsigned short *) &thdr, sizeof(thdr)); + thdr.check = chksum_rfc1071((unsigned short *) &thdr, sizeof(thdr)); msgh.msg_iov = &iov[1]; // only send TCP header msgh.msg_iovlen = 1; diff --git a/tcp.c b/tcp.c deleted file mode 100644 index 6f1dbec..0000000 --- a/tcp.c +++ /dev/null @@ -1,18 +0,0 @@ -/** Userspace TCP functions. - * - * @author Steffen Vogel - * @copyright 2014-2017, Steffen Vogel - * @license GPLv3 - *********************************************************************************/ - -unsigned short tcp_csum(unsigned short *buf, int len) -{ - unsigned long sum; - - for(sum=0; len>0; len--) - sum += *buf++; - sum = (sum >> 16) + (sum &0xffff); - sum += (sum >> 16); - - return (unsigned short)(~sum); -} \ No newline at end of file diff --git a/tcp.h b/tcp.h deleted file mode 100644 index 6a9ed31..0000000 --- a/tcp.h +++ /dev/null @@ -1,14 +0,0 @@ -/** Userspace TCP functions. - * - * @author Steffen Vogel - * @copyright 2014-2017, Steffen Vogel - * @license GPLv3 - *********************************************************************************/ - -#ifndef _TCP_H_ -#define _TCP_H_ - -/** Simple checksum function, may use others such as Cyclic Redundancy Check, CRC */ -unsigned short tcp_csum(unsigned short *buf, int len); - -#endif \ No newline at end of file