Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/net make it possible to turn on RES_INSECURE[12] wi...



details:   https://anonhg.NetBSD.org/src/rev/81beede622af
branches:  trunk
changeset: 514890:81beede622af
user:      itojun <itojun%NetBSD.org@localhost>
date:      Thu Sep 13 11:05:02 2001 +0000

description:
make it possible to turn on RES_INSECURE[12] with /etc/resolv.conf.
don't connect datagram socket if RES_INSECURE1.
needed to implement IPv6 anycast UDP DNS queries as documented in
<draft-ietf-ipngwg-dns-discovery-02.txt>.
sync with kame.

diffstat:

 lib/libc/net/res_init.c |   8 ++++++--
 lib/libc/net/res_send.c |  14 +++++++++++---
 2 files changed, 17 insertions(+), 5 deletions(-)

diffs (65 lines):

diff -r d5c8ba0a0563 -r 81beede622af lib/libc/net/res_init.c
--- a/lib/libc/net/res_init.c   Thu Sep 13 11:01:49 2001 +0000
+++ b/lib/libc/net/res_init.c   Thu Sep 13 11:05:02 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: res_init.c,v 1.36 2000/08/09 14:41:03 itojun Exp $     */
+/*     $NetBSD: res_init.c,v 1.37 2001/09/13 11:05:02 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.36 2000/08/09 14:41:03 itojun Exp $");
+__RCSID("$NetBSD: res_init.c,v 1.37 2001/09/13 11:05:02 itojun Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -553,6 +553,10 @@
 #endif
                } else if (!strncmp(cp, "inet6", sizeof("inet6") - 1)) {
                        _res.options |= RES_USE_INET6;
+               } else if (!strncmp(cp, "insecure1", sizeof("insecure1") - 1)) {
+                       _res.options |= RES_INSECURE1;
+               } else if (!strncmp(cp, "insecure2", sizeof("insecure2") - 1)) {
+                       _res.options |= RES_INSECURE2;
                }
 #ifdef RES_USE_EDNS0
                else if (!strncmp(cp, "edns0", sizeof("edns0") - 1)) {
diff -r d5c8ba0a0563 -r 81beede622af lib/libc/net/res_send.c
--- a/lib/libc/net/res_send.c   Thu Sep 13 11:01:49 2001 +0000
+++ b/lib/libc/net/res_send.c   Thu Sep 13 11:05:02 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: res_send.c,v 1.33 2001/02/12 09:27:46 itojun Exp $     */
+/*     $NetBSD: res_send.c,v 1.34 2001/09/13 11:05:02 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.33 2001/02/12 09:27:46 itojun Exp $");
+__RCSID("$NetBSD: res_send.c,v 1.34 2001/09/13 11:05:02 itojun Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -669,8 +669,16 @@
                         * however, we don't want to remain connected,
                         * as we wish to receive answers from the first
                         * server to respond.
+                        *
+                        * When the option "insecure1" is specified, we'd
+                        * rather expect to see responses from an "unknown"
+                        * address.  In order to let the kernel accept such
+                        * responses, do not connect the socket here.
+                        * XXX: or do we need an explicit option to disable
+                        * connecting?
                         */
-                       if (_res.nscount == 1 || (try == 0 && ns == 0)) {
+                       if (!(_res.options & RES_INSECURE1) &&
+                           (_res.nscount == 1 || (try == 0 && ns == 0))) {
                                /*
                                 * Connect only if we are sure we won't
                                 * receive a response from another server.



Home | Main Index | Thread Index | Old Index