Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/net query NIS hosts.byname only when necessary (= P...



details:   https://anonhg.NetBSD.org/src/rev/3da132cbae12
branches:  trunk
changeset: 482738:3da132cbae12
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sun Feb 20 17:07:01 2000 +0000

description:
query NIS hosts.byname only when necessary (= PF_UNSPEC of PF_INET queries).

diffstat:

 lib/libc/net/getaddrinfo.c |  26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diffs (41 lines):

diff -r 84f159596dc4 -r 3da132cbae12 lib/libc/net/getaddrinfo.c
--- a/lib/libc/net/getaddrinfo.c        Sun Feb 20 16:18:51 2000 +0000
+++ b/lib/libc/net/getaddrinfo.c        Sun Feb 20 17:07:01 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getaddrinfo.c,v 1.32 2000/02/20 14:44:30 itojun Exp $  */
+/*     $NetBSD: getaddrinfo.c,v 1.33 2000/02/20 17:07:01 itojun Exp $  */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -1506,18 +1506,20 @@
        __ypcurrent = NULL;
 
        /* hosts.byname is only for IPv4 (Solaris8) */
-       r = yp_match(__ypdomain, "hosts.byname", name,
-               (int)strlen(name), &__ypcurrent, &__ypcurrentlen);
-       if (r == 0) {
-               struct addrinfo ai4;
+       if (pai->ai_family == PF_UNSPEC || pai->ai_family == PF_INET) {
+               r = yp_match(__ypdomain, "hosts.byname", name,
+                       (int)strlen(name), &__ypcurrent, &__ypcurrentlen);
+               if (r == 0) {
+                       struct addrinfo ai4;
 
-               ai4 = *pai;
-               ai4.ai_family = AF_INET;
-               ai = _yphostent(__ypcurrent, &ai4);
-               if (ai) {
-                       cur->ai_next = ai;
-                       while (cur && cur->ai_next)
-                               cur = cur->ai_next;
+                       ai4 = *pai;
+                       ai4.ai_family = AF_INET;
+                       ai = _yphostent(__ypcurrent, &ai4);
+                       if (ai) {
+                               cur->ai_next = ai;
+                               while (cur && cur->ai_next)
+                                       cur = cur->ai_next;
+                       }
                }
        }
 



Home | Main Index | Thread Index | Old Index