summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/netinet/tcp_output.c
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/sys/netinet/tcp_output.c')
-rw-r--r--freebsd/sys/netinet/tcp_output.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/freebsd/sys/netinet/tcp_output.c b/freebsd/sys/netinet/tcp_output.c
index a310512e..b39b0bdf 100644
--- a/freebsd/sys/netinet/tcp_output.c
+++ b/freebsd/sys/netinet/tcp_output.c
@@ -547,6 +547,11 @@ after_sack_rexmit:
* (except for the sequence number) for all generated packets. This
* makes it impossible to transmit any options which vary per generated
* segment or packet.
+ *
+ * IPv4 handling has a clear separation of ip options and ip header
+ * flags while IPv6 combines both in in6p_outputopts. ip6_optlen() does
+ * the right thing below to provide length of just ip options and thus
+ * checking for ipoptlen is enough to decide if ip options are present.
*/
#ifdef IPSEC
/*
@@ -555,14 +560,25 @@ after_sack_rexmit:
*/
ipsec_optlen = ipsec_hdrsiz_tcp(tp);
#endif
+
+#ifdef INET6
+ if (isipv6)
+ ipoptlen = ip6_optlen(tp->t_inpcb);
+ else
+#endif
+ if (tp->t_inpcb->inp_options)
+ ipoptlen = tp->t_inpcb->inp_options->m_len -
+ offsetof(struct ipoption, ipopt_list);
+ else
+ ipoptlen = 0;
+#ifdef IPSEC
+ ipoptlen += ipsec_optlen;
+#endif
+
if ((tp->t_flags & TF_TSO) && V_tcp_do_tso && len > tp->t_maxseg &&
((tp->t_flags & TF_SIGNATURE) == 0) &&
tp->rcv_numsacks == 0 && sack_rxmit == 0 &&
-#ifdef IPSEC
- ipsec_optlen == 0 &&
-#endif
- tp->t_inpcb->inp_options == NULL &&
- tp->t_inpcb->in6p_options == NULL)
+ ipoptlen == 0)
tso = 1;
if (sack_rxmit) {
@@ -835,20 +851,6 @@ send:
hdrlen += optlen = tcp_addoptions(&to, opt);
}
-#ifdef INET6
- if (isipv6)
- ipoptlen = ip6_optlen(tp->t_inpcb);
- else
-#endif
- if (tp->t_inpcb->inp_options)
- ipoptlen = tp->t_inpcb->inp_options->m_len -
- offsetof(struct ipoption, ipopt_list);
- else
- ipoptlen = 0;
-#ifdef IPSEC
- ipoptlen += ipsec_optlen;
-#endif
-
/*
* Adjust data length if insertion of options will
* bump the packet length beyond the t_maxseg length.
@@ -1339,7 +1341,7 @@ send:
ipov->ih_len = save;
}
#endif /* TCPDEBUG */
- TCP_PROBE3(debug__output, tp, th, mtod(m, const char *));
+ TCP_PROBE3(debug__output, tp, th, m);
/*
* Fill in IP length and desired time to live and