Date: Wed, 24 Mar 1999 03:30:03 -0800 (PST) From: "Joël Faedi" <Joel.Faedi@esial.u-nancy.fr> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/5139: portmap does not find interfaces correctly Message-ID: <199903241130.DAA18961@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: "Joël Faedi" <Joel.Faedi@esial.u-nancy.fr>
To: "Sheldon Hearn" <sheldonh@iafrica.com>
Cc:
Subject: Re: bin/5139: portmap does not find interfaces correctly
Date: Wed, 24 Mar 1999 12:15:14 +0100
>
>Okay, so could you send diffs against 1.7 ? The problem I had was that
>it was impossible for me to comparre your code against the current code.
>If you could send a diff, I can test it.
>
With the new code, the patch is very small: 1 line for the problem itself,
other lines are only for cleaner code in TEST mode (no gcc warning).
*** from_local-1.7-JF.c Wed Mar 24 12:10:01 1999
--- from_local-1.7.c Fri Mar 19 15:47:39 1999
***************
*** 40,46 ****
static char sccsid[] = "@(#) from_local.c 1.2 93/11/16 21:50:02";
#endif
static const char rcsid[] =
! "$Id: from_local.c,v 1.xxx 1999/03/24 11:25:49 xxx Exp $";
#endif
#include <sys/types.h>
--- 40,50 ----
static char sccsid[] = "@(#) from_local.c 1.2 93/11/16 21:50:02";
#endif
static const char rcsid[] =
! "$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>
***************
*** 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
--- 62,67 ----
***************
*** 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)
--- 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)
***************
*** 180,195 ****
#ifdef TEST
- int
main()
{
! int res, i;
! res = find_local();
! printf("results: num_local=%d find_local()=%d\n", num_local, res);
for (i = 0; i < num_local; i++)
printf("%s\n", inet_ntoa(addrs[i]));
- exit(0);
}
#endif
--- 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
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?199903241130.DAA18961>
