From richier@tuna.imag.fr  Wed Feb  5 05:30:19 1997
Received: from tuna.imag.fr (tuna.imag.fr [192.44.68.19])
          by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id FAA14699
          for <FreeBSD-gnats-submit@freebsd.org>; Wed, 5 Feb 1997 05:30:16 -0800 (PST)
Received: (from richier@localhost) by tuna.imag.fr (8.8.3/8.8.3) id OAA00505; Wed, 5 Feb 1997 14:29:44 +0100 (MET)
Message-Id: <199702051329.OAA00505@tuna.imag.fr>
Date: Wed, 5 Feb 1997 14:29:44 +0100 (MET)
From: Jean-Luc.Richier@imag.fr
Reply-To: Jean-Luc.Richier@imag.fr
To: FreeBSD-gnats-submit@freebsd.org
Subject: modification suggested for rarpd
X-Send-Pr-Version: 3.2

>Number:         2668
>Category:       bin
>Synopsis:       modification suggested for rarpd
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb  5 05:40:02 PST 1997
>Closed-Date:    Sat May 27 04:54:58 PDT 2000
>Last-Modified:  Sat May 27 04:57:46 PDT 2000
>Originator:     Jean-Luc Richier
>Release:        FreeBSD 2.1.6-RELEASE i386
>Organization:
Institut IMAg, Grenoble, France
>Environment:


>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	Wed Jun  5 04:57:54 1996
--- usr.sbin/rarpd/rarpd.c	Wed Feb  5 11:46:24 1997
***************
*** 114,119 ****
--- 114,122 ----
  void lookup_eaddr();
  void lookup_ipaddr();
  
+ int aflag = 0;		/* listen on "all" interfaces  */
+ int fflag = 0;		/* don't fork */
+ 
  void
  main(argc, argv)
  	int argc;
***************
*** 122,130 ****
  	int op, pid;
  	char *ifname, *hostname, *name;
  
- 	int aflag = 0;		/* listen on "all" interfaces  */
- 	int fflag = 0;		/* don't fork */
- 
  	extern char *optarg;
  	extern int optind, opterr;
  
--- 125,130 ----
***************
*** 186,195 ****
  
  
  	p = (struct if_info *)malloc(sizeof(*p));
  	p->ii_next = iflist;
  	iflist = p;
  
- 	p->ii_fd = rarp_open(ifname);
  	lookup_eaddr(p->ii_fd, p->ii_eaddr);
  	lookup_ipaddr(ifname, &p->ii_ipaddr, &p->ii_netmask);
  }
--- 186,198 ----
  
  
  	p = (struct if_info *)malloc(sizeof(*p));
+ 	p->ii_fd = rarp_open(ifname);
+ 	if (p->ii_fd < 0)
+ 		return;
+ 
  	p->ii_next = iflist;
  	iflist = p;
  
  	lookup_eaddr(p->ii_fd, p->ii_eaddr);
  	lookup_ipaddr(ifname, &p->ii_ipaddr, &p->ii_netmask);
  }
***************
*** 305,310 ****
--- 308,317 ----
  	}
  	(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;
+ 		}
  		syslog(LOG_ERR, "BIOCSETIF: %m");
  		exit(1);
  	}
***************
*** 317,322 ****
--- 324,333 ----
  		exit(1);
  	}
  	if (link_type != DLT_EN10MB) {
+ 		if (aflag) {	/* for -a skip not ethernet interfaces */
+ 			close(fd);
+ 			return -1;
+ 		}
  		syslog(LOG_ERR, "%s not on ethernet", device);
  		exit(1);
  	}
>Release-Note:
>Audit-Trail:

From: Jean-Luc Richier <Jean-Luc.Richier@imag.fr>
To: FreeBSD-gnats@freefall.freebsd.org, freebsd-bugs@freefall.freebsd.org
Cc:  Subject: Re: bin/2668: modification suggested for rarpd
Date: Wed, 5 Feb 1997 15:28:57 +0100 (MET)

 In your mail dated 5 Feb  5:40 you write :
 >Thank you very much for your problem report.
 >It has the internal identification `bin/2668'.
 >The individual assigned to look at your
 >bug is: freebsd-bugs. 
 >
 >>Category:       bin
 >>Responsible:    freebsd-bugs
 >>Synopsis:       modification suggested for rarpd
 >>Arrival-Date:   Wed Feb  5 05:40:02 PST 1997
 
 First an apology : The previous message was about NetBSD and not FreeBSD.
 This one is the correct.
 
 Following a remark of Theo de Raadt <deraadt@theos.com> about a memory leak
 in my suggested patch, here is a updated version for FreeBSD
 
 I hope this will help you
 
 *** rarpd.c.DIST	Wed Jun  5 04:57:54 1996
 --- rarpd.c	Wed Feb  5 15:15:55 1997
 ***************
 *** 114,119 ****
 --- 114,122 ----
   void lookup_eaddr();
   void lookup_ipaddr();
   
 + int aflag = 0;		/* listen on "all" interfaces  */
 + int fflag = 0;		/* don't fork */
 + 
   void
   main(argc, argv)
   	int argc;
 ***************
 *** 122,130 ****
   	int op, pid;
   	char *ifname, *hostname, *name;
   
 - 	int aflag = 0;		/* listen on "all" interfaces  */
 - 	int fflag = 0;		/* don't fork */
 - 
   	extern char *optarg;
   	extern int optind, opterr;
   
 --- 125,130 ----
 ***************
 *** 183,195 ****
   	char *ifname;
   {
   	struct if_info *p;
   
   
   	p = (struct if_info *)malloc(sizeof(*p));
   	p->ii_next = iflist;
   	iflist = p;
   
 ! 	p->ii_fd = rarp_open(ifname);
   	lookup_eaddr(p->ii_fd, p->ii_eaddr);
   	lookup_ipaddr(ifname, &p->ii_ipaddr, &p->ii_netmask);
   }
 --- 183,199 ----
   	char *ifname;
   {
   	struct if_info *p;
 + 	int fd;
   
 + 	fd = rarp_open(ifname);
 + 	if (fd < 0)
 + 		return;
   
   	p = (struct if_info *)malloc(sizeof(*p));
   	p->ii_next = iflist;
   	iflist = p;
   
 ! 	p->ii_next = fd;
   	lookup_eaddr(p->ii_fd, p->ii_eaddr);
   	lookup_ipaddr(ifname, &p->ii_ipaddr, &p->ii_netmask);
   }
 ***************
 *** 305,310 ****
 --- 309,318 ----
   	}
   	(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;
 + 		}
   		syslog(LOG_ERR, "BIOCSETIF: %m");
   		exit(1);
   	}
 ***************
 *** 317,322 ****
 --- 325,334 ----
   		exit(1);
   	}
   	if (link_type != DLT_EN10MB) {
 + 		if (aflag) {	/* for -a skip not ethernet interfaces */
 + 			close(fd);
 + 			return -1;
 + 		}
   		syslog(LOG_ERR, "%s not on ethernet", device);
   		exit(1);
   	}
 
 -- 
 Jean-Luc RICHIER (Jean-Luc.Richier@Imag.Fr  richier@imag.fr)
 Laboratoire Logiciels, Systemes et Reseaux (LSR-IMAG)
 IMAG-CAMPUS, BP 53, F-38041 GRENOBLE Cedex 9
 Tel : (33) 4 76 82 72 32 Fax : (33) 4 76 82 72 87
 
State-Changed-From-To: open->feedback 
State-Changed-By: wilko 
State-Changed-When: Thu Apr 20 12:06:30 PDT 2000 
State-Changed-Why:  
Hello Jean-Luc, 

Apologies for keeping this change request on the back-burner for so long. 
But now that FreeBSD-4.0 has been released with integrated IPV6 can you 
please check if the issue has been resolved ? 

Wilko 

State-Changed-From-To: feedback->closed 
State-Changed-By: wilko 
State-Changed-When: Sat May 27 04:54:58 PDT 2000 
State-Changed-Why:  
Could not get feedback from PR submitter. As this a very 
old PR (1997) and IPV6 has now been integrated it makes 
sense to start from the current state of the system as 
opposed to 1997-era code. 

>Unformatted:
 
