Centralize and correct computation of TCP-MD5 signature offset within

the packet (tcp header options field).

Reviewed by:	tools/regression/netinet/tcpconnect
MFC after:	3 days
Tested by:	Nick Hilliard (see net@)
This commit is contained in:
Bjoern A. Zeeb 2007-11-30 23:46:51 +00:00
parent beb8b626d1
commit ee763d0d9c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=174120

View file

@ -128,9 +128,6 @@ tcp_output(struct tcpcb *tp)
struct socket *so = tp->t_inpcb->inp_socket;
long len, recwin, sendwin;
int off, flags, error;
#ifdef TCP_SIGNATURE
int sigoff = 0;
#endif
struct mbuf *m;
struct ip *ip = NULL;
struct ipovly *ipov = NULL;
@ -694,10 +691,6 @@ tcp_output(struct tcpcb *tp)
/* Processing the options. */
hdrlen += optlen = tcp_addoptions(&to, opt);
#ifdef TCP_SIGNATURE
sigoff = to.to_signature - (u_char *)&to;
#endif /* TCP_SIGNATURE */
}
#ifdef INET6
@ -964,9 +957,11 @@ tcp_output(struct tcpcb *tp)
#ifdef INET6
if (!isipv6)
#endif
if (tp->t_flags & TF_SIGNATURE)
if (tp->t_flags & TF_SIGNATURE) {
int sigoff = to.to_signature - opt;
tcp_signature_compute(m, sizeof(struct ip), len, optlen,
(u_char *)(th + 1) + sigoff, IPSEC_DIR_OUTBOUND);
}
#endif
/*