summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_usrreq.c
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1997-02-21 16:30:31 +0000
committerwollman <wollman@FreeBSD.org>1997-02-21 16:30:31 +0000
commit15658f03db638eceb8c54603f6e7f072d02017f9 (patch)
tree32b2ec73999ce12a35fd43130ae2d38531aa8cad /sys/netinet/tcp_usrreq.c
parent00632c9a58446ddb7342d7603d6a089bddd10dda (diff)
downloadFreeBSD-src-15658f03db638eceb8c54603f6e7f072d02017f9.zip
FreeBSD-src-15658f03db638eceb8c54603f6e7f072d02017f9.tar.gz
Fix potential crash where a user attempts to perform an implied
connect in TCP while sending urgent data. It is not clear what purpose is served by doing this, but there's no good reason why it shouldn't work. Submitted by: tjevans@raleigh.ibm.com via wpaul
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r--sys/netinet/tcp_usrreq.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 5207da9..fbed6af 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* From: @(#)tcp_usrreq.c 8.2 (Berkeley) 1/3/94
- * $FreeBSD$
+ * $Id$
*/
#include <sys/param.h>
@@ -389,6 +389,19 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *nam,
* Otherwise, snd_up should be one lower.
*/
sbappend(&so->so_snd, m);
+ if (nam && tp->t_state < TCPS_SYN_SENT) {
+ /*
+ * Do implied connect if not yet connected,
+ * initialize window to default value, and
+ * initialize maxseg/maxopd using peer's cached
+ * MSS.
+ */
+ error = tcp_connect(tp, nam);
+ if (error)
+ goto out;
+ tp->snd_wnd = TTCP_CLIENT_SND_WND;
+ tcp_mss(tp, -1);
+ }
tp->snd_up = tp->snd_una + so->so_snd.sb_cc;
tp->t_force = 1;
error = tcp_output(tp);
OpenPOWER on IntegriCloud