mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 01:30:30 -04:00
Fix checksum calculations. This should fix the network problems
in current where all packets were returning with bad checksums. (observed with netstat -s). Reviewed by: alfred
This commit is contained in:
parent
88577b0806
commit
274254e1f1
2 changed files with 2 additions and 4 deletions
|
|
@ -69,7 +69,6 @@
|
|||
sum = l_util.s[0] + l_util.s[1]; \
|
||||
ADDCARRY(sum); \
|
||||
}
|
||||
#define INVERT sum == 0xffff ? sum : ~sum & 0xffff
|
||||
|
||||
static const u_int32_t in_masks[] = {
|
||||
/*0 bytes*/ /*1 byte*/ /*2 bytes*/ /*3 bytes*/
|
||||
|
|
@ -236,7 +235,7 @@ skip_start:
|
|||
len -= mlen;
|
||||
}
|
||||
REDUCE16;
|
||||
return (INVERT);
|
||||
return (~sum & 0xffff);
|
||||
}
|
||||
|
||||
u_int in_cksum_hdr(ip)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@
|
|||
#undef ADDCARRY
|
||||
#define ADDCARRY(x) if ((x) > 0xffff) (x) -= 0xffff
|
||||
#define REDUCE {sum = (sum & 0xffff) + (sum >> 16); ADDCARRY(sum);}
|
||||
#define INVERT sum == 0xffff ? sum : ~sum & 0xffff
|
||||
|
||||
/*
|
||||
* Thanks to gcc we don't have to guess
|
||||
|
|
@ -257,5 +256,5 @@ skip_start:
|
|||
sum += su.s;
|
||||
}
|
||||
REDUCE;
|
||||
return (INVERT);
|
||||
return (~sum & 0xffff);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue