1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00

Make tcp_twrespond() use tcp_addoptions() instead of a home grown version.

This commit is contained in:
Andre Oppermann 2007-04-18 18:14:39 +00:00
parent d477452eb3
commit bbf4e1cb47
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=168845
2 changed files with 12 additions and 22 deletions

View File

@ -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;

View File

@ -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;