freebsd-dev/lib/libc
Bill Paul b1d8279802 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.
1997-06-20 17:54:11 +00:00
..
amd64 Changed all paths to be relative to src/lib instead of src/lib/libc 1997-05-03 03:50:06 +00:00
compat-43 Changed all paths to be relative to src/lib instead of src/lib/libc 1997-05-03 03:50:06 +00:00
db Changed all paths to be relative to src/lib instead of src/lib/libc 1997-05-03 03:50:06 +00:00
gen Change u_char which require special include to unsigned char 1997-06-14 01:28:59 +00:00
gmon Changed all paths to be relative to src/lib instead of src/lib/libc 1997-05-03 03:50:06 +00:00
i386 Changed all paths to be relative to src/lib instead of src/lib/libc 1997-05-03 03:50:06 +00:00
locale Completely remove #ifdefed out 8859-1 extension, I found it break 1997-05-14 00:11:02 +00:00
net Typo. 1997-06-18 06:26:13 +00:00
nls Plug even more failure memory leaks 1997-05-10 04:40:40 +00:00
quad Changed all paths to be relative to src/lib instead of src/lib/libc 1997-05-03 03:50:06 +00:00
regex Changed all paths to be relative to src/lib instead of src/lib/libc 1997-05-03 03:50:06 +00:00
rpc Hm... wonder how long this has been here. 1997-06-20 17:54:11 +00:00
stdio Changed all paths to be relative to src/lib instead of src/lib/libc 1997-05-03 03:50:06 +00:00
stdlib srandomdev: use stack junk value in the fallback code too 1997-06-15 18:23:19 +00:00
stdtime it's'' -> its'' where appropriate and typo fixes in time2posix.3. 1997-05-19 16:33:27 +00:00
string Changed all paths to be relative to src/lib instead of src/lib/libc 1997-05-03 03:50:06 +00:00
sys Submitted by: Whistle Communications (archie Cobbs) 1997-06-02 06:24:52 +00:00
xdr Restore Id. 1997-05-28 16:29:12 +00:00
yp Use ${DESTDIR} correctly in front of absolute paths. 1997-05-23 08:24:00 +00:00
Makefile Use ${DESTDIR} correctly in front of absolute paths. 1997-05-23 08:24:00 +00:00
Makefile.inc Changed all paths to be relative to src/lib instead of src/lib/libc 1997-05-03 03:50:06 +00:00