Trigger ipv4 checksumming after nat64 translation
This commit is contained in:
parent
989ebfae0f
commit
74e4e7034b
4 changed files with 31 additions and 2 deletions
|
|
@ -69,6 +69,24 @@ control MyComputeChecksum(inout headers hdr, inout metadata meta) {
|
|||
hdr.icmp.checksum,
|
||||
HashAlgorithm.csum16
|
||||
);
|
||||
|
||||
update_checksum(meta.chk_ipv4 == 1,
|
||||
{
|
||||
hdr.ipv4.version,
|
||||
hdr.ipv4.ihl,
|
||||
hdr.ipv4.dscp,
|
||||
hdr.ipv4.ecn,
|
||||
hdr.ipv4.totalLen,
|
||||
hdr.ipv4.identification,
|
||||
hdr.ipv4.flags,
|
||||
hdr.ipv4.fragOffset,
|
||||
hdr.ipv4.ttl,
|
||||
hdr.ipv4.protocol,
|
||||
hdr.ipv4.srcAddr,
|
||||
hdr.ipv4.dstAddr
|
||||
},
|
||||
hdr.ipv4.hdrChecksum,
|
||||
HashAlgorithm.csum16);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -211,6 +211,7 @@ struct metadata {
|
|||
bit<1> chk_icmp6_na_ns;
|
||||
bit<1> chk_icmp6;
|
||||
bit<1> chk_icmp;
|
||||
bit<1> chk_ipv4;
|
||||
|
||||
bit<16> tcp_length;
|
||||
bit<32> cast_length;
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ control MyIngress(inout headers hdr,
|
|||
/* NAT64 protocol unspecific changes */
|
||||
action nat64_generic(ipv4_addr_t src, ipv4_addr_t dst) {
|
||||
hdr.ipv4.setValid();
|
||||
meta.chk_ipv4 = 1; /* need to calculate the hdrchecksum */
|
||||
|
||||
/* Stuff that might need to be fixed */
|
||||
hdr.ipv4.version = (bit<4>)4;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue