Solved UDP translation
This commit is contained in:
		
					parent
					
						
							
								e1dd4d44d4
							
						
					
				
			
			
				commit
				
					
						6a9daa500e
					
				
			
		
					 1 changed files with 6 additions and 18 deletions
				
			
		| 
						 | 
				
			
			@ -164,25 +164,13 @@ if __name__ == '__main__':
 | 
			
		|||
                                                  checksums["ipv4"],
 | 
			
		||||
                                                  checksums["ipv6"] - checksums["ipv4"]))
 | 
			
		||||
 | 
			
		||||
        header_diff_from_v6 = header_checksums["ipv6"] - header_checksums["ipv4"]
 | 
			
		||||
        print("Header v6: {} v4: {} diff: {}".format(header_checksums["ipv6"],
 | 
			
		||||
                                                     header_checksums["ipv4"],
 | 
			
		||||
                                                     header_checksums["ipv6"] - header_checksums["ipv4"]))
 | 
			
		||||
                                                     header_diff_from_v6))
 | 
			
		||||
 | 
			
		||||
        p
 | 
			
		||||
        print("Translating v6 to v4, expected v4 UDP checksum: {}".format(
 | 
			
		||||
            checksums["ipv6"] - header_diff_from_v6))
 | 
			
		||||
 | 
			
		||||
        # if UDP in packet:
 | 
			
		||||
        #     sums += sum_for_udp(packet_rebuild)
 | 
			
		||||
        # if TCP in packet:
 | 
			
		||||
        #     sums += sum_for_udp(packet_rebuild)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#            diff_total += packet_rebuild[IP].chksum
 | 
			
		||||
#            diff_total -= packet_rebuild[IPv6].chksum# Checksums:
 | 
			
		||||
# - tcp
 | 
			
		||||
# - udp
 | 
			
		||||
# - icmp6
 | 
			
		||||
# - icmp
 | 
			
		||||
# - ipv4 (no payload)
 | 
			
		||||
#
 | 
			
		||||
#         t.chksum = None
 | 
			
		||||
        print("Translating v4 to v6, expected v6 UDP checksum: {}".format(
 | 
			
		||||
            checksums["ipv4"] + header_diff_from_v6))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue