summaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_output.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet/tcp_output.c')
-rw-r--r--sys/netinet/tcp_output.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index cb7498ab0f75..1f067a9c71b6 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -31,11 +31,13 @@
* SUCH DAMAGE.
*
* @(#)tcp_output.c 8.4 (Berkeley) 5/24/95
- * $Id: tcp_output.c,v 1.28 1998/02/20 13:37:39 bde Exp $
+ * $Id: tcp_output.c,v 1.29 1998/04/06 06:52:44 phk Exp $
*/
#include "opt_tcpdebug.h"
+#include <stddef.h>
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
@@ -79,7 +81,7 @@ tcp_output(tp)
register struct mbuf *m;
register struct tcpiphdr *ti;
u_char opt[TCP_MAXOLEN];
- unsigned optlen, hdrlen;
+ unsigned ipoptlen, optlen, hdrlen;
int idle, sendalot;
struct rmxp_tao *taop;
struct rmxp_tao tao_noncached;
@@ -433,18 +435,25 @@ send:
hdrlen += optlen;
+ if (tp->t_inpcb->inp_options) {
+ ipoptlen = tp->t_inpcb->inp_options->m_len -
+ offsetof(struct ipoption, ipopt_list);
+ } else {
+ ipoptlen = 0;
+ }
+
/*
* Adjust data length if insertion of options will
* bump the packet length beyond the t_maxopd length.
* Clear the FIN bit because we cut off the tail of
* the segment.
*/
- if (len + optlen > tp->t_maxopd) {
+ if (len + optlen + ipoptlen > tp->t_maxopd) {
/*
* If there is still more to send, don't close the connection.
*/
flags &= ~TH_FIN;
- len = tp->t_maxopd - optlen;
+ len = tp->t_maxopd - optlen - ipoptlen;
sendalot = 1;
}