Make note re: checksums
This commit is contained in:
parent
97009ad9a7
commit
b5e73b8462
6
ip.rkt
6
ip.rkt
|
@ -46,7 +46,7 @@
|
||||||
(fragment-offset :: bits 13)
|
(fragment-offset :: bits 13)
|
||||||
ttl
|
ttl
|
||||||
protocol
|
protocol
|
||||||
(header-checksum :: bits 16)
|
(header-checksum :: bits 16) ;; TODO: check checksum
|
||||||
(source-ip0 :: binary bits 32)
|
(source-ip0 :: binary bits 32)
|
||||||
(destination-ip0 :: binary bits 32)
|
(destination-ip0 :: binary bits 32)
|
||||||
(rest :: binary) ]
|
(rest :: binary) ]
|
||||||
|
@ -124,7 +124,7 @@
|
||||||
(match e
|
(match e
|
||||||
[(message (ip-packet peer-address _ _ _ _ body) _ _)
|
[(message (ip-packet peer-address _ _ _ _ body) _ _)
|
||||||
(bit-string-case body
|
(bit-string-case body
|
||||||
([ type code (checksum :: integer bytes 2) (rest :: binary) ]
|
([ type code (checksum :: integer bytes 2) (rest :: binary) ] ;; TODO: check cksum
|
||||||
(case type
|
(case type
|
||||||
[(8) ;; ECHO (0 is ECHO-REPLY)
|
[(8) ;; ECHO (0 is ECHO-REPLY)
|
||||||
(log-info "Ping of ~a from ~a"
|
(log-info "Ping of ~a from ~a"
|
||||||
|
@ -153,4 +153,4 @@
|
||||||
[_ #f]))
|
[_ #f]))
|
||||||
(void)
|
(void)
|
||||||
(gestalt-union (pub (ip-packet my-address ? ? PROTOCOL-ICMP ? ?))
|
(gestalt-union (pub (ip-packet my-address ? ? PROTOCOL-ICMP ? ?))
|
||||||
(sub (ip-packet ? my-address ? PROTOCOL-ICMP ? ?)))))
|
(sub (ip-packet ? my-address ? PROTOCOL-ICMP ? ?)))))
|
||||||
|
|
Loading…
Reference in New Issue