Skip to content

Commit

Permalink
fix marshalling for unknown tcp options.
Browse files Browse the repository at this point in the history
Unknown TCP options previously just wrote the supplied data to the next
place in the buffer, because they incorrectly overwrote the option-kind
and option-length (the option-length also being incorrect).  Write the
option-kind and (correct) option-length in addition to the supplied
data.
  • Loading branch information
yomimono committed Oct 13, 2015
1 parent 61d1b8e commit 3b31fec
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tcp/options.ml
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,11 @@ let write_iter buf =
Cstruct.BE.set_uint32 buf 2 tsval;
Cstruct.BE.set_uint32 buf 6 tsecr;
10
| Unknown (kind,contents) ->
let tlen = String.length contents in
| Unknown (kind, contents) ->
let content_len = String.length contents in
let tlen = content_len + 2 in
set_tlen kind tlen;
Cstruct.blit_from_string contents 0 buf 0 tlen;
Cstruct.blit_from_string contents 0 buf 2 content_len;
tlen

let marshal buf ts =
Expand Down

0 comments on commit 3b31fec

Please sign in to comment.