Trigger ipv4 checksumming after nat64 translation

This commit is contained in:
Nico Schottelius 2019-04-03 11:46:52 +02:00
parent 989ebfae0f
commit 74e4e7034b
4 changed files with 31 additions and 2 deletions

View File

@ -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=<Ether dst=00:00:0a:00:00:42 src=00:00:0a:00:00
According to Edgar this should not be seen anyway.
****** DONE Calculate ICMP checksum
****** DONE Check field lengths
****** TODO Fix resolve / mac addresses -> ethernet is wrong!
****** DONE Fix resolve / mac addresses -> ethernet is wrong!
INFO:main:unhandled reassambled=<Ether dst=33:33:ff:00:00:42 src=00:00:0a:00:00:01 type=0x86dd |<IPv6 version=6 tc=0 fl=0 plen=32 nh=ICMPv6 hlim=255 src=fe80::200:aff:fe00:1 dst=ff02::1:ff00:42 |<ICMPv6ND_NS type=Neighbor Solicitation code=0 cksum=0x37df res=0 tgt=2001:db8::42 |<ICMPv6NDOptSrcLLAddr type=1 len=1 lladdr=00:00:0a:00:00:01 |>>>> from table TABLE_V6_NETWORKS
INFO:main:unhandled reassambled=<Ether dst=33:33:ff:00:00:42 src=00:00:0a:00:00:01 type=0x86dd |<IPv6 version=6 tc=0 fl=0 plen=32 nh=ICMPv6 hlim=255 src=fe80::200:aff:fe00:1 dst=ff02::1:ff00:42 |<ICMPv6ND_NS type=Neighbor Solicitation code=0 cksum=0x37df res=0 tgt=2001:db8::42 |<ICMPv6NDOptSrcLLAddr type=1 len=1 lladdr=00:00:0a:00:00:01 |>>>> from table TABLE_V6_NETWORKS
INFO:main:unhandled reassambled=<Ether dst=33:33:ff:00:00:42 src=00:00:0a:00:00:01 type=0x86dd |<IPv6 version=6 tc=0 fl=0 plen=32 nh=ICMPv6 hlim=255 src=2001:db8::1 dst=ff02::1:ff00:42 |<ICMPv6ND_NS type=Neighbor Solicitation code=0 cksum=0x13a7 res=0 tgt=2001:db8::42 |<ICMPv6NDOptSrcLLAddr type=1 len=1 lladdr=00:00:0a:00:00:01 |>>>> 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

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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;