Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Sep 1998 17:00:01 -0700 (PDT)
From:      Bill Fenner <fenner@FreeBSD.ORG>
To:        freebsd-bugs@FreeBSD.ORG
Subject:   Re: kern/7713: problem with reusing ports with multicast
Message-ID:  <199809160000.RAA06941@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

The following reply was made to PR kern/7713; it has been noted by GNATS.

From: Bill Fenner <fenner@FreeBSD.ORG>
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809160000.RAA06941>