Begin checksumming icmp4
This commit is contained in:
parent
7c93952c53
commit
404d4ff0df
4 changed files with 33 additions and 5 deletions
|
|
@ -60,6 +60,14 @@ control MyComputeChecksum(inout headers hdr, inout metadata meta) {
|
|||
HashAlgorithm.csum16
|
||||
);
|
||||
|
||||
update_checksum_with_payload(meta.switch_task == TASK_CHECKSUM_ICMP,
|
||||
{
|
||||
hdr.icmp.type,
|
||||
hdr.icmp.code
|
||||
},
|
||||
hdr.icmp.checksum,
|
||||
HashAlgorithm.csum16
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,10 @@ const bit<8> ICMP6_ECHO_REPLY = 129;
|
|||
const bit<8> ICMP6_NS = 135;
|
||||
const bit<8> ICMP6_NA = 136;
|
||||
|
||||
const bit<8> ICMP_ECHO_REPLY = 0;
|
||||
const bit<8> ICMP_ECHO_REQUEST = 8;
|
||||
|
||||
|
||||
/* RFC4861, Section 4.6 */
|
||||
const bit<8> ICMP6_NDP_OPT_SOURCE_LL = 1;
|
||||
const bit<8> ICMP6_NDP_OPT_TARGET_LL = 2;
|
||||
|
|
@ -52,6 +56,7 @@ const task_t TASK_DEBUG = 3;
|
|||
const task_t TASK_ICMP6_REPLY = 4;
|
||||
const task_t TASK_CHECKSUM_ICMP6 = 5; /* data plane */
|
||||
const task_t TASK_CHECKSUM_ICMP6_NA = 6; /* data plane */
|
||||
const task_t TASK_CHECKSUM_ICMP = 7; /* data plane */
|
||||
|
||||
|
||||
/* 48+48+16 = 112 */
|
||||
|
|
@ -147,7 +152,6 @@ header icmp_t {
|
|||
bit<8> type;
|
||||
bit<8> code;
|
||||
bit<16> checksum;
|
||||
bit<32> rest;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,22 @@ control MyIngress(inout headers hdr,
|
|||
*/
|
||||
action nat64_icmp6()
|
||||
{
|
||||
hdr.icmp.setValid();
|
||||
hdr.ipv4.protocol = PROTO_ICMP; // overwrite generic same protocol assumption
|
||||
|
||||
switch(hdr.icmp6.type) {
|
||||
ICMP6_ECHO_REQUEST: hdr.icmp.type = ICMP_ECHO_REQUEST;
|
||||
ICMP6_ECHO_REPLY: hdr.icmp.type = ICMP_ECHO_REPLY;
|
||||
}
|
||||
|
||||
/* trigger checksumming */
|
||||
meta.switch_task = TASK_CHECKSUM_ICMP;
|
||||
|
||||
hdr.icmp6.setInvalid();
|
||||
|
||||
/* not needed, as we don't translate them (yet/ever) */
|
||||
hdr.icmp6_na_ns.setInvalid();
|
||||
hdr.icmp6_option_link_layer_addr.setInvalid();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -120,8 +135,6 @@ control MyIngress(inout headers hdr,
|
|||
|
||||
nat64_generic(src, dst);
|
||||
|
||||
/* fix the protocol specific translations */
|
||||
// switch() ...
|
||||
}
|
||||
|
||||
/* matching key: v4_network specified again */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue