remove old tcp checksum code

This commit is contained in:
Steffen Vogel 2017-12-20 10:26:54 +01:00
parent a47f5c74a8
commit 80a45f4fff
4 changed files with 1 additions and 35 deletions

View file

@ -12,7 +12,6 @@ add_executable(netem main.c
utils.c
ts.c
tc.c
tcp.c
dist.c
dist-maketable.c
)

View file

@ -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;

18
tcp.c
View file

@ -1,18 +0,0 @@
/** Userspace TCP functions.
*
* @author Steffen Vogel <post@steffenvogel.de>
* @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);
}

14
tcp.h
View file

@ -1,14 +0,0 @@
/** Userspace TCP functions.
*
* @author Steffen Vogel <post@steffenvogel.de>
* @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