summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>1998-06-27 02:09:47 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>1998-06-27 02:09:47 +0000
commit0ee2cababfe5b0e10bd63e94c66ece15b60e00d8 (patch)
tree0e9edc399f4977a04b494ca369c4f96bce922a99
parent42bd9c32e15b2ead8af72b44be3a1234dd03aaed (diff)
Disallow TCP connect() to multicast addresses; cmetz@inner.net
-rw-r--r--sys/netinet/tcp_usrreq.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index e53d2b40a98..2abcefd468b 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_usrreq.c,v 1.25 1998/06/26 18:07:30 deraadt Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.26 1998/06/27 02:09:46 angelos Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
@@ -198,6 +198,13 @@ tcp_usrreq(so, req, m, nam, control)
case PRU_CONNECT:
sin = mtod(nam, struct sockaddr_in *);
+ /* Disallow connects to a multicast address */
+ if (IN_MULTICAST(sin->sin_addr.s_addr))
+ {
+ error = EINVAL;
+ break;
+ }
+
/* Trying to connect to some broadcast address */
if (in_broadcast(sin->sin_addr, NULL)) {
error = EINVAL;