diff --git a/doc/plan.org b/doc/plan.org index 8dad942..cf7d7ef 100644 --- a/doc/plan.org +++ b/doc/plan.org @@ -489,7 +489,7 @@ DEBUG:main:v6 reassambled=>>> from table TABLE_V6_NETWORKS -> checksums likely broken again due to checksum changes +-> solved, test case for verification is +#+BEGIN_SRC +p4@ubuntu:~$ python ~/master-thesis/p4app/test.py -m v6_static_mapping --debug +INFO:main:Trying to reach 10.0.0.1 (2001:db8:1::a00:1) from h1 +PING 2001:db8:1::a00:1(2001:db8:1::a00:1) 56 data bytes +From 2001:db8::1 icmp_seq=1 Destination unreachable: Address unreachable + +--- 2001:db8:1::a00:1 ping statistics --- +1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms + +p4@ubuntu:~$ python ~/master-thesis/p4app/test.py -m ping6_switch --debug +INFO:main:Trying to reach 2001:db8::42 from h1 +PING 2001:db8::42(2001:db8::42) 56 data bytes +64 bytes from 2001:db8::42: icmp_seq=1 ttl=64 time=6.30 ms + +--- 2001:db8::42 ping statistics --- +1 packets transmitted, 1 received, 0% packet loss, time 0ms +rtt min/avg/max/mdev = 6.304/6.304/6.304/0.000 ms + + +#+END_SRC +***** TODO try4: h3 receives packet, but length seems to be off + - Seeing frame check sequence error + - total length ipv4 = 69 (h3) + - ipv6 payload length = 64 (h1) + - comes from hdr.ipv4.totalLen = (bit<16>) hdr.ipv6.payload_length + 5; + - https://tools.ietf.org/html/rfc791: + Total Length is the length of the datagram, measured in octets, + including internet header and data. + - checksum = 0 -> offset incorrect??? + - ipv4 checksum is 0 + - nat64 frame length = 98 bytes + - theory: ethernet: 48+48+16 = 112 bit -> 12 bytes + - nat64: 76 bytes inside ethernet frame + - nat64: 69 bytes according to total_len + - nat64: -5 bytes = icmp4 = 64 bytes + - icmp6 == 64 bytes + - diff of 7 bytes :-) + - icmp should be: + - type+code+checksum = 4 bytes + - seq + identifier = 4 bytes + - data = variable, source is 56 bytes + - real world ping: total_length = 84, 48 bytes icmp data + - header length in both cases = 5 + - identification 0 in nat64, 0x2cad in real + - flags 0 in nat64, 0x4000 (DF) in real + - ttl = 64 both + - proto = icmp both cases + - header checksum = 0 in nat64, set in real + - data is shorter in nat64, due to total_len error + - real world icmp contains time stamp data ??? + - wireshark EXPECTS timestamp data in echo request! + 8 bytes + and then data + - almost fits diff 7 vs. 8 + - 8 bytes in one block in wireshark + - after ipv4: 6 + 8 + 3*(16) + 2 = 64 -- wtf?? + - icmp6: data == 56 bytes + - nat64 and realping4 frame == 98 bytes + + + + +****** TODO Correct IPv4 header checksum +****** TODO Correct ICMP header checksum +****** TODO Fix length issue + - Seems like total_len is too short - but why? **** DONE Add table name support in debug messages **** DONE Why getting IPv6 packets in INFO:main:unhandled reassambled=>>> from table TABLE_V6_NETWORKS diff --git a/p4src/static-mapping.p4 b/p4src/static-mapping.p4 index 18eec35..c0609a7 100644 --- a/p4src/static-mapping.p4 +++ b/p4src/static-mapping.p4 @@ -77,8 +77,8 @@ control MyIngress(inout headers hdr, /* 5 is ok as long as we don't use options / padding / anything after the destination address */ - hdr.ipv4.ihl = (bit<4>) 5; // internet header length - static for us - hdr.ipv4.totalLen = (bit<16>) hdr.ipv6.payload_length + 5; // ok under above constraints + hdr.ipv4.ihl = (bit<4>) 5; // internet header length: 4*5 = 20 + hdr.ipv4.totalLen = (bit<16>) hdr.ipv6.payload_length + 20; // ok under above constraints hdr.ipv4.identification = (bit<16>) 0; // no support for fragments hdr.ipv4.flags = (bit<3>) 0; // DF bit and more fragments, unsupported ATM