Subject: bin/3190: modification proposed in rarpd
To: None <gnats-bugs@gnats.netbsd.org>
From: None <Jean-Luc.Richier@imag.fr>
List: netbsd-bugs
Date: 02/05/1997 14:21:43
>Number:         3190
>Category:       bin
>Synopsis:       modification proposed  in rarpd
>Confidential:   yes
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Feb  5 05:35:02 1997
>Last-Modified:
>Originator:     Jean-Luc Richier
>Organization:
Institut IMAG - Grenoble France
>Release:        1.2
>Environment:
System: NetBSD ganesha.imag.fr 1.2 NetBSD 1.2 (GANESHAv6-multihomed) #3: Wed Feb 5 11:29:38 MET 1997 root@ganesha.imag.fr:/usr/src/sys/arch/sparc/compile/GANESHAv6-multihomed sparc


>Description:
While working on the IPv6 extensions for NetBSD and FreeBSD,
I discovered some problems. They are not bugs in the base code, only
simplified behaviours,  but if one tries to make extensions, these behaviours
raise problems.
Therefore I suggest corrections to the base distribution code.
>How-To-Repeat:
rarpd -a dies if the system includes interfaces UP and not point to point
which are not ethernet. This pauses problems if the machine is a boot server
and includes special interfaces.

>Fix:
if one run rarpd with -a, silently ignores any interfaces which are not
ethernet instead of doing an error exit.

*** usr.sbin/rarpd/rarpd.c.DIST	Thu Mar 21 19:28:23 1996
--- usr.sbin/rarpd/rarpd.c	Wed Feb  5 09:40:45 1997
***************
*** 199,208 ****
  		err(FATAL, "malloc: %s", strerror(errno));
  		/* NOTREACHED */
  	}
  	p->ii_next = iflist;
  	iflist = p;
  
- 	p->ii_fd = rarp_open(ifname);
  	lookup_eaddr(ifname, p->ii_eaddr);
  	lookup_ipaddr(ifname, &p->ii_ipaddr, &p->ii_netmask);
  }
--- 199,211 ----
  		err(FATAL, "malloc: %s", strerror(errno));
  		/* NOTREACHED */
  	}
+ 	p->ii_fd = rarp_open(ifname);
+ 	if (p->ii_fd < 0)
+ 		return;
+ 
  	p->ii_next = iflist;
  	iflist = p;
  
  	lookup_eaddr(ifname, p->ii_eaddr);
  	lookup_ipaddr(ifname, &p->ii_ipaddr, &p->ii_netmask);
  }
***************
*** 317,322 ****
--- 320,329 ----
  	}
  	(void) strncpy(ifr.ifr_name, device, sizeof ifr.ifr_name);
  	if (ioctl(fd, BIOCSETIF, (caddr_t) & ifr) < 0) {
+ 		if (aflag) {	/* for -a skip not ethernet interfaces */
+ 			close(fd);
+ 			return -1;
+ 		}
  		err(FATAL, "BIOCSETIF: %s", strerror(errno));
  		/* NOTREACHED */
  	}
***************
*** 327,332 ****
--- 334,343 ----
  		/* NOTREACHED */
  	}
  	if (dlt != DLT_EN10MB) {
+ 		if (aflag) {	/* for -a skip not ethernet interfaces */
+ 			close(fd);
+ 			return -1;
+ 		}
  		err(FATAL, "%s is not an ethernet", device);
  		/* NOTREACHED */
  	}
>Audit-Trail:
>Unformatted: