Add the complement diff

This commit is contained in:
Nico Schottelius 2019-07-10 15:28:59 +02:00
parent 80803c5546
commit 8ac508162a

View file

@ -197,8 +197,7 @@ control MyIngress(inout headers hdr,
v4sum(); v4sum();
v6sum(); v6sum();
bit<16> diff = meta.v6sum - meta.v4sum; bit<16> diff = meta.v6sum - meta.v4sum;
# hdr.udp.checksum = hdr.udp.checksum + diff; hdr.udp.checksum = hdr.udp.checksum + ~diff;
hdr.udp.checksum = ~diff;
#else #else
meta.chk_udp_v6 = 1; meta.chk_udp_v6 = 1;