Setup the cast_length in icmp->icmp6 translations

This commit is contained in:
Nico Schottelius 2019-04-03 12:44:00 +02:00
parent c465e5719b
commit 71d1e86d3f
2 changed files with 4 additions and 0 deletions

View file

@ -738,6 +738,7 @@ Entry has been added with handle 0
******* DONE Make switch respond to ARP
******* DONE Make switch respond to icmp echo request w/ correct checksum (2019-04-03)
******* TODO Correct icmp6 checksum
******** DONE Checksum is SET, but not correct!
**** TODO Add / check default route for v4 hosts
**** TODO Update p4c to avoid compiler bug
***** TODO Updating p4c

View file

@ -167,6 +167,7 @@ Echo or Echo Reply Message
hdr.ipv6.next_header = PROTO_ICMP6;
meta.chk_icmp6 = 1;
meta.cast_length = (bit<32>) hdr.ipv6.payload_length;
hdr.icmp.setInvalid();
}
@ -437,9 +438,11 @@ Echo or Echo Reply Message
if(hdr.icmp6.type == ICMP6_ECHO_REPLY) {
hdr.icmp.type = ICMP_ECHO_REPLY;
hdr.icmp.code = 0;
}
if(hdr.icmp6.type == ICMP6_ECHO_REQUEST) {
hdr.icmp.type = ICMP_ECHO_REQUEST;
hdr.icmp.code = 0;
}
}