summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_subr.c
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2007-04-18 18:14:39 +0000
committerandre <andre@FreeBSD.org>2007-04-18 18:14:39 +0000
commit456ea0a9e590c062fccaa286f23a26cf2cf3dea0 (patch)
tree47adf45e8717f97d011ea47c23022feb89cdf3fb /sys/netinet/tcp_subr.c
parentded5de7de2dd77ef19aefb507824920c87c84181 (diff)
downloadFreeBSD-src-456ea0a9e590c062fccaa286f23a26cf2cf3dea0.zip
FreeBSD-src-456ea0a9e590c062fccaa286f23a26cf2cf3dea0.tar.gz
Make tcp_twrespond() use tcp_addoptions() instead of a home grown version.
Diffstat (limited to 'sys/netinet/tcp_subr.c')
-rw-r--r--sys/netinet/tcp_subr.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index dc4a695..0ef4a0d 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -1943,9 +1943,9 @@ tcp_twrespond(struct tcptw *tw, int flags)
struct tcphdr *th;
struct mbuf *m;
struct ip *ip = NULL;
- u_int8_t *optp;
u_int hdrlen, optlen;
int error;
+ struct tcpopt to;
#ifdef INET6
struct ip6_hdr *ip6 = NULL;
int isipv6 = inp->inp_inc.inc_isipv6;
@@ -1976,23 +1976,18 @@ tcp_twrespond(struct tcptw *tw, int flags)
th = (struct tcphdr *)(ip + 1);
tcpip_fillheaders(inp, ip, th);
}
- optp = (u_int8_t *)(th + 1);
+ to.to_flags = 0;
/*
* Send a timestamp and echo-reply if both our side and our peer
* have sent timestamps in our SYN's and this is not a RST.
*/
if (tw->t_recent && flags == TH_ACK) {
- u_int32_t *lp = (u_int32_t *)optp;
-
- /* Form timestamp option as shown in appendix A of RFC 1323. */
- *lp++ = htonl(TCPOPT_TSTAMP_HDR);
- *lp++ = htonl(ticks);
- *lp = htonl(tw->t_recent);
- optp += TCPOLEN_TSTAMP_APPA;
+ to.to_flags |= TOF_TS;
+ to.to_tsval = ticks;
+ to.to_tsecr = tw->t_recent;
}
-
- optlen = optp - (u_int8_t *)(th + 1);
+ optlen = tcp_addoptions(&to, (u_char *)(th + 1));
m->m_len = hdrlen + optlen;
m->m_pkthdr.len = m->m_len;
OpenPOWER on IntegriCloud