summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2004-02-10 10:30:25 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2004-02-10 10:30:25 +0000
commit04fc09e9697c3885bb44b66d1eb64b908c5eceb4 (patch)
tree52b7d0635508bdbb7145063965df3325a1cb060b /sys/netinet
parent3173c27d2e8308fe5b249684fca9fd9b7c4e177a (diff)
check TF_SIGNATURE when calculating the mss; add TCPOLEN_SIGLEN and
avoid magic constants; ok henning@
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/tcp.h3
-rw-r--r--sys/netinet/tcp_input.c8
-rw-r--r--sys/netinet/tcp_output.c6
3 files changed, 11 insertions, 6 deletions
diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h
index b6d7bd83f43..22e836e957c 100644
--- a/sys/netinet/tcp.h
+++ b/sys/netinet/tcp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp.h,v 1.14 2004/01/31 21:09:15 henning Exp $ */
+/* $OpenBSD: tcp.h,v 1.15 2004/02/10 10:30:24 markus Exp $ */
/* $NetBSD: tcp.h,v 1.8 1995/04/17 05:32:58 cgd Exp $ */
/*
@@ -85,6 +85,7 @@ struct tcphdr {
#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
#define TCPOPT_SIGNATURE 19
#define TCPOLEN_SIGNATURE 18
+#define TCPOLEN_SIGLEN (TCPOLEN_SIGNATURE+2) /* padding */
#define MAX_TCPOPTLEN 40 /* Absolute maximum TCP options len */
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 1d99cc37794..7a7143237e9 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.153 2004/02/05 04:23:13 itojun Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.154 2004/02/10 10:30:24 markus Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -3080,6 +3080,10 @@ tcp_mss(tp, offer)
if ((tp->t_flags & (TF_REQ_TSTMP|TF_NOOPT)) == TF_REQ_TSTMP &&
(tp->t_flags & TF_RCVD_TSTMP) == TF_RCVD_TSTMP)
mss -= TCPOLEN_TSTAMP_APPA;
+#ifdef TCP_SIGNATURE
+ if (tp->t_flags & TF_SIGNATURE)
+ mss -= TCPOLEN_SIGLEN;
+#endif
if (offer == -1) {
/* mss changed due to Path MTU discovery */
@@ -4139,7 +4143,7 @@ syn_cache_respond(sc, m)
((sc->sc_flags & SCF_SACK_PERMIT) ? 4 : 0) +
#endif
#ifdef TCP_SIGNATURE
- ((sc->sc_flags & SCF_SIGNATURE) ? TCPOLEN_SIGNATURE + 2 : 0) +
+ ((sc->sc_flags & SCF_SIGNATURE) ? TCPOLEN_SIGLEN : 0) +
#endif
((sc->sc_flags & SCF_TIMESTAMP) ? TCPOLEN_TSTAMP_APPA : 0);
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index e3ae0307342..9a8f9fba4ec 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_output.c,v 1.63 2004/01/31 19:40:10 markus Exp $ */
+/* $OpenBSD: tcp_output.c,v 1.64 2004/02/10 10:30:24 markus Exp $ */
/* $NetBSD: tcp_output.c,v 1.16 1997/06/03 16:17:09 kml Exp $ */
/*
@@ -616,14 +616,14 @@ send:
*(bp++) = 0;
}
- optlen += TCPOLEN_SIGNATURE;
/* Pad options list to the next 32 bit boundary and
* terminate it.
*/
*bp++ = TCPOPT_NOP;
*bp++ = TCPOPT_EOL;
- optlen += 2;
+
+ optlen += TCPOLEN_SIGLEN;
}
#endif /* TCP_SIGNATURE */