Checksums: ipv4 diff not needed; minip4: enable icmp, arp
This commit is contained in:
parent
6a9daa500e
commit
ce212ed9e1
4 changed files with 189 additions and 141 deletions
|
|
@ -27,6 +27,9 @@ def checksum_scapy(pkt):
|
|||
# Only the diff between v4 and v6 "counts"
|
||||
#
|
||||
|
||||
# b)
|
||||
# Not needed
|
||||
|
||||
def sum_for_udp(packet):
|
||||
sums = ""
|
||||
sums += struct.pack("H", packet[UDP].sport)
|
||||
|
|
@ -78,6 +81,30 @@ def sum_for_v4(packet):
|
|||
|
||||
return sums
|
||||
|
||||
def sum_for_v4_from_v6(packet):
|
||||
# update_checksum(meta.chk_ipv4 == 1,
|
||||
# {
|
||||
# hdr.ipv4.version,
|
||||
# hdr.ipv4.ihl,
|
||||
# hdr.ipv4.diff_serv,
|
||||
# hdr.ipv4.ecn,
|
||||
# hdr.ipv4.totalLen,
|
||||
# hdr.ipv4.identification,
|
||||
# hdr.ipv4.flags,
|
||||
# hdr.ipv4.fragOffset,
|
||||
# hdr.ipv4.ttl,
|
||||
# hdr.ipv4.protocol,
|
||||
# hdr.ipv4.src_addr,
|
||||
# hdr.ipv4.dst_addr
|
||||
# },
|
||||
# hdr.ipv4.hdrChecksum,
|
||||
# HashAlgorithm.csum16
|
||||
# );
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
p = []
|
||||
|
||||
|
|
@ -174,3 +201,5 @@ if __name__ == '__main__':
|
|||
|
||||
print("Translating v4 to v6, expected v6 UDP checksum: {}".format(
|
||||
checksums["ipv4"] + header_diff_from_v6))
|
||||
|
||||
# Generate the IPv4 header checksum from IPv6:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue