Fix total_length by adding 15 bytes
This commit is contained in:
		
					parent
					
						
							
								c2e721ed01
							
						
					
				
			
			
				commit
				
					
						801b4d818e
					
				
			
		
					 2 changed files with 69 additions and 3 deletions
				
			
		
							
								
								
									
										68
									
								
								doc/plan.org
									
										
									
									
									
								
							
							
						
						
									
										68
									
								
								doc/plan.org
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -489,7 +489,7 @@ DEBUG:main:v6 reassambled=<Ether  dst=00:00:0a:00:00:42 src=00:00:0a:00:00:01 ty
 | 
			
		|||
 | 
			
		||||
debugging MIGHT come from nat64 table!
 | 
			
		||||
 | 
			
		||||
***** TODO try3: re-rewrite: no packets on h3 again (2019-03-30)
 | 
			
		||||
***** DONE try3: re-rewrite: no packets on h3 again (2019-03-30)
 | 
			
		||||
p4@ubuntu:~$ ~/master-thesis/p4app/sniff-host.sh h1 static_nat64
 | 
			
		||||
+ cd /home/p4/master-thesis/pcap
 | 
			
		||||
+ host=h1
 | 
			
		||||
| 
						 | 
				
			
			@ -525,7 +525,73 @@ p4@ubuntu:~/master-thesis/pcap$
 | 
			
		|||
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
 | 
			
		||||
 | 
			
		||||
-> 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=<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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue