Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/net if the list of name server on /etc/resolv.conf ...



details:   https://anonhg.NetBSD.org/src/rev/d45052cc9196
branches:  trunk
changeset: 474347:d45052cc9196
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sun Jul 04 03:52:55 1999 +0000

description:
if the list of name server on /etc/resolv.conf is in a
non-supported AF, try the next nameserver instead of abort.

This helps situations like:
- you write IPv6 nameserver into /etc/resolv.conf and
- run non-IPv6 kernel

diffstat:

 lib/libc/net/res_init.c |   9 ++++++---
 lib/libc/net/res_send.c |  16 ++++++++++++++--
 2 files changed, 20 insertions(+), 5 deletions(-)

diffs (76 lines):

diff -r 416c84a53ec4 -r d45052cc9196 lib/libc/net/res_init.c
--- a/lib/libc/net/res_init.c   Sun Jul 04 03:12:47 1999 +0000
+++ b/lib/libc/net/res_init.c   Sun Jul 04 03:52:55 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: res_init.c,v 1.25 1999/07/04 00:43:44 itojun Exp $     */
+/*     $NetBSD: res_init.c,v 1.26 1999/07/04 03:52:55 itojun Exp $     */
 
 /*-
  * Copyright (c) 1985, 1989, 1993
@@ -59,7 +59,7 @@
 static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
 static char rcsid[] = "Id: res_init.c,v 8.8 1997/06/01 20:34:37 vixie Exp ";
 #else
-__RCSID("$NetBSD: res_init.c,v 1.25 1999/07/04 00:43:44 itojun Exp $");
+__RCSID("$NetBSD: res_init.c,v 1.26 1999/07/04 03:52:55 itojun Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -299,7 +299,10 @@
                        sin6->sin6_port = htons(NAMESERVER_PORT);
                        /* just for safety */
                        memset(&_res.nsaddr_list[nserv], 0,
-                           sizeof(_res.nsaddr_list[nserv]));
+                               sizeof(_res.nsaddr_list[nserv]));
+                       _res.nsaddr_list[nserv].sin_family = AF_INET;
+                       _res.nsaddr_list[nserv].sin_len =
+                               sizeof(struct sockaddr_in);
                        nserv++;
                    } else if (inet_pton(AF_INET, cp, &a) == 1) {
                        struct sockaddr_in *sin;
diff -r 416c84a53ec4 -r d45052cc9196 lib/libc/net/res_send.c
--- a/lib/libc/net/res_send.c   Sun Jul 04 03:12:47 1999 +0000
+++ b/lib/libc/net/res_send.c   Sun Jul 04 03:52:55 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: res_send.c,v 1.18 1999/07/01 18:19:35 itojun Exp $     */
+/*     $NetBSD: res_send.c,v 1.19 1999/07/04 03:52:55 itojun Exp $     */
 
 /*-
  * Copyright (c) 1985, 1989, 1993
@@ -59,7 +59,7 @@
 static char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
 static char rcsid[] = "Id: res_send.c,v 8.13 1997/06/01 20:34:37 vixie Exp ";
 #else
-__RCSID("$NetBSD: res_send.c,v 1.18 1999/07/01 18:19:35 itojun Exp $");
+__RCSID("$NetBSD: res_send.c,v 1.19 1999/07/04 03:52:55 itojun Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -432,7 +432,13 @@
                                if (s < 0) {
                                        terrno = errno;
                                        Perror(stderr, "socket(vc)", errno);
+#if 0
                                        return (-1);
+#else
+                                       badns |= (1 << ns);
+                                       res_close();
+                                       goto next_ns;
+#endif
                                }
                                errno = 0;
                                if (connect(s, (struct sockaddr *)(void *)nsap,
@@ -569,7 +575,13 @@
 #endif
                                        terrno = errno;
                                        Perror(stderr, "socket(dg)", errno);
+#if 0
                                        return (-1);
+#else
+                                       badns |= (1 << ns);
+                                       res_close();
+                                       goto next_ns;
+#endif
                                }
                                connected = 0;
                        }



Home | Main Index | Thread Index | Old Index