Module Name:    src
Committed By:   riz
Date:           Thu May 14 00:30:50 UTC 2015

Modified Files:
        src/usr.sbin/sysinst [netbsd-7]: defs.h menus.mi net.c

Log Message:
Pull up following revision(s) to fix the build (requested by riz in ticket 
#754):
        usr.sbin/sysinst/net.c: revision 1.10
        usr.sbin/sysinst/menus.mi: revision 1.5
        usr.sbin/sysinst/net.c: revision 1.9
        usr.sbin/sysinst/defs.h: revision 1.4
rtsol is no longer used.
Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


To generate a diff of this commit:
cvs rdiff -u -r1.3.4.3 -r1.3.4.4 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.4.4.3 -r1.4.4.4 src/usr.sbin/sysinst/menus.mi
cvs rdiff -u -r1.2.4.2 -r1.2.4.3 src/usr.sbin/sysinst/net.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/sysinst/defs.h
diff -u src/usr.sbin/sysinst/defs.h:1.3.4.3 src/usr.sbin/sysinst/defs.h:1.3.4.4
--- src/usr.sbin/sysinst/defs.h:1.3.4.3	Sat May  9 13:50:15 2015
+++ src/usr.sbin/sysinst/defs.h	Thu May 14 00:30:50 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.3.4.3 2015/05/09 13:50:15 msaitoh Exp $	*/
+/*	$NetBSD: defs.h,v 1.3.4.4 2015/05/14 00:30:50 riz Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -490,7 +490,7 @@ int	get_real_geom(const char *, struct d
 
 /* 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);

Index: src/usr.sbin/sysinst/menus.mi
diff -u src/usr.sbin/sysinst/menus.mi:1.4.4.3 src/usr.sbin/sysinst/menus.mi:1.4.4.4
--- src/usr.sbin/sysinst/menus.mi:1.4.4.3	Wed May 13 17:04:27 2015
+++ src/usr.sbin/sysinst/menus.mi	Thu May 14 00:30:50 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: menus.mi,v 1.4.4.3 2015/05/13 17:04:27 snj Exp $	*/
+/*	$NetBSD: menus.mi,v 1.4.4.4 2015/05/14 00:30:50 riz Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -501,8 +501,8 @@ menu namesrv6, title MSG_Select_DNS_serv
 	option "google-public-dns-a.google.com (IPv6)", 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;
@@ -511,8 +511,8 @@ menu namesrv6, title MSG_Select_DNS_serv
 	option "google-public-dns-b.google.com (IPv6)", 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;

Index: src/usr.sbin/sysinst/net.c
diff -u src/usr.sbin/sysinst/net.c:1.2.4.2 src/usr.sbin/sysinst/net.c:1.2.4.3
--- src/usr.sbin/sysinst/net.c:1.2.4.2	Fri Feb 27 11:29:44 2015
+++ src/usr.sbin/sysinst/net.c	Thu May 14 00:30:50 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: net.c,v 1.2.4.2 2015/02/27 11:29:44 martin Exp $	*/
+/*	$NetBSD: net.c,v 1.2.4.3 2015/05/14 00:30:50 riz Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -76,7 +76,7 @@ static char net_host[STRSIZE];
 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 @@ static int net_dhcpconf;
 #define DHCPCONF_DOMAIN         0x08
 #ifdef INET6
 static char net_ip6[STRSIZE];
-char net_namesvr6[STRSIZE];
-static int net_ip6conf;
 #define IP6CONF_AUTOHOST        0x01
 #endif
 
@@ -108,8 +106,6 @@ static void get_dhcp_value(char *, size_
 
 #ifdef INET6
 static int is_v6kernel (void);
-static void init_v6kernel (int);
-static int get_v6wait (void);
 #endif
 
 /*
@@ -435,41 +431,6 @@ is_v6kernel(void)
 	close(s);
 	return 1;
 }
-
-/*
- * initialize as v6 client.
- * we are sure that we will never become router with boot floppy :-)
- * (include and use sysctl(8) if you are willing to)
- */
-static void
-init_v6kernel(int autoconf)
-{
-	int v;
-	int mib[4] = {CTL_NET, PF_INET6, IPPROTO_IPV6, 0};
-
-	mib[3] = IPV6CTL_FORWARDING;
-	v = 0;
-	(void)sysctl(mib, 4, NULL, NULL, (void *)&v, sizeof(v));
-
-	mib[3] = IPV6CTL_ACCEPT_RTADV;
-	v = autoconf ? 1 : 0;
-	(void)sysctl(mib, 4, NULL, NULL, (void *)&v, sizeof(v));
-}
-
-static int
-get_v6wait(void)
-{
-	size_t len = sizeof(int);
-	int v;
-	int mib[4] = {CTL_NET, PF_INET6, IPPROTO_IPV6, IPV6CTL_DAD_COUNT};
-
-	len = sizeof(v);
-	if (sysctl(mib, 4, (void *)&v, &len, NULL, 0) < 0) {
-		/* warn("sysctl(net.inet6.ip6.dadcount)"); */
-		return 1;	/* guess */
-	}
-	return v;
-}
 #endif
 
 static int
@@ -731,28 +692,19 @@ again:
 		    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,
@@ -772,8 +724,7 @@ again:
 #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));
@@ -787,11 +738,7 @@ done:
 	 */
 
 	/* 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)
@@ -808,10 +755,6 @@ done:
 			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);
@@ -819,16 +762,6 @@ done:
 
 	run_program(0, "/sbin/ifconfig lo0 127.0.0.1");
 
-#ifdef INET6
-	if (v6config && !nfs_root) {
-		init_v6kernel(1);
-		run_program(0, "/sbin/ifconfig %s up", net_dev);
-		sleep(get_v6wait() + 1);
-		run_program(RUN_DISPLAY, "/sbin/rtsol -D %s", net_dev);
-		sleep(get_v6wait() + 1);
-	}
-#endif
-
 	if (net_ip[0] != '\0') {
 		if (slip) {
 			/* XXX: needs 'ifconfig sl0 create' much earlier */
@@ -893,16 +826,19 @@ done:
 	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,
@@ -1119,17 +1055,8 @@ mnt_net_config(void)
 
 	/* 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
@@ -1187,19 +1114,6 @@ mnt_net_config(void)
 		}
         }
 
-#ifdef INET6
-	if ((net_ip6conf & IP6CONF_AUTOHOST) != 0) {
-		if (del_rc_conf("ip6mode") == 0)
-			add_rc_conf("ip6mode=autohost\n");
-		if (ifconf != NULL) {
-			scripting_fprintf(NULL, "cat <<EOF >>%s%s\n",
-			    target_prefix(), ifconfig_fn);
-			scripting_fprintf(ifconf, "!rtsol $int\n");
-			scripting_fprintf(NULL, "EOF\n");
-		}
-	}
-#endif
-
 	if (ifconf)
 		fclose(ifconf);
 

Reply via email to