Skip to content

Commit

Permalink
Fix an incorrect payload length when sending TCP MSS option.
Browse files Browse the repository at this point in the history
whitequark committed Jan 27, 2017
1 parent 42261f3 commit e8ece3e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/socket/tcp.rs
Original file line number Diff line number Diff line change
@@ -965,6 +965,12 @@ impl<'a> TcpSocket<'a> {
repr.ack_number = Some(ack_number);
self.remote_last_ack = ack_number;

if repr.control == TcpControl::Syn {
// First enable the option, without assigning any value, to get a correct
// result for (ip_repr:Unspecified).payload_len below.
repr.max_seg_size = Some(0);
}

let ip_repr = IpRepr::Unspecified {
src_addr: self.local_endpoint.addr,
dst_addr: self.remote_endpoint.addr,

0 comments on commit e8ece3e

Please sign in to comment.