mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
Added comments to clarify the LWIP_TCP_TIMESTAMPS option.
This commit is contained in:
parent
a44e2190d6
commit
3273c68b63
@ -1660,10 +1660,12 @@ tcp_parseopt(struct tcp_pcb *pcb)
|
||||
return;
|
||||
}
|
||||
/* TCP timestamp option with valid length */
|
||||
tsval = (opts[c+2]) | (opts[c+3] << 8) |
|
||||
tsval = (opts[c+2]) | (opts[c+3] << 8) |
|
||||
(opts[c+4] << 16) | (opts[c+5] << 24);
|
||||
if (flags & TCP_SYN) {
|
||||
pcb->ts_recent = ntohl(tsval);
|
||||
/* Enable sending timestamps in every segment now that we know
|
||||
the remote host supports it. */
|
||||
pcb->flags |= TF_TIMESTAMP;
|
||||
} else if (TCP_SEQ_BETWEEN(pcb->ts_lastacksent, seqno, seqno+tcplen)) {
|
||||
pcb->ts_recent = ntohl(tsval);
|
||||
|
@ -393,6 +393,8 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
|
||||
#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. */
|
||||
optflags = TF_SEG_OPTS_TS;
|
||||
optlen = LWIP_TCP_OPT_LENGTH(TF_SEG_OPTS_TS);
|
||||
}
|
||||
@ -754,7 +756,9 @@ tcp_enqueue_flags(struct tcp_pcb *pcb, u8_t flags)
|
||||
#endif /* LWIP_WND_SCALE */
|
||||
}
|
||||
#if LWIP_TCP_TIMESTAMPS
|
||||
if ((pcb->flags & TF_TIMESTAMP)) {
|
||||
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. */
|
||||
optflags |= TF_SEG_OPTS_TS;
|
||||
}
|
||||
#endif /* LWIP_TCP_TIMESTAMPS */
|
||||
|
@ -1055,6 +1055,9 @@
|
||||
|
||||
/**
|
||||
* LWIP_TCP_TIMESTAMPS==1: support the TCP timestamp option.
|
||||
* The timestamp option is currently only used to help remote hosts, it is not
|
||||
* really used locally. Therefore, it is only enabled when a TS option is
|
||||
* received in the initial SYN packet from a remote host.
|
||||
*/
|
||||
#ifndef LWIP_TCP_TIMESTAMPS
|
||||
#define LWIP_TCP_TIMESTAMPS 0
|
||||
|
Loading…
Reference in New Issue
Block a user