/* -*- P4_16 -*- */ #ifndef CHECKSUMS_P4 #define CHECKSUMS_P4 #include #include #include "headers.p4" /************************************************************************* ************* C H E C K S U M V E R I F I C A T I O N ************* *************************************************************************/ control MyVerifyChecksum(inout headers hdr, inout metadata meta) { apply {} } /************************************************************************* ************** C H E C K S U M C O M P U T A T I O N ************** *************************************************************************/ control MyComputeChecksum(inout headers hdr, inout metadata meta) { apply { if(meta.calc_icmp6_checksum) { hdr.icmp6.checksum = 42; /* must be correct */ } // verify_checksum_with_payload(in bool condition, in T data, inout O checksum, HashAlgorithm algo); // GRRRRR bit<32> icmp6_len = 32; /* for icmp6 NS */ // GRRRRR update_checksum ( // GRRRRR hdr.icmp6.isValid(), // GRRRRR { // GRRRRR hdr.ipv6.src_addr, /* 128 */ // GRRRRR hdr.ipv6.dst_addr, /* 128 */ // GRRRRR icmp6_len, /* 32 */ // GRRRRR 24w0, /* 24 0's */ // GRRRRR PROTO_ICMP6 /* 8 */ // GRRRRR }, // GRRRRR hdr.icmp6.checksum, // GRRRRR HashAlgorithm.csum16 // GRRRRR ); } } #endif