Begin checksumming icmp4
This commit is contained in:
parent
7c93952c53
commit
404d4ff0df
4 changed files with 33 additions and 5 deletions
|
@ -479,8 +479,10 @@ INFO:main:unhandled reassambled=<Ether dst=00:00:0a:00:00:42 src=00:00:0a:00:00
|
||||||
***** DONE source correctly translated to 10.1.1.1
|
***** DONE source correctly translated to 10.1.1.1
|
||||||
***** DONE destination correctly translated to 10.0.0.1 -> pings h3
|
***** DONE destination correctly translated to 10.0.0.1 -> pings h3
|
||||||
***** DONE egress is correct, comes out at h3
|
***** DONE egress is correct, comes out at h3
|
||||||
***** TODO protocol 58 is wrong -> should be 1
|
***** DONE protocol 58 is wrong -> should be 1
|
||||||
**** TODO transform protocol specific: icmp6 -> icmp
|
***** DONE figure out switch() syntax
|
||||||
|
***** TODO Calculate ICMP checksum
|
||||||
|
***** TODO transform protocol specific: icmp6 -> icmp
|
||||||
**** TODO transform protocol specific: icmp -> icmp6
|
**** TODO transform protocol specific: icmp -> icmp6
|
||||||
**** TODO Make switch answer IPv4 icmp echo request for
|
**** TODO Make switch answer IPv4 icmp echo request for
|
||||||
**** TODO Add / check default route for v4 hosts
|
**** TODO Add / check default route for v4 hosts
|
||||||
|
@ -1402,6 +1404,7 @@ Only the destination network is matched for deciding on NAT64, as
|
||||||
priority based double LPM is not supported. This limits a prefix to be
|
priority based double LPM is not supported. This limits a prefix to be
|
||||||
used only in one network.
|
used only in one network.
|
||||||
*** References / Follow up
|
*** References / Follow up
|
||||||
|
**** RFC 1017 ICMP checksum https://tools.ietf.org/html/rfc1071
|
||||||
**** RFC 2460 IPv6 (Checksum https://tools.ietf.org/html/rfc2460#section-8.1)
|
**** RFC 2460 IPv6 (Checksum https://tools.ietf.org/html/rfc2460#section-8.1)
|
||||||
**** RFC 3810 MLD2 https://tools.ietf.org/html/rfc3810
|
**** RFC 3810 MLD2 https://tools.ietf.org/html/rfc3810
|
||||||
**** RFC 4443 ICMPv6 https://tools.ietf.org/html/rfc4443
|
**** RFC 4443 ICMPv6 https://tools.ietf.org/html/rfc4443
|
||||||
|
|
|
@ -60,6 +60,14 @@ control MyComputeChecksum(inout headers hdr, inout metadata meta) {
|
||||||
HashAlgorithm.csum16
|
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_NS = 135;
|
||||||
const bit<8> ICMP6_NA = 136;
|
const bit<8> ICMP6_NA = 136;
|
||||||
|
|
||||||
|
const bit<8> ICMP_ECHO_REPLY = 0;
|
||||||
|
const bit<8> ICMP_ECHO_REQUEST = 8;
|
||||||
|
|
||||||
|
|
||||||
/* RFC4861, Section 4.6 */
|
/* RFC4861, Section 4.6 */
|
||||||
const bit<8> ICMP6_NDP_OPT_SOURCE_LL = 1;
|
const bit<8> ICMP6_NDP_OPT_SOURCE_LL = 1;
|
||||||
const bit<8> ICMP6_NDP_OPT_TARGET_LL = 2;
|
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_ICMP6_REPLY = 4;
|
||||||
const task_t TASK_CHECKSUM_ICMP6 = 5; /* data plane */
|
const task_t TASK_CHECKSUM_ICMP6 = 5; /* data plane */
|
||||||
const task_t TASK_CHECKSUM_ICMP6_NA = 6; /* 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 */
|
/* 48+48+16 = 112 */
|
||||||
|
@ -147,7 +152,6 @@ header icmp_t {
|
||||||
bit<8> type;
|
bit<8> type;
|
||||||
bit<8> code;
|
bit<8> code;
|
||||||
bit<16> checksum;
|
bit<16> checksum;
|
||||||
bit<32> rest;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,22 @@ control MyIngress(inout headers hdr,
|
||||||
*/
|
*/
|
||||||
action nat64_icmp6()
|
action nat64_icmp6()
|
||||||
{
|
{
|
||||||
|
hdr.icmp.setValid();
|
||||||
hdr.ipv4.protocol = PROTO_ICMP; // overwrite generic same protocol assumption
|
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);
|
nat64_generic(src, dst);
|
||||||
|
|
||||||
/* fix the protocol specific translations */
|
|
||||||
// switch() ...
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* matching key: v4_network specified again */
|
/* matching key: v4_network specified again */
|
||||||
|
|
Loading…
Reference in a new issue