off by one for delta checksums

This commit is contained in:
Nico Schottelius 2019-07-10 21:26:09 +02:00
parent 860db6c013
commit 0b7f0347d4

View file

@ -197,14 +197,24 @@ control MyIngress(inout headers hdr,
v4sum();
v6sum();
bit<16> diff = meta.v6sum - meta.v4sum;
hdr.udp.checksum = hdr.udp.checksum + ~diff;
hdr.udp.checksum = hdr.udp.checksum + ~diff +1;
// hdr.udp.checksum = ~diff;
#else
meta.chk_udp_v6 = 1;
#endif
}
if(hdr.tcp.isValid()) {
#ifdef USE_NICO_DELTA_CHECKSUM
v4sum();
v6sum();
bit<16> diff = meta.v6sum - meta.v4sum;
hdr.tcp.checksum = hdr.tcp.checksum + ~diff;
#else
meta.chk_tcp_v6 = 1;
#endif
}
v6_networks.apply();