update tcp checksumming
This commit is contained in:
parent
26c27cefa8
commit
f0900c3821
2 changed files with 18 additions and 3 deletions
11
doc/plan.org
11
doc/plan.org
|
@ -5255,6 +5255,17 @@ we get on the wire:
|
||||||
|
|
||||||
sum 0x324a (incorrect -> 0x5429),
|
sum 0x324a (incorrect -> 0x5429),
|
||||||
|
|
||||||
|
Using
|
||||||
|
/* filtering code copied from scapy */
|
||||||
|
tmp = (tmp >> 16) + (tmp & 0xffff);
|
||||||
|
tmp = tmp + (tmp >> 16);
|
||||||
|
tmp = ~tmp;
|
||||||
|
meta.v6sum = (bit<16>) ((((tmp>>8) & 0xff)|tmp<<8) & 0xffff) ;
|
||||||
|
|
||||||
|
we get
|
||||||
|
|
||||||
|
sum 0x48ad (incorrect -> 0x85eb)
|
||||||
|
|
||||||
** The NetPFGA saga
|
** The NetPFGA saga
|
||||||
Problems encountered:
|
Problems encountered:
|
||||||
- The logfile for a compile run is 10k+ lines
|
- The logfile for a compile run is 10k+ lines
|
||||||
|
|
|
@ -73,14 +73,18 @@ action delta_udp_from_v4_to_v6()
|
||||||
|
|
||||||
action delta_tcp_from_v4_to_v6()
|
action delta_tcp_from_v4_to_v6()
|
||||||
{
|
{
|
||||||
delta_prepare();
|
v4sum();
|
||||||
hdr.tcp.checksum = hdr.tcp.checksum + meta.headerdiff;
|
v6sum();
|
||||||
|
|
||||||
|
/* here is also a possible overflow in both directions */
|
||||||
|
hdr.tcp.checksum = hdr.tcp.checksum + meta.v6sum - meta.v4sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
action delta_ipv4_from_v6_to_v4()
|
action delta_ipv4_from_v6_to_v4()
|
||||||
{
|
{
|
||||||
delta_prepare();
|
delta_prepare();
|
||||||
hdr.tcp.checksum = hdr.tcp.checksum + ~meta.headerdiff;
|
/* TO BE DONE! */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in a new issue