From owner-freebsd-bugs Tue Sep 15 17:01:27 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA10970 for freebsd-bugs-outgoing; Tue, 15 Sep 1998 17:01:27 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA10778 for ; Tue, 15 Sep 1998 17:00:23 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id RAA06941; Tue, 15 Sep 1998 17:00:01 -0700 (PDT) Date: Tue, 15 Sep 1998 17:00:01 -0700 (PDT) Message-Id: <199809160000.RAA06941@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.ORG From: Bill Fenner Subject: Re: kern/7713: problem with reusing ports with multicast Reply-To: Bill Fenner Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR kern/7713; it has been noted by GNATS. From: Bill Fenner To: freebsd-gnats-submit@FreeBSD.org, luigi@prova.iet.unipi.it Cc: Subject: Re: kern/7713: problem with reusing ports with multicast Date: Tue, 15 Sep 1998 16:50:50 -0700 (PDT) I think this patch is more complete, as it allows different users to bind INADDR_ANY as long as SO_REUSEPORT is set. Unicast applications don't set SO_REUSEPORT, so will still be protected, while multicast applications that bind to INADDR_ANY will still be allowed to be run by different uid's. Bill cvs diff: Diffing . Index: in_pcb.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/in_pcb.c,v retrieving revision 1.44 diff -u -r1.44 in_pcb.c --- in_pcb.c 1998/05/15 20:11:32 1.44 +++ in_pcb.c 1998/09/15 22:54:27 @@ -197,10 +197,16 @@ if (ntohs(lport) < IPPORT_RESERVED && p && suser(p->p_ucred, &p->p_acflag)) return (EACCES); - if (so->so_uid) { + if (so->so_uid && + !IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) { t = in_pcblookup_local(inp->inp_pcbinfo, sin->sin_addr, lport, INPLOOKUP_WILDCARD); - if (t && (so->so_uid != t->inp_socket->so_uid)) + if (t && + (ntohl(sin->sin_addr.s_addr) != INADDR_ANY || + ntohl(t->inp_laddr.s_addr) != INADDR_ANY || + (t->inp_socket->so_options & + SO_REUSEPORT) == 0) && + (so->so_uid != t->inp_socket->so_uid)) return (EADDRINUSE); } t = in_pcblookup_local(pcbinfo, sin->sin_addr, To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message