Sending TCP timestamp option in SYN packets

TCP timestamps were only sent if the remote side
requested it first. This enables the use of timestamps
for outgoing connections as well.

Signed-off-by: goldsimon <goldsimon@gmx.de>
This commit is contained in:
Jakub Schmidtke 2017-06-19 13:30:45 -04:00 committed by goldsimon
parent faf74b36a4
commit 112e370457

View File

@ -835,9 +835,9 @@ tcp_enqueue_flags(struct tcp_pcb *pcb, u8_t flags)
#endif /* LWIP_WND_SCALE */
}
#if LWIP_TCP_TIMESTAMPS
if ((pcb->flags & TF_TIMESTAMP)) {
/* Make sure the timestamp option is only included in data segments if we
agreed about it with the remote host. */
if ((pcb->flags & TF_TIMESTAMP) || ((flags & TCP_SYN) && (pcb->state != SYN_RCVD))) {
/* The timestamp option is only included in SYN packets,
* and in data segments if we agreed about it with the remote host. */
optflags |= TF_SEG_OPTS_TS;
}
#endif /* LWIP_TCP_TIMESTAMPS */