From 8387ab32c5e30853703bc94a6a8905ce61556a1e Mon Sep 17 00:00:00 2001 From: thorpej Date: Wed, 3 Mar 2004 05:59:38 +0000 Subject: [PATCH] Use IPSEC_PCB_SKIP_IPSEC() to short-circuit calls to ipsec{4,6}_hdrsiz_tcp(). --- sys/netinet/tcp_output.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 2828575c736a..27fd1906c118 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_output.c,v 1.107 2004/02/04 05:36:03 itojun Exp $ */ +/* $NetBSD: tcp_output.c,v 1.108 2004/03/03 05:59:38 thorpej Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -138,7 +138,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.107 2004/02/04 05:36:03 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.108 2004/03/03 05:59:38 thorpej Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -342,7 +342,8 @@ tcp_segsize(struct tcpcb *tp, int *txsegsizep, int *rxsegsizep) #ifdef INET if (inp) { #if defined(IPSEC) || defined(FAST_IPSEC) - optlen += ipsec4_hdrsiz_tcp(tp); + if (! IPSEC_PCB_SKIP_IPSEC(inp->inp_sp, IPSEC_DIR_OUTBOUND)) + optlen += ipsec4_hdrsiz_tcp(tp); #endif optlen += ip_optlen(inp); } @@ -351,14 +352,16 @@ tcp_segsize(struct tcpcb *tp, int *txsegsizep, int *rxsegsizep) #ifdef INET if (in6p && tp->t_family == AF_INET) { #if defined(IPSEC) || defined(FAST_IPSEC) - optlen += ipsec4_hdrsiz_tcp(tp); + if (! IPSEC_PCB_SKIP_IPSEC(in6p->in6p_sp, IPSEC_DIR_OUTBOUND)) + optlen += ipsec4_hdrsiz_tcp(tp); #endif /* XXX size -= ip_optlen(in6p); */ } else #endif if (in6p && tp->t_family == AF_INET6) { #ifdef IPSEC - optlen += ipsec6_hdrsiz_tcp(tp); + if (! IPSEC_PCB_SKIP_IPSEC(in6p->in6p_sp, IPSEC_DIR_OUTBOUND)) + optlen += ipsec6_hdrsiz_tcp(tp); #endif optlen += ip6_optlen(in6p); }