From jc@irbs.com  Tue Jan 30 18:31:53 1996
Received: from goombay.irbs.com (goombay.irbs.com [205.216.79.250])
          by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id SAA03077
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 30 Jan 1996 18:31:47 -0800 (PST)
Received: (from jc@localhost) by goombay.irbs.com (8.6.12/8.6.6) id VAA19105; Tue, 30 Jan 1996 21:31:06 -0500
Message-Id: <199601310231.VAA19105@goombay.irbs.com>
Date: Tue, 30 Jan 1996 21:31:06 -0500
From: John Capo <jc@irbs.com>
Reply-To: jc@irbs.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: clnt_broadcast() is not aware of aliases
X-Send-Pr-Version: 3.2

>Number:         981
>Category:       bin
>Synopsis:       clnt_broadcast() is not aware of aliases
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    fenner
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 30 18:40:10 PST 1996
>Closed-Date:    Wed Oct 05 06:38:27 GMT 2005
>Last-Modified:  Wed Oct 05 06:38:27 GMT 2005
>Originator:     John Capo
>Release:        FreeBSD 2.1-STABLE i386
>Organization:
IRBS Engineering
>Environment:

-stable and probably -current.

>Description:

clnt_broadcast() sends a broadcast packet for each aliased address
on an interface.

>How-To-Repeat:

Run ypbind on a system with an Ethernet if that has alias addresses.

>Fix:
	
*** lib/libc/rpc/pmap_rmt.c.orig	Tue May 30 01:41:27 1995
--- lib/libc/rpc/pmap_rmt.c	Tue Jan 30 20:20:55 1996
***************
*** 166,171 ****
--- 166,172 ----
  	int sock;  /* any valid socket will do */
  	char *buf;  /* why allocxate more when we can use existing... */
  {
+ 	struct in_addr addr;
  	struct ifconf ifc;
          struct ifreq ifreq, *ifr;
  	struct sockaddr_in *sin;
***************
*** 196,208 ****
  			sin = (struct sockaddr_in *)&ifr->ifr_addr;
  #ifdef SIOCGIFBRDADDR   /* 4.3BSD */
  			if (ioctl(sock, SIOCGIFBRDADDR, (char *)&ifreq) < 0) {
! 				addrs[i++] =
! 				    inet_makeaddr(inet_netof(sin->sin_addr),
  				    INADDR_ANY);
  			} else {
! 				addrs[i++] = ((struct sockaddr_in*)
  				  &ifreq.ifr_addr)->sin_addr;
  			}
  #else /* 4.2 BSD */
  			addrs[i++] = inet_makeaddr(inet_netof(sin->sin_addr),
  			    INADDR_ANY);
--- 197,216 ----
  			sin = (struct sockaddr_in *)&ifr->ifr_addr;
  #ifdef SIOCGIFBRDADDR   /* 4.3BSD */
  			if (ioctl(sock, SIOCGIFBRDADDR, (char *)&ifreq) < 0) {
! 				addr = inet_makeaddr(inet_netof(sin->sin_addr),
  				    INADDR_ANY);
  			} else {
! 				addr = ((struct sockaddr_in*)
  				  &ifreq.ifr_addr)->sin_addr;
  			}
+ 
+ 			for (n = 0; n < i; n++) {
+ 				if (memcmp(&addrs[n], &addr, sizeof (addr)) == 0)
+ 					goto duplicate;
+ 
+ 			}
+ 			addrs[i++] = addr;
+ duplicate:
  #else /* 4.2 BSD */
  			addrs[i++] = inet_makeaddr(inet_netof(sin->sin_addr),
  			    INADDR_ANY);

>Release-Note:
>Audit-Trail:

From: Bill Fenner <fenner@parc.xerox.com>
To: jc@irbs.com
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/981: clnt_broadcast() is not aware of aliases 
Date: Wed, 31 Jan 1996 10:03:28 PST

 In message <199601310231.VAA19105@goombay.irbs.com> you write:
 >>Description:
 >
 >clnt_broadcast() sends a broadcast packet for each aliased address
 >on an interface.
 
 Which is arguably correct, if it sends to the broadcast address for that 
 alias.  (I have an as-yet-uncommitted fix that allows programs to get netmasks 
 and broadcast addresses for aliases).
 
 Of course, then it needs to discard overlapping subnets for the people who use 
 alias to give their machine multiple IP addresses on the same subnet as 
 opposed to giving it addresses on different subnets.
 
   Bill
 
Responsible-Changed-From-To: freebsd-bugs->fenner 
Responsible-Changed-By: pst 
Responsible-Changed-When: Wed Feb 7 17:03:17 PST 1996 
Responsible-Changed-Why:  
State-Changed-From-To: open->analyzed 
State-Changed-By: fenner 
State-Changed-When: Wed Apr 3 10:52:26 PST 1996 
State-Changed-Why:  
The recent change to SIOCGIFBRDADDR means that same-subnet aliases will 
get packets unicasted to their address.  The duplicate-checking code needs 
to be expanded to check if the address of the current interface is in the 
same subnet as another address that we already have in our list (and the 
interface name is the same). 

From: Bill Fenner <fenner@parc.xerox.com>
To: freebsd-gnats-submit@freebsd.org, jc@irbs.com, wpaul@freebsd.org
Cc:  Subject: Re: bin/981: clnt_broadcast() is not aware of aliases
Date: Sat, 5 Jul 1997 13:45:21 PDT

 The bug in the PR was fixed in rev 1.5 by guido.  However, now this is
 broken in a different, subtle way -- if you have aliases on a different
 subnet, as opposed to aliases on the same subnet (which most people use),
 it won't broadcast on the alternate subnet.
 
 I believe this patch fixes the problem and lets both cases work properly.
 This causes SIOCGIFBRDADDR to get the broadcast address for the particular
 alias we're looking up and not for the first address on the interface.
 
   Bill
 
 cvs diff: Diffing .
 Index: pmap_rmt.c
 ===================================================================
 RCS file: /home/ncvs/src/lib/libc/rpc/pmap_rmt.c,v
 retrieving revision 1.11
 diff -u -r1.11 pmap_rmt.c
 --- pmap_rmt.c	1997/02/22 15:01:19	1.11
 +++ pmap_rmt.c	1997/07/05 20:11:30
 @@ -198,6 +198,7 @@
  		    (ifreq.ifr_flags & IFF_UP)) {
  			sin = (struct sockaddr_in *)&ifr->ifr_addr;
  #ifdef SIOCGIFBRDADDR   /* 4.3BSD */
 +			ifreq = *ifr;
  			if (ioctl(sock, SIOCGIFBRDADDR, (char *)&ifreq) < 0) {
  				addr =
  				    inet_makeaddr(inet_netof(sin->sin_addr),
State-Changed-From-To: analyzed->closed 
State-Changed-By: rodrigc 
State-Changed-When: Wed Oct 5 06:34:32 GMT 2005 
State-Changed-Why:  
pmap_rmt.c has been refactored greatly since this original PR, 
so the patches mentioned in the audit trail to do apply 

http://www.freebsd.org/cgi/query-pr.cgi?pr=981 
>Unformatted:
