checksumming part finish
This commit is contained in:
parent
b757a3c2b0
commit
92e1407729
2 changed files with 112 additions and 11 deletions
33
doc/plan.org
33
doc/plan.org
|
|
@ -384,6 +384,12 @@
|
|||
| 2019-06-27 | | |
|
||||
| | Target Hardware: code running | |
|
||||
| | | |
|
||||
| 2019-07-01 | | |
|
||||
| | Meeting Laurent | |
|
||||
| | | |
|
||||
| | - Diff'ing in python | |
|
||||
| | - Phasing in netpfga code | |
|
||||
| | | |
|
||||
| 2019-07-11 | | |
|
||||
| | Integrated org-documentation into latex / export working | |
|
||||
| | https://bastibe.de/2014-09-23-org-cite.html | |
|
||||
|
|
@ -4893,6 +4899,33 @@ actual (tlast, tkeep, tdata) = (0, ffffffff, 000000000000000080fe403b0a0000000
|
|||
*** 2019-06-24: find out how the expected/actual packet lines are generated
|
||||
- afair: indirectly by running gen_testdata.py -> replace script
|
||||
with port1
|
||||
*** 2019-07-01: verify checksumming
|
||||
#+BEGIN_CENTER
|
||||
if struct.pack("H",1) == b"\x00\x01": # big endian
|
||||
def checksum(pkt):
|
||||
if len(pkt) % 2 == 1:
|
||||
pkt += b"\0"
|
||||
s = sum(array.array("H", pkt))
|
||||
s = (s >> 16) + (s & 0xffff)
|
||||
s += s >> 16
|
||||
s = ~s
|
||||
return s & 0xffff
|
||||
else:
|
||||
def checksum(pkt):
|
||||
if len(pkt) % 2 == 1:
|
||||
pkt += b"\0"
|
||||
s = sum(array.array("H", pkt))
|
||||
s = (s >> 16) + (s & 0xffff)
|
||||
s += s >> 16
|
||||
s = ~s
|
||||
return (((s>>8)&0xff)|s<<8) & 0xffff
|
||||
|
||||
#+END_CENTER
|
||||
*** 2019-07-01: 128 bit ipv6 struct -> no conversion!
|
||||
- https://docs.python.org/2.7/library/struct.html
|
||||
- .packed of ipaddress works
|
||||
*** 2019-07-01: finish sum, use scapy checksum
|
||||
*** 2019-07-01: meeting Laurent
|
||||
** References / Follow up
|
||||
*** RFC 791 IPv4 https://tools.ietf.org/html/rfc791
|
||||
*** RFC 792 ICMP https://tools.ietf.org/html/rfc792
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue