[p4] icmp6 hard code length

This commit is contained in:
Nico Schottelius 2019-02-28 11:09:45 +01:00
parent 1f497982b3
commit b3e51d550a

View file

@ -21,14 +21,15 @@ control MyVerifyChecksum(inout headers hdr, inout metadata meta) {
control MyComputeChecksum(inout headers hdr, inout metadata meta) { control MyComputeChecksum(inout headers hdr, inout metadata meta) {
apply { apply {
bit<32> cksum = (bit<32>) hdr.ipv6.payload_length;
bit<32> icmp6_len = 1; /* for icmp6 NS */
update_checksum ( update_checksum (
hdr.icmp6.isValid(), hdr.icmp6.isValid(),
{ {
hdr.ipv6.src_addr, /* 128 */ hdr.ipv6.src_addr, /* 128 */
hdr.ipv6.dst_addr, /* 128 */ hdr.ipv6.dst_addr, /* 128 */
cksum, /* 32 */ icmp6_len, /* 32 */
24w0, /* 24 0's */ 24w0, /* 24 0's */
PROTO_ICMP6 /* 8 */ PROTO_ICMP6 /* 8 */
}, },