diff --git a/doc/plan.org b/doc/plan.org index 44babec..cb8ecb9 100644 --- a/doc/plan.org +++ b/doc/plan.org @@ -185,7 +185,7 @@ | | | | | | Added arp handling | | | | Added icmp handling | | -| | Static | | +| | Need to setup hardware addresses -> in theor resolution -> hardcoded atm | | | | | | | | | | | 2019-04-04 | NAT64 1:1 table ICMP, ICMPv6 working | | @@ -704,7 +704,16 @@ INFO:main:unhandled reassambled= ethernet is wrong! +****** DONE Fix resolve / mac addresses -> ethernet is wrong! +INFO:main:unhandled reassambled=>>> from table TABLE_V6_NETWORKS +INFO:main:unhandled reassambled=>>> from table TABLE_V6_NETWORKS +INFO:main:unhandled reassambled=>>> from table TABLE_V6_NETWORKS + +According to pcap/static_nat64-2019-04-03-0932-h3.pcap ethernet frame +looks good. Still no reply / reaction from host h3. +****** TODO Fix IPv4 header checksum // wrong according to wireshark +When & how to update? + ***** TODO transform protocol specific: icmp -> icmp6 ****** DONE Make switch answer IPv4 icmp echo request for ******* DONE Make switch respond to ARP diff --git a/p4src/checksums.p4 b/p4src/checksums.p4 index 798e974..ce2da97 100644 --- a/p4src/checksums.p4 +++ b/p4src/checksums.p4 @@ -69,6 +69,24 @@ control MyComputeChecksum(inout headers hdr, inout metadata meta) { hdr.icmp.checksum, HashAlgorithm.csum16 ); + + update_checksum(meta.chk_ipv4 == 1, + { + hdr.ipv4.version, + hdr.ipv4.ihl, + hdr.ipv4.dscp, + hdr.ipv4.ecn, + hdr.ipv4.totalLen, + hdr.ipv4.identification, + hdr.ipv4.flags, + hdr.ipv4.fragOffset, + hdr.ipv4.ttl, + hdr.ipv4.protocol, + hdr.ipv4.srcAddr, + hdr.ipv4.dstAddr + }, + hdr.ipv4.hdrChecksum, + HashAlgorithm.csum16); } } diff --git a/p4src/headers.p4 b/p4src/headers.p4 index 1a25d0c..8c48927 100644 --- a/p4src/headers.p4 +++ b/p4src/headers.p4 @@ -211,6 +211,7 @@ struct metadata { bit<1> chk_icmp6_na_ns; bit<1> chk_icmp6; bit<1> chk_icmp; + bit<1> chk_ipv4; bit<16> tcp_length; bit<32> cast_length; diff --git a/p4src/static-mapping.p4 b/p4src/static-mapping.p4 index c9a1880..c35d31b 100644 --- a/p4src/static-mapping.p4 +++ b/p4src/static-mapping.p4 @@ -74,6 +74,7 @@ control MyIngress(inout headers hdr, /* NAT64 protocol unspecific changes */ action nat64_generic(ipv4_addr_t src, ipv4_addr_t dst) { hdr.ipv4.setValid(); + meta.chk_ipv4 = 1; /* need to calculate the hdrchecksum */ /* Stuff that might need to be fixed */ hdr.ipv4.version = (bit<4>)4;