summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_output.c
diff options
context:
space:
mode:
authorfenner <fenner@FreeBSD.org>1998-05-24 18:41:04 +0000
committerfenner <fenner@FreeBSD.org>1998-05-24 18:41:04 +0000
commit5aeeaf27d893dda5afccc72340e4b47b0bbb5255 (patch)
treea69ca018d8bf74ad379d098ee832ec80a69086e4 /sys/netinet/tcp_output.c
parente71731de48c08744efbf07741cbfb9b62e3950dc (diff)
downloadFreeBSD-src-5aeeaf27d893dda5afccc72340e4b47b0bbb5255.zip
FreeBSD-src-5aeeaf27d893dda5afccc72340e4b47b0bbb5255.tar.gz
Take IP options into account when calculating the allowable length
of the TCP payload. See RFC1122 section 4.2.2.6 . This allows Path MTU discovery to be used along with IP options. PR: problem discovered by Kevin Lahey <kml@nas.nasa.gov>
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 cb7498a..1f067a9 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;
}
OpenPOWER on IntegriCloud