Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 May 1999 05:50:03 -0700 (PDT)
From:      Joel Faedi <Joel.Faedi@esial.u-nancy.fr>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/5139: portmap does not find interfaces correctly
Message-ID:  <199905281250.FAA51692@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/5139; it has been noted by GNATS.

From: Joel Faedi <Joel.Faedi@esial.u-nancy.fr>
To: sheldonh@iafrica.com
Cc:  
Subject: Re: bin/5139: portmap does not find interfaces correctly
Date: Wed, 7 Apr 1999 17:29:36 +0200 (MET DST)

 Here is a better patch file...
 
 generated with:
 1) ftp ftp://ftp.freebsd.org/pub/FreeBSD/branches/-current/src/usr.sbin/portmap/from_local.c
 2) diff -c from_local.c from_local.c.new > from_local.patch
 
 Here is the file "from_local.patch"
 
 *** from_local.c	Mon Aug 17 12:13:45 1998
 --- from_local.c.new	Wed Apr  7 17:28:26 1999
 ***************
 *** 43,52 ****
   	"$Id: from_local.c,v 1.7 1998/08/17 06:05:55 jb Exp $";
   #endif
   
 - #ifdef TEST
 - #undef perror
 - #endif
 - 
   #include <sys/types.h>
   #include <sys/ioctl.h>
   #include <sys/socket.h>
 --- 43,48 ----
 ***************
 *** 62,67 ****
 --- 58,69 ----
   #include <net/if_dl.h>
   #include <netinet/in.h>
   
 + #ifdef TEST
 + #include <arpa/inet.h>
 + #include <string.h>
 + #include <stdio.h>
 + #endif
 + 
   #ifndef TRUE
   #define	TRUE	1
   #define FALSE	0
 ***************
 *** 135,141 ****
       else if (ifr.ifr_flags & IFF_UP)    /* active interface */
         if (ioctl(s, SIOCGIFADDR, &ifr) < 0)
           perror("SIOCGIFADDR");
 !       else {
           if (alloced < num_local + 1) {
             alloced += ESTIMATED_LOCAL;
             if (addrs)
 --- 137,143 ----
       else if (ifr.ifr_flags & IFF_UP)    /* active interface */
         if (ioctl(s, SIOCGIFADDR, &ifr) < 0)
           perror("SIOCGIFADDR");
 !       else if (ifr.ifr_addr.sa_family == AF_INET) { /* IP net interface only */
           if (alloced < num_local + 1) {
             alloced += ESTIMATED_LOCAL;
             if (addrs)
 ***************
 *** 178,191 ****
   
   #ifdef TEST
   
   main()
   {
 !     char   *inet_ntoa();
 !     int     i;
   
 !     find_local();
       for (i = 0; i < num_local; i++)
   	printf("%s\n", inet_ntoa(addrs[i]));
   }
   
   #endif
 --- 180,194 ----
   
   #ifdef TEST
   
 + int
   main()
   {
 !     int     res, i;
   
 !     res = find_local();
       for (i = 0; i < num_local; i++)
   	printf("%s\n", inet_ntoa(addrs[i]));
 +     exit(0);
   }
   
   #endif
 
 


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?199905281250.FAA51692>