Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst Only prompt for one nameserver, let the use...



details:   https://anonhg.NetBSD.org/src/rev/b19bf71544d6
branches:  trunk
changeset: 332252:b19bf71544d6
user:      roy <roy%NetBSD.org@localhost>
date:      Sat Sep 13 00:38:36 2014 +0000

description:
Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.

diffstat:

 usr.sbin/sysinst/defs.h   |   4 +-
 usr.sbin/sysinst/menus.mi |  10 +++---
 usr.sbin/sysinst/net.c    |  72 +++++++++++++++-------------------------------
 3 files changed, 30 insertions(+), 56 deletions(-)

diffs (193 lines):

diff -r 980c33c4a14c -r b19bf71544d6 usr.sbin/sysinst/defs.h
--- a/usr.sbin/sysinst/defs.h   Sat Sep 13 00:33:45 2014 +0000
+++ b/usr.sbin/sysinst/defs.h   Sat Sep 13 00:38:36 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.3 2014/08/06 10:03:49 martin Exp $  */
+/*     $NetBSD: defs.h,v 1.4 2014/09/13 00:38:36 roy Exp $     */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -489,7 +489,7 @@
 
 /* from net.c */
 extern int network_up;
-extern char net_namesvr6[STRSIZE];
+extern char net_namesvr[STRSIZE];
 int    get_via_ftp(const char *);
 int    get_via_nfs(void);
 int    config_network(void);
diff -r 980c33c4a14c -r b19bf71544d6 usr.sbin/sysinst/menus.mi
--- a/usr.sbin/sysinst/menus.mi Sat Sep 13 00:33:45 2014 +0000
+++ b/usr.sbin/sysinst/menus.mi Sat Sep 13 00:38:36 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: menus.mi,v 1.4 2014/08/06 10:03:49 martin Exp $        */
+/*     $NetBSD: menus.mi,v 1.5 2014/09/13 00:38:36 roy Exp $   */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -480,8 +480,8 @@
        option "google-public-dns-a.google.com", exit, action
                {
 #ifdef INET6
-                 strlcpy(net_namesvr6, "2001:4860:4860::8888",
-                     sizeof(net_namesvr6));
+                 strlcpy(net_namesvr, "2001:4860:4860::8888",
+                     sizeof(net_namesvr));
                  yesno = 1;
 #else
                  yesno = 0;
@@ -490,8 +490,8 @@
        option "google-public-dns-b.google.com", exit, action
                {
 #ifdef INET6
-                 strlcpy(net_namesvr6, "2001:4860:4860::8844",
-                     sizeof(net_namesvr6));
+                 strlcpy(net_namesvr, "2001:4860:4860::8844",
+                     sizeof(net_namesvr));
                  yesno = 1;
 #else
                  yesno = 0;
diff -r 980c33c4a14c -r b19bf71544d6 usr.sbin/sysinst/net.c
--- a/usr.sbin/sysinst/net.c    Sat Sep 13 00:33:45 2014 +0000
+++ b/usr.sbin/sysinst/net.c    Sat Sep 13 00:38:36 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: net.c,v 1.9 2014/09/12 21:12:42 roy Exp $      */
+/*     $NetBSD: net.c,v 1.10 2014/09/13 00:38:36 roy Exp $     */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -76,7 +76,7 @@
 static char net_ip[SSTRSIZE];
 static char net_srv_ip[SSTRSIZE];
 static char net_mask[SSTRSIZE];
-static char net_namesvr[STRSIZE];
+char net_namesvr[STRSIZE];
 static char net_defroute[STRSIZE];
 static char net_media[STRSIZE];
 static char sl_flags[STRSIZE];
@@ -87,8 +87,6 @@
 #define DHCPCONF_DOMAIN         0x08
 #ifdef INET6
 static char net_ip6[STRSIZE];
-char net_namesvr6[STRSIZE];
-static int net_ip6conf;
 #define IP6CONF_AUTOHOST        0x01
 #endif
 
@@ -716,28 +714,19 @@
                    sizeof net_defroute);
        }
 
-       if (!dhcp_config || net_namesvr[0] == 0)
+       if (!(net_dhcpconf & DHCPCONF_NAMESVR)) {
+#ifdef INET6
+               if (v6config) {
+                       process_menu(MENU_namesrv6, NULL);
+                       if (!yesno)
+                               msg_prompt_add(MSG_net_namesrv, net_namesvr,
+                                   net_namesvr, sizeof net_namesvr);
+               } else
+#endif
                msg_prompt_add(MSG_net_namesrv, net_namesvr, net_namesvr,
                    sizeof net_namesvr);
-
-#ifdef INET6
-       /* IPv6 autoconfiguration */
-       if (!is_v6kernel())
-               v6config = 0;
-       else if (v6config) {
-               process_menu(MENU_noyes, deconst(MSG_Perform_IPv6_autoconfiguration));
-               v6config = yesno ? 1 : 0;
-               net_ip6conf |= yesno ? IP6CONF_AUTOHOST : 0;
        }
 
-       if (v6config) {
-               process_menu(MENU_namesrv6, NULL);
-               if (!yesno)
-                       msg_prompt_add(MSG_net_namesrv6, net_namesvr6,
-                           net_namesvr6, sizeof net_namesvr6);
-       }
-#endif
-
        /* confirm the setting */
        if (slip)
                msg_display(MSG_netok_slip, net_domain, net_host, net_dev,
@@ -757,8 +746,7 @@
 #ifdef INET6
        msg_display_add(MSG_netokv6,
                     !is_v6kernel() ? "<not supported>" :
-                       (v6config ? "yes" : "no"),
-                    *net_namesvr6 == '\0' ? "<none>" : net_namesvr6);
+                       (v6config ? "yes" : "no"));
 #endif
 done:
        process_menu(MENU_yesno, deconst(MSG_netok_ok));
@@ -781,11 +769,7 @@
         */
 
        /* Create /etc/resolv.conf if a nameserver was given */
-       if (net_namesvr[0] != '\0'
-#ifdef INET6
-           || net_namesvr6[0] != '\0'
-#endif
-               ) {
+       if (net_namesvr[0] != '\0') {
                f = fopen("/etc/resolv.conf", "w");
                if (f == NULL) {
                        if (logfp)
@@ -803,10 +787,6 @@
                        scripting_fprintf(f, "search %s\n", net_domain);
                if (net_namesvr[0] != '\0')
                        scripting_fprintf(f, "nameserver %s\n", net_namesvr);
-#ifdef INET6
-               if (net_namesvr6[0] != '\0')
-                       scripting_fprintf(f, "nameserver %s\n", net_namesvr6);
-#endif
                scripting_fprintf(NULL, "EOF\n");
                fflush(NULL);
                fclose(f);
@@ -876,16 +856,19 @@
        if (v6config && network_up) {
                network_up = !run_program(RUN_DISPLAY | RUN_PROGRESS,
                    "/sbin/ping6 -v -c 3 -n -I %s ff02::2", net_dev);
-
-               if (net_namesvr6[0] != '\0')
-                       network_up = !run_program(RUN_DISPLAY | RUN_PROGRESS,
-                           "/sbin/ping6 -v -c 3 -n %s", net_namesvr6);
        }
 #endif
 
-       if (net_namesvr[0] != '\0' && network_up)
-               network_up = !run_program(RUN_DISPLAY | RUN_PROGRESS,
-                   "/sbin/ping -v -c 5 -w 5 -o -n %s", net_namesvr);
+       if (net_namesvr[0] != '\0' && network_up) {
+#ifdef INET6
+               if (strchr(net_namesvr, ':'))
+                       network_up = !run_program(RUN_DISPLAY | RUN_PROGRESS,
+                           "/sbin/ping6 -v -c 3 -n %s", net_namesvr);
+               else
+#endif
+                       network_up = !run_program(RUN_DISPLAY | RUN_PROGRESS,
+                           "/sbin/ping -v -c 5 -w 5 -o -n %s", net_namesvr);
+       }
 
        if (net_defroute[0] != '\0' && network_up)
                network_up = !run_program(RUN_DISPLAY | RUN_PROGRESS,
@@ -1101,17 +1084,8 @@
 
        /* Copy resolv.conf to target.  If DHCP was used to create it,
         * it will be replaced on next boot anyway. */
-#ifndef INET6
        if (net_namesvr[0] != '\0')
                dup_file_into_target("/etc/resolv.conf");
-#else
-       /*
-        * not sure if it is a good idea, to allow dhcp config to
-        * override IPv6 configuration
-        */
-       if (net_namesvr[0] != '\0' || net_namesvr6[0] != '\0')
-               dup_file_into_target("/etc/resolv.conf");
-#endif
 
        /*
         * bring the interface up, it will be necessary for IPv6, and



Home | Main Index | Thread Index | Old Index