summaryrefslogtreecommitdiff
path: root/sys/netinet6
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2022-04-14 14:10:23 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2022-04-14 14:10:23 +0000
commit3cd61a330306743b7ff387db7b9e96fae4b5f254 (patch)
tree6755552d8a9ce2d82f7da4ac668baa85e8295ce6 /sys/netinet6
parent379a20c4d4a095ab5a5e8c5ba5c3db2f4b9b6e24 (diff)
Relax address availability check for multicast binds.
While it makes sense to limit bind(2) of unicast addresses that overlap each other to be all from the same UID (like 0.0.0.0:53 and 127.0.0.1:53) it makes little sense for multicast. Multicast is delivered to all sockets that match so there is no risk of someone stealing traffic from someone else. This should hopefully help with mDNS as reported by robert@ OK deraadt@ bluhm@
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/in6_pcb.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index 75fc61ef9d4..115c8167cdf 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_pcb.c,v 1.116 2022/03/21 09:12:34 bluhm Exp $ */
+/* $OpenBSD: in6_pcb.c,v 1.117 2022/04/14 14:10:22 claudio Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -209,16 +209,14 @@ in6_pcbaddrisavail(struct inpcb *inp, struct sockaddr_in6 *sin6, int wild,
if (lport) {
struct inpcb *t;
- if (so->so_euid) {
- t = in_pcblookup_local(table,
- (struct in_addr *)&sin6->sin6_addr, lport,
+ if (so->so_euid && !IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) {
+ t = in_pcblookup_local(table, &sin6->sin6_addr, lport,
INPLOOKUP_WILDCARD | INPLOOKUP_IPV6,
inp->inp_rtableid);
if (t && (so->so_euid != t->inp_socket->so_euid))
return (EADDRINUSE);
}
- t = in_pcblookup_local(table,
- (struct in_addr *)&sin6->sin6_addr, lport,
+ t = in_pcblookup_local(table, &sin6->sin6_addr, lport,
wild, inp->inp_rtableid);
if (t && (reuseport & t->inp_socket->so_options) == 0)
return (EADDRINUSE);