[p4] begin icmp6 checksum
This commit is contained in:
parent
c38eb0dfc4
commit
a5c8be40be
2 changed files with 36 additions and 31 deletions
|
|
@ -21,38 +21,17 @@ control MyVerifyChecksum(inout headers hdr, inout metadata meta) {
|
|||
|
||||
control MyComputeChecksum(inout headers hdr, inout metadata meta) {
|
||||
apply {
|
||||
/* 512 bit+ according to
|
||||
https://en.wikipedia.org/wiki/Transmission_Control_Protocol#TCP_checksum_for_IPv4
|
||||
*/
|
||||
update_checksum_with_payload(
|
||||
hdr.ipv6.isValid(),
|
||||
update_checksum (
|
||||
hdr.icmp6.isValid(),
|
||||
{
|
||||
hdr.ipv6.src_addr, /* 128 */
|
||||
hdr.ipv6.dst_addr, /* 128 */
|
||||
meta.tcpLength,
|
||||
24w0,
|
||||
hdr.ipv6.next_header,
|
||||
// TCP header
|
||||
hdr.tcp.src_port,
|
||||
hdr.tcp.dst_port,
|
||||
hdr.tcp.seqNo,
|
||||
hdr.tcp.ackNo,
|
||||
hdr.tcp.data_offset,
|
||||
hdr.tcp.res,
|
||||
hdr.tcp.cwr,
|
||||
hdr.tcp.ece,
|
||||
hdr.tcp.urg,
|
||||
hdr.tcp.ack,
|
||||
hdr.tcp.psh,
|
||||
hdr.tcp.rst,
|
||||
hdr.tcp.syn,
|
||||
hdr.tcp.fin,
|
||||
hdr.tcp.window,
|
||||
hdr.tcp.urgentPtr
|
||||
},
|
||||
hdr.tcp.checksum,
|
||||
HashAlgorithm.csum16);
|
||||
|
||||
hdr.ipv6.src_addr, /* 128 */
|
||||
hdr.ipv6.dst_addr, /* 128 */
|
||||
hdr.ipv6.payload_length, /* 16 -> should be 32 according to RFC2460 - also static number? */
|
||||
24w0, /* 24 0's */
|
||||
PROTO_ICMP6 /* 8 */
|
||||
}
|
||||
hdr.icmp6.checksum,
|
||||
HashAlgorithm.csum16);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue