From owner-cvs-lib Fri Jun 20 10:56:14 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id KAA15351 for cvs-lib-outgoing; Fri, 20 Jun 1997 10:56:14 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id KAA15238; Fri, 20 Jun 1997 10:54:39 -0700 (PDT) From: Bill Paul Received: (from wpaul@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id KAA25600; Fri, 20 Jun 1997 10:54:12 -0700 (PDT) Date: Fri, 20 Jun 1997 10:54:12 -0700 (PDT) Message-Id: <199706201754.KAA25600@freefall.freebsd.org> To: cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG, cvs-lib@FreeBSD.ORG Subject: cvs commit: src/lib/libc/rpc get_myaddress.c Sender: owner-cvs-lib@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk wpaul 1997/06/20 10:54:12 PDT Modified files: lib/libc/rpc get_myaddress.c Log: Hm... wonder how long this has been here. The logic in get_myaddress() is broken: it always returns the loopback address due to the following rule: if ((ifreq.ifr_flags & IFF_UP) && ifr->ifr_addr.sa_family == AF_INET && (loopback == 1 && (ifreq.ifr_flags & IFF_LOOPBACK))) { The idea is that we want to select the interface address only if it's up and it's in the AF_INET family. If it turns uout we don't have such an interface available, we make a second pass through the loop, this time settling for the loopback interface. But the logic inadvertently locks out all cases when loopback == 0, so nothing is ever selected until the second pass (when loopback == 1). This is changed to: if (((ifreq.ifr_flags & IFF_UP) && ifr->ifr_addr.sa_family == AF_INET) || (loopback == 1 && (ifreq.ifr_flags & IFF_LOOPBACK))) { which I think does the right thing. This is yet another bogon I discovered during NIS+ testing; I need get_myaddress() to work correctly so that the callback code in the client library will work. Revision Changes Path 1.12 +3 -3 src/lib/libc/rpc/get_myaddress.c