summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_usrreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r--sys/netinet/tcp_usrreq.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 6956fc9c7a7..2b89813c071 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_usrreq.c,v 1.19 1998/02/25 23:44:58 deraadt Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.20 1998/02/28 03:39:58 angelos Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
@@ -90,6 +90,7 @@ tcp_usrreq(so, req, m, nam, control)
int req;
struct mbuf *m, *nam, *control;
{
+ struct sockaddr_in *sin;
register struct inpcb *inp;
register struct tcpcb *tp = NULL;
int s;
@@ -189,6 +190,15 @@ tcp_usrreq(so, req, m, nam, control)
* Send initial segment on connection.
*/
case PRU_CONNECT:
+ sin = mtod(nam, struct sockaddr_in *);
+
+ /* Trying to connect to some broadcast address */
+ if (in_broadcast(sin->sin_addr, NULL))
+ {
+ error = EINVAL;
+ break;
+ }
+
if (inp->inp_lport == 0) {
error = in_pcbbind(inp, NULL);
if (error)
@@ -197,6 +207,7 @@ tcp_usrreq(so, req, m, nam, control)
error = in_pcbconnect(inp, nam);
if (error)
break;
+
tp->t_template = tcp_template(tp);
if (tp->t_template == 0) {
in_pcbdisconnect(inp);