summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_usrreq.c
diff options
context:
space:
mode:
authorangelos <angelos@openbsd.org>1998-06-27 02:09:46 +0000
committerangelos <angelos@openbsd.org>1998-06-27 02:09:46 +0000
commit6ca3c1336eaba96a18daa395153b03655bc840c1 (patch)
tree8c07fd4bddf18eb1de68954b26402139e7646218 /sys/netinet/tcp_usrreq.c
parentNo way, not yet. You did not even test, did you, david (diff)
downloadwireguard-openbsd-6ca3c1336eaba96a18daa395153b03655bc840c1.tar.xz
wireguard-openbsd-6ca3c1336eaba96a18daa395153b03655bc840c1.zip
Disallow TCP connect() to multicast addresses; cmetz@inner.net
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-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;