Index: sys/netinet/tcp_subr.c =================================================================== --- sys/netinet/tcp_subr.c (revision 292681) +++ sys/netinet/tcp_subr.c (working copy) @@ -835,7 +835,7 @@ void tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, struct mbuf *m, tcp_seq ack, tcp_seq seq, int flags) { - int tlen; + int tlen, optlen = 0; int win = 0; struct ip *ip; struct tcphdr *nth; @@ -845,6 +845,7 @@ tcp_respond(struct tcpcb *tp, void *ipgen, struct #endif /* INET6 */ int ipflags = 0; struct inpcb *inp; + struct tcpopt to; KASSERT(tp != NULL || m != NULL, ("tcp_respond: tp and m both NULL")); @@ -943,6 +944,17 @@ tcp_respond(struct tcpcb *tp, void *ipgen, struct ip->ip_off |= htons(IP_DF); } #endif + if (tp != NULL) { + to.to_flags = 0; + if ((tp->t_flags & (TF_REQ_TSTMP|TF_RCVD_TSTMP|TF_NOOPT)) == + (TF_REQ_TSTMP|TF_RCVD_TSTMP)) { + to.to_flags |= TOF_TS; + to.to_tsval = tcp_ts_getticks() + tp->ts_offset; + to.to_tsecr = tp->ts_recent; + tlen += optlen = tcp_addoptions(&to, + (u_char *)(nth + 1)); + } + } m->m_len = tlen; m->m_pkthdr.len = tlen; m->m_pkthdr.rcvif = NULL; @@ -965,7 +977,7 @@ tcp_respond(struct tcpcb *tp, void *ipgen, struct nth->th_seq = htonl(seq); nth->th_ack = htonl(ack); nth->th_x2 = 0; - nth->th_off = sizeof (struct tcphdr) >> 2; + nth->th_off = (sizeof (struct tcphdr) + optlen) >> 2; nth->th_flags = flags; if (tp != NULL) nth->th_win = htons((u_short) (win >> tp->rcv_scale));