Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Nov 2016 17:59:54 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r308894 - projects/ipsec/sys/netinet
Message-ID:  <201611201759.uAKHxsmd091301@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Sun Nov 20 17:59:53 2016
New Revision: 308894
URL: https://svnweb.freebsd.org/changeset/base/308894

Log:
  Remove ipsec_hdrsiz_tcp() function, use ipsec_hdrsiz_inpcb() instead.

Modified:
  projects/ipsec/sys/netinet/tcp_output.c
  projects/ipsec/sys/netinet/tcp_subr.c

Modified: projects/ipsec/sys/netinet/tcp_output.c
==============================================================================
--- projects/ipsec/sys/netinet/tcp_output.c	Sun Nov 20 17:50:18 2016	(r308893)
+++ projects/ipsec/sys/netinet/tcp_output.c	Sun Nov 20 17:59:53 2016	(r308894)
@@ -551,7 +551,7 @@ after_sack_rexmit:
 	 * Pre-calculate here as we save another lookup into the darknesses
 	 * of IPsec that way and can actually decide if TSO is ok.
 	 */
-	ipsec_optlen = ipsec_hdrsiz_tcp(tp);
+	ipsec_optlen = ipsec_hdrsiz_inpcb(tp->t_inpcb);
 #endif
 	if ((tp->t_flags & TF_TSO) && V_tcp_do_tso && len > tp->t_maxseg &&
 	    ((tp->t_flags & TF_SIGNATURE) == 0) &&

Modified: projects/ipsec/sys/netinet/tcp_subr.c
==============================================================================
--- projects/ipsec/sys/netinet/tcp_subr.c	Sun Nov 20 17:50:18 2016	(r308893)
+++ projects/ipsec/sys/netinet/tcp_subr.c	Sun Nov 20 17:59:53 2016	(r308894)
@@ -2527,50 +2527,6 @@ tcp_maxseg(const struct tcpcb *tp)
 	return (tp->t_maxseg - optlen);
 }
 
-#ifdef IPSEC
-/* compute ESP/AH header size for TCP, including outer IP header. */
-size_t
-ipsec_hdrsiz_tcp(struct tcpcb *tp)
-{
-	struct inpcb *inp;
-	struct mbuf *m;
-	size_t hdrsiz;
-	struct ip *ip;
-#ifdef INET6
-	struct ip6_hdr *ip6;
-#endif
-	struct tcphdr *th;
-
-	if ((tp == NULL) || ((inp = tp->t_inpcb) == NULL) ||
-		(!key_havesp(IPSEC_DIR_OUTBOUND)))
-		return (0);
-	m = m_gethdr(M_NOWAIT, MT_DATA);
-	if (!m)
-		return (0);
-
-#ifdef INET6
-	if ((inp->inp_vflag & INP_IPV6) != 0) {
-		ip6 = mtod(m, struct ip6_hdr *);
-		th = (struct tcphdr *)(ip6 + 1);
-		m->m_pkthdr.len = m->m_len =
-			sizeof(struct ip6_hdr) + sizeof(struct tcphdr);
-		tcpip_fillheaders(inp, ip6, th);
-		hdrsiz = ipsec_hdrsiz(m, IPSEC_DIR_OUTBOUND, inp);
-	} else
-#endif /* INET6 */
-	{
-		ip = mtod(m, struct ip *);
-		th = (struct tcphdr *)(ip + 1);
-		m->m_pkthdr.len = m->m_len = sizeof(struct tcpiphdr);
-		tcpip_fillheaders(inp, ip, th);
-		hdrsiz = ipsec_hdrsiz(m, IPSEC_DIR_OUTBOUND, inp);
-	}
-
-	m_free(m);
-	return (hdrsiz);
-}
-#endif /* IPSEC */
-
 #ifdef TCP_SIGNATURE
 /*
  * Callback function invoked by m_apply() to digest TCP segment data



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611201759.uAKHxsmd091301>