diff --git a/doc/plan.org b/doc/plan.org index 51b51d0..b7e1c8b 100644 --- a/doc/plan.org +++ b/doc/plan.org @@ -66,6 +66,7 @@ **** DONE Parse icmp **** DONE Parse icmpv6 **** DONE Add (static) egress configuration +**** TODO Calculate ICMP6 checksums **** TODO Make switch answer icmp6 echo request for **** TODO Make switch answer icmp echo request for **** TODO Add default route for v6 and v4 hosts @@ -144,6 +145,29 @@ user@T:~# iptables -t mangle -A PREROUTING \ **** Static mappings - likely need table(s) - need tcp & udp translation +**** ICMPv6 +Different lengths possible + +[20:35] line:~% ping -6 -s 20 ::1 +PING ::1(::1) 20 data bytes +28 bytes from ::1: icmp_seq=1 ttl=64 time=0.045 ms +28 bytes from ::1: icmp_seq=2 ttl=64 time=0.064 ms +^C +--- ::1 ping statistics --- +2 packets transmitted, 2 received, 0% packet loss, time 1018ms +rtt min/avg/max/mdev = 0.045/0.054/0.064/0.012 ms +[20:36] line:~% ping -6 -s 80 ::1 +PING ::1(::1) 80 data bytes +88 bytes from ::1: icmp_seq=1 ttl=64 time=0.053 ms +88 bytes from ::1: icmp_seq=2 ttl=64 time=0.095 ms +^C +--- ::1 ping statistics --- +2 packets transmitted, 2 received, 0% packet loss, time 1001ms +rtt min/avg/max/mdev = 0.053/0.074/0.095/0.021 ms +[20:36] line:~% + +Different checksum in most packets. + ***** Hosts ****** Left side: IPv6 ****** Right side: IPv4 @@ -157,6 +181,8 @@ user@T:~# iptables -t mangle -A PREROUTING \ **** RFC 6052: https://tools.ietf.org/html/rfc6052 IPv6 Addressing of IPv4/IPv6 Translators **** RFC 6586 for deployment experiences using Stateful NAT64. **** RFC 7757 Explicit Address Mappings for Stateless IP/ICMP Translation +**** RFC 4443 ICMPv6 https://tools.ietf.org/html/rfc4443 +**** RFC 2460 IPv6 (Checksum https://tools.ietf.org/html/rfc2460#section-8.1) **** EAMT/Jool: https://www.jool.mx/en/eamt.html * Proposal / task description ** Task description for mystudies diff --git a/p4src/checksums.p4 b/p4src/checksums.p4 index 5c58803..6fb70cb 100644 --- a/p4src/checksums.p4 +++ b/p4src/checksums.p4 @@ -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); } }