remove old tcp checksum code
This commit is contained in:
parent
a47f5c74a8
commit
80a45f4fff
4 changed files with 1 additions and 35 deletions
|
@ -12,7 +12,6 @@ add_executable(netem main.c
|
|||
utils.c
|
||||
ts.c
|
||||
tc.c
|
||||
tcp.c
|
||||
dist.c
|
||||
dist-maketable.c
|
||||
)
|
||||
|
|
3
probe.c
3
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;
|
||||
|
|
18
tcp.c
18
tcp.c
|
@ -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
14
tcp.h
|
@ -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
|
Loading…
Add table
Reference in a new issue