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

Re: debian-installer - netcfg: rewrite of netcfg-static



i forget the patch

bastian

-- 
Index: Makefile
===================================================================
RCS file: /cvs/debian-boot/debian-installer/tools/netcfg/Makefile,v
retrieving revision 1.17
diff -u -r1.17 Makefile
--- Makefile	6 Sep 2002 06:25:09 -0000	1.17
+++ Makefile	4 Nov 2002 18:34:49 -0000
@@ -8,22 +8,27 @@
 
 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
 CFLAGS += -g
+STRIP = /bin/true
 else
 CFLAGS += -fomit-frame-pointer
+STRIPTOOL=strip
+STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment
 endif
 
 INSTALL=install
-STRIPTOOL=strip
-STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment
 
 all: $(TARGETS)
 
-netcfg-dhcp netcfg-static: netcfg-dhcp.c netcfg.o
-	$(CC) $(CFLAGS) $@.c  -o $@ $(INCS) $(LDOPTS) netcfg.o
+netcfg-dhcp: netcfg-dhcp.o netcfg.o
+	$(CC) $(CFLAGS) -o $@ $^ $(INCS) $(LDOPTS)
+	$(STRIP) $@
+
+netcfg-static: netcfg-static.o netcfg.o
+	$(CC) $(CFLAGS) -o $@ $^ $(INCS) $(LDOPTS)
 	$(STRIP) $@
 
-netcfg.o: netcfg.c
-	$(CC) -c $(CFLAGS) netcfg.c  -o $@ $(INCS)
+%.o: %.c %.h
+	$(CC) -c $(CFLAGS) $(INCS) -o $@ $<
 
 clean:
 	rm -f netcfg-dhcp netcfg-static *.o 
Index: netcfg-dhcp.c
===================================================================
RCS file: /cvs/debian-boot/debian-installer/tools/netcfg/netcfg-dhcp.c,v
retrieving revision 1.17
diff -u -r1.17 netcfg-dhcp.c
--- netcfg-dhcp.c	17 Oct 2002 05:01:16 -0000	1.17
+++ netcfg-dhcp.c	4 Nov 2002 18:34:49 -0000
@@ -34,11 +34,10 @@
 #include "netcfg.h"
 
 static char *interface = NULL;
-static char *hostname = NULL;
-static char *domain = NULL;
-static u_int32_t ipaddress = 0;
-static u_int32_t nameserver_array[4] = { 0 };
-static struct debconfclient *client;
+//static char *hostname = NULL;
+//static char *domain = NULL;
+//static u_int32_t ipaddress = 0;
+//static u_int32_t nameserver_array[4] = { 0 };
 enum {
         PUMP,
         DHCLIENT,
@@ -49,15 +48,6 @@
 
 static char *dhcp_hostname = NULL;
 
-char *debconf_input(char *priority, char *template)
-{
-        client->command(client, "fset", template, "seen", "false", NULL);
-        client->command(client, "input", priority, template, NULL);
-        client->command(client, "go", NULL);
-        client->command(client, "get", template, NULL);
-        return client->value;
-}
-
 static void netcfg_get_dhcp()
 {
         if (dhcp_hostname) {
@@ -78,7 +68,7 @@
                         (dhcp_hostname ? dhcp_hostname : "<none>"), NULL);
 }
 
-
+#if 0
 static void netcfg_write_dhcp()
 {
 
@@ -93,7 +83,7 @@
                 fclose(fp);
         }
 }
-
+#endif
 
 static void netcfg_activate_dhcp()
 {
@@ -122,7 +112,7 @@
         }
 
         if (di_execlog(buf))
-                netcfg_die(client);
+                netcfg_die();
 }
 
 int main(int argc, char *argv[])
@@ -151,20 +141,20 @@
 
 
         do {
-                netcfg_get_common(client, &interface, &hostname, &domain,
-                                  &nameservers);
+//                netcfg_get_common(client, &interface, &hostname, &domain,
+//                                  &nameservers);
 
                 client->command(client, "subst", "netcfg/confirm_dhcp",
                                 "interface", interface, NULL);
 
-                client->command(client, "subst", "netcfg/confirm_dhcp",
-                                "hostname", hostname, NULL);
+//                client->command(client, "subst", "netcfg/confirm_dhcp",
+//                                "hostname", hostname, NULL);
 
-                client->command(client, "subst", "netcfg/confirm_dhcp",
-                                "domain", (domain ? domain : "<none>"),
-                                NULL);
+//                client->command(client, "subst", "netcfg/confirm_dhcp",
+//                                "domain", (domain ? domain : "<none>"),
+//                                NULL);
 
-                netcfg_nameservers_to_array(nameservers, nameserver_array);
+                //netcfg_nameservers_to_array(nameservers, nameserver_array);
 
                 client->command(client, "subst", "netcfg/confirm_dhcp",
                                 "nameservers",
@@ -180,8 +170,8 @@
         }
         while (!finished);
 
-        netcfg_write_dhcp();
-        netcfg_write_common(ipaddress, domain, hostname, nameserver_array);
+        //netcfg_write_dhcp();
+        //netcfg_write_common(ipaddress, domain, hostname, nameserver_array);
 
         debconf_input("medium", "netcfg/do_dhcp");
         netcfg_activate_dhcp();
Index: netcfg-static.c
===================================================================
RCS file: /cvs/debian-boot/debian-installer/tools/netcfg/netcfg-static.c,v
retrieving revision 1.18
diff -u -r1.18 netcfg-static.c
--- netcfg-static.c	10 Oct 2002 15:52:15 -0000	1.18
+++ netcfg-static.c	4 Nov 2002 18:34:49 -0000
@@ -18,8 +18,11 @@
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    
 */
+
+#include <arpa/inet.h>
 #include <ctype.h>
 #include <net/if.h>
+#include <netinet/in.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <string.h>
@@ -30,90 +33,394 @@
 #include <sys/stat.h>
 #include <cdebconf/debconfclient.h>
 #include <debian-installer.h>
-#include "netcfg.h"
 
+#include "netcfg-static.h"
 
-static char *interface = NULL;
-static char *hostname = NULL;
-static char *domain = NULL;
-static u_int32_t ipaddress = 0;
-static u_int32_t nameserver_array[4] = { 0 };
-static u_int32_t network = 0;
-static u_int32_t broadcast = 0;
-static u_int32_t netmask = 0;
-static u_int32_t gateway = 0;
-static u_int32_t pointopoint = 0;
-static struct debconfclient *client;
-
-char *debconf_input(char *priority, char *template)
-{
-        client->command(client, "fset", template, "seen", "false", NULL);
-        client->command(client, "input", priority, template, NULL);
-        client->command(client, "go", NULL);
-        client->command(client, "get", template, NULL);
-        return client->value;
-}
-
-
-static void netcfg_get_static()
-{
-        char *ptr;
-
-        ipaddress = network = broadcast = netmask = gateway = pointopoint =
-            0;
-
-        ptr = debconf_input("critical", "netcfg/get_ipaddress");
-        dot2num(&ipaddress, ptr);
-
-        client->command(client, "subst", "netcfg/confirm_static",
-                        "ipaddress",
-                        (ipaddress ? num2dot(ipaddress) : "<none>"), NULL);
-
-        if (strncmp(interface, "plip", 4) == 0
-            || strncmp(interface, "slip", 4) == 0
-            || strncmp(interface, "ctc", 3) == 0
-            || strncmp(interface, "escon", 5) == 0
-            || strncmp(interface, "iucv", 4) == 0) {
-                ptr = debconf_input("critical", "netcfg/get_pointopoint");
-                dot2num(&pointopoint, ptr);
-
-                dot2num(&netmask, "255.255.255.255");
-                network = ipaddress;
-                gateway = pointopoint;
-        } else {
-                ptr = debconf_input("critical", "netcfg/get_netmask");
-                dot2num(&netmask, ptr);
-
-                ptr = debconf_input("critical", "netcfg/get_gateway");
-                dot2num(&gateway, ptr);
-
-                network = ipaddress & netmask;
-
-                if (gateway && ((gateway & netmask) != network)) {
-                        client->command(client, "input", "high",
-                                        "netcfg/gateway_unreachable",
-                                        NULL);
-                        client->command(client, "go", NULL);
-                }
-        }
+// convert a netmask (255.255.255.0) into the length (24)
+static int inet_ptom (const char *src, short *dst)
+{
+	struct in_addr addr;
+	in_addr_t mask, num;
 
-        client->command(client, "subst", "netcfg/confirm_static",
-                        "netmask", (netmask ? num2dot(netmask) : "<none>"),
-                        NULL);
+	if (!inet_pton (AF_INET, src, &addr))
+		return 0;
 
-        client->command(client, "subst", "netcfg/confirm_static",
-                        "gateway", (gateway ? num2dot(gateway) : "<none>"),
-                        NULL);
+	mask = ntohl(addr.s_addr);
 
-        client->command(client, "subst", "netcfg/confirm_static",
-                        "pointopoint",
-                        (pointopoint ? num2dot(pointopoint) : "<none>"),
-                        NULL);
+	for (num = mask; num & 1; num >>= 1);
+
+	if (num != 0 && mask != 0)
+	{
+		for (num = ~mask; num & 1; num >>= 1);
+		if (num)
+			return 0;
+	}
+
+	for (num = 0; mask; mask <<= 1)
+		num++;
+
+	*dst = num;
+
+	return 1;
+}
+
+// convert a length (24) into the netmask (255.255.255.0)
+static int inet_mtop (short src, char *dst, size_t cnt)
+{
+	struct in_addr addr;
+	in_addr_t mask = 0;
+
+	for(; src; src--)
+		mask |= 1 << (32 - src);
+
+	addr.s_addr = htonl(mask);
+
+	if (!inet_ntop (AF_INET, &addr, dst, cnt))
+		return 0;
+
+	return 1;
+}
+
+static void netcfg_static_get_loop_common (struct interface_config_static *config);
+static void netcfg_static_get_loop_inet (struct interface_config_static *config, int af);
+
+static int netcfg_static_get_common (struct interface_config_static *config);
+static int netcfg_static_get_inet (struct interface_config_static *config, int af);
+
+static void netcfg_static_register (struct interface_config_static *config);
+static void netcfg_static_register_common (struct interface_config_static *config);
+static void netcfg_static_register_inet (struct interface_config_static *config, int af);
+
+#if 0
+static void netcfg_static_unregister_common (struct interface_config_static *config);
+static void netcfg_static_unregister (struct interface_config_static *config);
+static void netcfg_static_unregister_inet (struct interface_config_static *config, int af);
+#endif
+
+static void netcfg_static_get (struct interface_config_static *config)
+{
+	netcfg_static_register (config);
 
-        broadcast = (network | ~netmask);
+#ifndef __GNU__
+	if (config->info->inet6 == INET6_NO)
+#endif /* __GNU__ */
+		netcfg_static_get_loop_inet (config, AF_INET);
+#ifndef __GNU__
+	else if (config->info->inet6 == INET6_ONLY)
+		netcfg_static_get_loop_inet (config, AF_INET6);
+	else
+	{
+		char *ptr, *ptr2;
+
+		if (netcfg_common_interface_configured (config->interface))
+		{
+			int inet = 0, inet6 = 0;
+
+			ptr = debconf_interface_get (config->interface, "static", "families/inet");
+			if (strstr (ptr, "true"))
+				inet = 1;
+			ptr = debconf_interface_get (config->interface, "static", "families/inet6");
+			if (strstr (ptr, "true"))
+				inet6 = 1;
+
+			if (inet && inet6)
+				ptr = "INET+INET6: IPv4 and IPv6";
+			else if (inet6)
+				ptr = "INET6: IPv6 only";
+			else
+				ptr = "INET: IPv4 only";
+
+			if (config->info->inet6 == INET6_PART)
+				client->command (client, "set", TEMPLATE_PREFIX "static/families/choose_inet6_part", ptr, NULL);
+			else
+				client->command (client, "set", TEMPLATE_PREFIX "static/families/choose", ptr, NULL);
+		}
+
+		if (config->info->inet6 == INET6_PART)
+			ptr = debconf_input ("medium", "static/families/choose_inet6_part");
+		else
+			ptr = debconf_input ("medium", "static/families/choose");
+
+		ptr2 = strchr (ptr, ':');
+		*ptr2 = '\0';
+
+		if (!strcmp ("INET+INET6", ptr))
+		{
+			netcfg_static_get_loop_inet (config, AF_INET);
+			netcfg_static_get_loop_inet (config, AF_INET6);
+		}
+		else if (!strcmp ("INET6", ptr))
+			netcfg_static_get_loop_inet (config, AF_INET6);
+		else
+			netcfg_static_get_loop_inet (config, AF_INET);
+	}
+#endif /* __GNU__ */
+
+	netcfg_static_get_loop_common (config);
+
+	netcfg_common_interface_configured_add (config->interface);
+}
+
+static void netcfg_static_get_loop_common (struct interface_config_static *config)
+{
+	int finished = 0;
+
+	netcfg_static_register_common (config);
+
+	do
+	{
+		finished = !netcfg_static_get_common (config);
+	}
+	while (!finished);
+}
+
+static void netcfg_static_get_loop_inet (struct interface_config_static *config, int af)
+{
+	int finished = 0;
+
+	netcfg_static_register_inet (config, af);
+
+	do
+	{
+		finished = !netcfg_static_get_inet (config, af);
+	}
+	while (!finished);
+
+	if (af == AF_INET)
+		debconf_interface_set (config->interface, "static", "families/inet", "true");
+	else
+		debconf_interface_set (config->interface, "static", "families/inet6", "true");
 }
 
+static int netcfg_static_get_common (struct interface_config_static *config)
+{
+	char *ptr = NULL;
+
+	if (config->info->pointopoint == PTP_YES)
+	{
+		debconf_interface_set (config->interface, "static", "common/pointopoint", "true");
+		debconf_interface_ask (config->interface, "high", "static", "common/pointopoint_gateway");
+	}
+
+	client->command (client, "go", NULL);
+
+	if (config->info->pointopoint == PTP_YES)
+	{
+		ptr = debconf_interface_get (config->interface, "static", "common/pointopoint_gateway");
+
+		if (strstr (ptr, "true"))
+			config->common.pointopoint_gateway = PTP_GATEWAY_YES;
+		else
+			config->common.pointopoint_gateway = PTP_GATEWAY_NO;
+
+		client->command (client, "subst", TEMPLATE_PREFIX "static/common/confirm_pointopoint",
+		                 "interface", config->interface, NULL);
+
+		ptr = debconf_interface_get (config->interface, "static", "common/pointopoint_gateway");
+		client->command (client, "subst", TEMPLATE_PREFIX "static/common/confirm_pointopoint",
+		                 "gateway", ptr, NULL);
+
+		ptr = debconf_input ("medium", "static/common/confirm_pointopoint");
+	}
+
+	if (!ptr || strstr (ptr, "true"))
+		return 0;
+
+	return -1;
+}
 
+static int netcfg_static_get_inet (struct interface_config_static *config, int af)
+{
+	char *ptr;
+	char addr[INET6_ADDRSTRLEN];
+
+	if (af == AF_INET)
+		debconf_interface_ask (config->interface, "critical", "static", "inet/address");
+	else
+		debconf_interface_ask (config->interface, "critical", "static", "inet6/address");
+
+	if (config->info->pointopoint != PTP_YES)
+	{
+		if (af == AF_INET)
+		{
+			debconf_interface_ask (config->interface, "critical", "static", "inet/netmask");
+			debconf_interface_ask (config->interface, "critical", "static", "inet/gateway");
+		}
+		else
+		{
+			debconf_interface_ask (config->interface, "critical", "static", "inet6/netmask");
+			debconf_interface_ask (config->interface, "critical", "static", "inet6/gateway");
+		}
+	}
+
+	client->command (client, "go", NULL);
+
+	if (af == AF_INET)
+	{
+		ptr = debconf_interface_get (config->interface, "static", "inet/address");
+		if (!inet_pton (AF_INET, ptr, &config->inet.address))
+			netcfg_die ();
+	}
+	else
+	{
+		ptr = debconf_interface_get (config->interface, "static", "inet6/address");
+		if (inet_pton (AF_INET6, ptr, &config->inet6.address) <= 0)
+			netcfg_die ();
+	}
+
+	if (config->info->pointopoint == PTP_YES)
+	{
+		if (af == AF_INET)
+			config->inet.netmask = 32;
+		else
+			config->inet6.netmask = 128;
+
+		client->command (client, "subst", TEMPLATE_PREFIX "static/confirm_pointopoint",
+		                 "interface", config->interface, NULL);
+
+		if (af == AF_INET)
+			inet_ntop (AF_INET, &config->inet.address, addr, INET_ADDRSTRLEN);
+		else
+			inet_ntop (AF_INET6, &config->inet6.address, addr, INET6_ADDRSTRLEN);
+
+		client->command (client, "subst", TEMPLATE_PREFIX "static/confirm_pointopoint",
+		                 "address", addr, NULL);
+
+		ptr = debconf_input ("medium", "static/confirm_pointopoint");
+	}
+	else
+	{
+		if (af == AF_INET)
+		{
+			ptr = debconf_interface_get (config->interface, "static", "inet/netmask");
+			if (!inet_ptom (ptr, &config->inet.netmask))
+				netcfg_die ();
+
+			ptr = debconf_interface_get (config->interface, "static", "inet/gateway");
+			if (!inet_pton (AF_INET, ptr, &config->inet.gateway))
+				config->inet.no_gateway = 1;
+		}
+		else
+		{
+			ptr = debconf_interface_get (config->interface, "static", "inet6/netmask");
+			config->inet6.netmask = (short) strtol (ptr, NULL, 10);
+
+			ptr = debconf_interface_get (config->interface, "static", "inet6/gateway");
+			if (inet_pton (AF_INET6, ptr, &config->inet6.gateway) <= 0)
+				config->inet6.no_gateway = 1;
+		}
+
+		client->command (client, "subst", TEMPLATE_PREFIX "static/confirm",
+		                 "interface", config->interface, NULL);
+
+		if (af == AF_INET)
+			inet_ntop (AF_INET, &config->inet.address, addr, INET_ADDRSTRLEN);
+		else
+			inet_ntop (AF_INET6, &config->inet6.address, addr, INET6_ADDRSTRLEN);
+		client->command (client, "subst", TEMPLATE_PREFIX "static/confirm",
+		                 "address", addr, NULL);
+
+		if (af == AF_INET)
+			inet_mtop (config->inet.netmask, addr, INET_ADDRSTRLEN);
+		else
+			snprintf (addr, INET6_ADDRSTRLEN, "%d", config->inet6.netmask);
+		client->command (client, "subst", TEMPLATE_PREFIX "static/confirm",
+		                 "netmask", addr, NULL);
+
+		if (af == AF_INET)
+		{
+			if (config->inet.no_gateway)
+				strcpy (addr, "-");
+			else
+				inet_ntop (AF_INET, &config->inet.gateway, addr, INET_ADDRSTRLEN);
+		}
+		else
+		{
+			if (config->inet6.no_gateway)
+				strcpy (addr, "-");
+			else
+				inet_ntop (AF_INET6, &config->inet6.gateway, addr, INET6_ADDRSTRLEN);
+		}
+		client->command (client, "subst", TEMPLATE_PREFIX "static/confirm",
+		                 "gateway", addr, NULL);
+
+		ptr = debconf_input ("medium", "static/confirm");
+	}
+
+	if (strstr (ptr, "true"))
+		return 0;
+
+	return -1;
+}
+
+static void netcfg_static_register (struct interface_config_static *config)
+{
+	debconf_interface_register (config->interface, "static", "families/inet");
+	debconf_interface_register (config->interface, "static", "families/inet6");
+}
+
+#if 0
+static void netcfg_static_unregister (struct interface_config_static *config)
+{
+	debconf_interface_unregister (config->interface, "static", "families/inet");
+	debconf_interface_unregister (config->interface, "static", "families/inet6");
+}
+#endif
+
+static void netcfg_static_register_common (struct interface_config_static *config)
+{
+	debconf_interface_register (config->interface, "static", "common/pointopoint");
+
+	if (config->info->pointopoint == PTP_YES)
+		debconf_interface_register (config->interface, "static", "common/pointopoint_gateway");
+}
+
+#if 0
+static void netcfg_static_unregister_common (struct interface_config_static *config)
+{
+	debconf_interface_unregister (config->interface, "static", "common/pointopoint");
+
+	if (config->info->pointopoint == PTP_YES)
+		debconf_interface_unregister (config->interface, "static", "common/pointopoint_gateway");
+}
+#endif
+
+static void netcfg_static_register_inet (struct interface_config_static *config, int af)
+{
+	if (af == AF_INET)
+		debconf_interface_register (config->interface, "static", "inet/address");
+	else
+		debconf_interface_register (config->interface, "static", "inet6/address");
+
+	if (config->info->pointopoint != PTP_YES)
+	{
+		if (af == AF_INET)
+		{
+			debconf_interface_register (config->interface, "static", "inet/netmask");
+			debconf_interface_register (config->interface, "static", "inet/gateway");
+		}
+		else
+		{
+			debconf_interface_register (config->interface, "static", "inet6/netmask");
+			debconf_interface_register (config->interface, "static", "inet6/gateway");
+		}
+	}
+}
+
+#if 0
+static void netcfg_static_unregister_inet (struct interface_config_static *config, int af)
+{
+	debconf_interface_unregister (config->interface, "static", "inet/address");
+
+	if (config->info->pointopoint != PTP_YES)
+	{
+		debconf_interface_unregister (config->interface, "static", "inet/netmask");
+		debconf_interface_unregister (config->interface, "static", "inet/gateway");
+	}
+}
+#endif
+
+/*
 static int netcfg_write_static()
 {
         FILE *fp;
@@ -147,103 +454,119 @@
       error:
         return -1;
 }
+*/
 
-static int netcfg_activate_static()
+static int netcfg_static_activate (struct interface_config_static *config)
 {
-        int rv = 0;
-        char buf[256];
-#ifdef __GNU__
-/* I had to do something like this ? */
-/*  di_execlog ("settrans /servers/socket/2 -fg");  */
-        di_execlog("settrans /servers/socket/2 --goaway");
-        snprintf(buf, sizeof(buf),
-                 "settrans -fg /servers/socket/2 /hurd/pfinet --interface=%s --address=%s",
-                 interface, num2dot(ipaddress));
-        di_snprintfcat(buf, sizeof(buf), " --netmask=%s",
-                       num2dot(netmask));
-        buf[sizeof(buf) - 1] = '\0';
-
-        if (gateway)
-                snprintf(buf, sizeof(buf), " --gateway=%s",
-                         num2dot(gateway));
+	int rv = 0;
+	char buf[256], addr[INET6_ADDRSTRLEN], *ptr;
+	int inet = 0, inet6 = 0;
+
+	ptr = debconf_interface_get (config->interface, "static", "families/inet");
+	if (strstr (ptr, "true"))
+		inet = 1;
+	ptr = debconf_interface_get (config->interface, "static", "families/inet6");
+	if (strstr (ptr, "true"))
+		inet6 = 1;
 
-        rv |= di_execlog(buf);
+#ifdef __GNU__
+	/* I had to do something like this ? */
+	/*  di_execlog ("settrans /servers/socket/2 -fg");  */
+	di_execlog("settrans /servers/socket/2 --goaway");
+
+	if (inet)
+	{
+		inet_ntop (AF_INET, config->inet.address, addr, INET6_ADDRSTRLEN);
+		snprintf(buf, sizeof(buf),
+				"settrans -fg /servers/socket/2 /hurd/pfinet --interface=%s --address=%s",
+				config->interface, addr);
+
+		if (config->info->pointopoint == PTP_YES)
+			inet_mtop (32, addr, INET6_ADDRSTRLEN);
+		else
+			inet_mtop (config->inet.netmask, addr, INET6_ADDRSTRLEN);
+		di_snprintfcat(buf, sizeof(buf), " --netmask=%s", addr);
+
+		if (config->info->pointopoint != PTP_YES && !config->inet6.no_gateway)
+		{
+			inet_ntop (AF_INET, config->inet.gateway, addr, INET6_ADDRSTRLEN);
+			di_snprintfcat(buf, sizeof(buf), " --gateway=%s", addr);
+		}
+		else if (config->common.pointopoint_gateway == PTP_GATEWAY_YES)
+		{
+			inet_ntop (AF_INET, config->inet.pointopoint, addr, INET6_ADDRSTRLEN);
+			di_snprintfcat(buf, sizeof(buf), " --gateway=%s", addr);
+		}
 
+		rv |= di_execlog(buf);
+	}
 #else
-        di_execlog("/sbin/ifconfig lo 127.0.0.1");
+	snprintf (buf, sizeof(buf), "/bin/ip link set %s up", config->interface);
+	rv |= di_execlog(buf);
 
-        snprintf(buf, sizeof(buf), "/sbin/ifconfig %s %s",
-                 interface, num2dot(ipaddress));
-        di_snprintfcat(buf, sizeof(buf), " netmask %s", num2dot(netmask));
-        di_snprintfcat(buf, sizeof(buf), " broadcast %s",
-                       num2dot(broadcast));
-        buf[sizeof(buf) - 1] = '\0';
-
-        if (pointopoint)
-                di_snprintfcat(buf, sizeof(buf), " pointopoint %s",
-                               num2dot(pointopoint));
-
-        rv |= di_execlog(buf);
-
-        if (gateway) {
-                snprintf(buf, sizeof(buf),
-                         "/sbin/route add default gateway %s",
-                         num2dot(gateway));
-                rv |= di_execlog(buf);
-        }
+	if (inet)
+	{
+		inet_ntop (AF_INET, &config->inet.address, addr, INET6_ADDRSTRLEN);
+		snprintf (buf, sizeof(buf), "/bin/ip addr add %s/%d dev %s", addr, config->inet.netmask, config->interface);
+		rv |= di_execlog (buf);
+
+		if (config->info->pointopoint != PTP_YES && !config->inet6.no_gateway)
+		{
+			inet_ntop (AF_INET, &config->inet.gateway, addr, INET6_ADDRSTRLEN);
+			snprintf (buf, sizeof(buf), "/bin/ip route add default via %s", addr);
+			rv |= di_execlog(buf);
+		}
+		else if (config->common.pointopoint_gateway == PTP_GATEWAY_YES)
+		{
+			snprintf (buf, sizeof(buf), "/bin/ip route add default dev %s", config->interface);
+			rv |= di_execlog(buf);
+		}
+	}
+	if (inet6)
+	{
+		inet_ntop (AF_INET6, &config->inet6.address, addr, INET6_ADDRSTRLEN);
+		snprintf (buf, sizeof(buf), "/bin/ip -f inet6 addr add %s/%d dev %s", addr, config->inet6.netmask, config->interface);
+		rv |= di_execlog (buf);
+
+		if (config->info->pointopoint != PTP_YES && !config->inet6.no_gateway)
+		{
+			inet_ntop (AF_INET6, &config->inet6.gateway, addr, INET6_ADDRSTRLEN);
+			snprintf (buf, sizeof(buf), "/bin/ip -f inet6 route add default via %s", addr);
+			rv |= di_execlog(buf);
+		}
+		else if (config->common.pointopoint_gateway == PTP_GATEWAY_YES)
+		{
+			snprintf (buf, sizeof(buf), "/bin/ip -f inet6 route add default dev %s", config->interface);
+			rv |= di_execlog(buf);
+		}
+	}
 #endif
 
-        if (rv != 0) {
-                client->command(client, "input", "critical",
-                                "netcfg/error_cfg", NULL);
-                client->command(client, "go", NULL);
-        }
-        return 0;
+	if (rv != 0) {
+		client->command(client, "input", "critical",
+				"netcfg/error_cfg", NULL);
+		client->command(client, "go", NULL);
+	}
+	return 0;
 }
 
 int main(int argc, char *argv[])
 {
-        int finished = 0;
-        char *ptr;
-        char *nameservers = NULL;
+	static struct interface_config_static config;
+
         client = debconfclient_new();
         client->command(client, "title", "Static Network Configuration",
                         NULL);
 
-
-        do {
-                netcfg_get_common(client, &interface, &hostname, &domain,
-                                  &nameservers);
-
-                client->command(client, "subst", "netcfg/confirm_static",
-                                "interface", interface, NULL);
-
-                client->command(client, "subst", "netcfg/confirm_static",
-                                "hostname", hostname, NULL);
-
-                client->command(client, "subst", "netcfg/confirm_static",
-                                "domain", (domain ? domain : "<none>"),
-                                NULL);
-
-                client->command(client, "subst", "netcfg/confirm_static",
-                                "nameservers",
-                                (nameservers ? nameservers : "<none>"),
-                                NULL);
-                netcfg_nameservers_to_array(nameservers, nameserver_array);
-
-                netcfg_get_static();
-
-                ptr = debconf_input("medium", "netcfg/confirm_static");
-
-                if (strstr(ptr, "true"))
-                        finished = 1;
-
-        }
-        while (!finished);
-
-        netcfg_write_common(ipaddress, domain, hostname, nameserver_array);
-        netcfg_write_static();
-        netcfg_activate_static();
+	netcfg_common_get_interface (config.interface, 10);
+	config.info = netcfg_common_interface_info (config.interface);
+	netcfg_static_get (&config);
+
+	netcfg_static_activate (&config);
+
+//        netcfg_write_common(ipaddress, domain, hostname, nameserver_array);
+//        netcfg_write_static();
+//        netcfg_activate_static();
 
         return 0;
 }
Index: netcfg-static.h
===================================================================
RCS file: netcfg-static.h
diff -N netcfg-static.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ netcfg-static.h	4 Nov 2002 18:34:49 -0000
@@ -0,0 +1,35 @@
+#ifndef _NETCFG_STATIC_H_
+#define _NETCFG_STATIC_H_
+
+#include "netcfg.h"
+
+struct interface_config_static
+{
+	char interface[10];
+
+	struct common
+	{
+		enum { PTP_GATEWAY_NO, PTP_GATEWAY_YES } pointopoint_gateway;
+	}
+	common;
+
+	struct inet
+	{
+		struct in_addr address, gateway;
+		short netmask;
+		short no_gateway;
+	}
+	inet;
+
+	struct inet6
+	{
+		struct in6_addr address, gateway;
+		short netmask;
+		short no_gateway;
+	}
+	inet6;
+
+	const struct interface_info *info;
+};
+
+#endif /* _NETCFG_STATIC_H_ */
Index: netcfg.c
===================================================================
RCS file: /cvs/debian-boot/debian-installer/tools/netcfg/netcfg.c,v
retrieving revision 1.31
diff -u -r1.31 netcfg.c
--- netcfg.c	22 Oct 2002 17:29:43 -0000	1.31
+++ netcfg.c	4 Nov 2002 18:34:49 -0000
@@ -34,20 +34,97 @@
 #include <debian-installer.h>
 #include "netcfg.h"
 
+struct interface_info interface_info[] =
+{
+	{ "eth", "Ethernet or Fast Ethernet", PTP_NO, INET6_YES },
+	{ "pcmcia", "PC-Card (PCMCIA) Ethernet or Token Ring", PTP_NO, INET6_YES },
+	{ "tr", "Token Ring", PTP_NO, INET6_NO },
+	{ "arc", "Arcnet", PTP_NO, INET6_NO },
+	{ "slip", "Serial-line IP", PTP_YES, INET6_NO },
+	{ "plip", "Parallel-line IP", PTP_YES, INET6_NO },
+	{ "ctc", "Channel-to-channel", PTP_YES, INET6_PART },
+	{ "escon", "Real channel-to-channel", PTP_YES, INET6_PART },
+	{ "hsi", "Hypersocket", PTP_NO, INET6_PART },
+	{ "iucv", "Inter-user communication vehicle", PTP_YES, INET6_YES },
+	{ "sit", "tunnel", PTP_YES, INET6_ONLY },
+	{ NULL, "unknown interface", PTP_NO, INET6_NO }
+};
 
-static char *debconf_input(struct debconfclient *client, char *priority,
-                           char *template)
+char *debconf_input (char *priority, char *question)
 {
-        client->command(client, "fset", template, "seen", "false", NULL);
-        client->command(client, "input", priority, template, NULL);
-        client->command(client, "go", NULL);
-        client->command(client, "get", template, NULL);
-        return client->value;
+	char template[256];
+
+	snprintf (template, 256, TEMPLATE_PREFIX "%s", question);
+
+	client->command (client, "fset", template, "seen", "false", NULL);
+	client->command (client, "input", priority, template, NULL);
+	client->command (client, "go", NULL);
+	client->command (client, "get", template, NULL);
+	return client->value;
+}
+
+static void debconf_interface_build (char *interface, char *questionprefix, char *question, char *template, size_t size)
+{
+	snprintf (template, size, TEMPLATE_PREFIX "interfaces/%s/%s/%s", questionprefix, interface, question);
+}
+
+char *debconf_interface_input (char *interface, char *priority, char *questionprefix, char *question)
+{
+	char template[256];
+	debconf_interface_build (interface, questionprefix, question, template, 256);
+
+	client->command (client, "fset", template, "seen", "false", NULL);
+	client->command (client, "input", priority, template, NULL);
+	client->command (client, "go", NULL);
+	client->command (client, "get", template, NULL);
+	return client->value;
+}
+
+void debconf_interface_ask (char *interface, char *priority, char *questionprefix, char *question)
+{
+	char template[256];
+	debconf_interface_build (interface, questionprefix, question, template, 256);
+
+	client->command (client, "fset", template, "seen", "false", NULL);
+	client->command (client, "input", priority, template, NULL);
 }
 
+char *debconf_interface_get (char *interface, char *questionprefix, char *question)
+{
+	char template[256];
+	debconf_interface_build (interface, questionprefix, question, template, 256);
 
+	client->command (client, "get", template, NULL);
+	return client->value;
+}
 
-int is_interface_up(char *inter)
+void debconf_interface_set (char *interface, char *questionprefix, char *question, char *to)
+{
+	char template[256];
+	debconf_interface_build (interface, questionprefix, question, template, 256);
+
+	client->command (client, "set", template, to, NULL);
+}
+
+void debconf_interface_register (char *interface, char *questionprefix, char *question)
+{
+	char template1[256];
+	char template2[256];
+	snprintf (template1, 256, TEMPLATE_PREFIX "%s/%s", questionprefix, question);
+	debconf_interface_build (interface, questionprefix, question, template2, 256);
+
+	client->command (client, "register", template1, template2, NULL);
+}
+
+void debconf_interface_unregister (char *interface, char *questionprefix, char *question)
+{
+	char template[256];
+	debconf_interface_build (interface, questionprefix, question, template, 256);
+
+	client->command (client, "unregister", template, NULL);
+}
+
+static int getif_is_interface_up(char *inter)
 {
         struct ifreq ifr;
         int sfd = -1, ret = -1;
@@ -68,8 +145,7 @@
         return ret;
 }
 
-
-void get_name(char *name, char *p)
+static void getif_get_name(char *name, char *p)
 {
         while (isspace(*p))
                 p++;
@@ -96,12 +172,10 @@
         return;
 }
 
-
-
 static FILE *ifs = NULL;
 static char ibuf[512];
 
-void getif_start()
+static void getif_start (void)
 {
         if (ifs != NULL) {
                 fclose(ifs);
@@ -114,25 +188,23 @@
         return;
 }
 
-
-char *getif(int all)
+static char *getif (int all)
 {
         char rbuf[512];
         if (ifs == NULL)
                 return NULL;
 
         if (fgets(rbuf, sizeof(rbuf), ifs) != NULL) {
-                get_name(ibuf, rbuf);
+                getif_get_name(ibuf, rbuf);
                 if (!strcmp(ibuf, "lo"))        /* ignore the loopback */
                         return getif(all);      /* seriously doubt there is an infinite number of lo devices */
-                if (all || is_interface_up(ibuf) == 1)
+                if (all || getif_is_interface_up(ibuf) == 1)
                         return ibuf;
         }
         return NULL;
 }
 
-
-void getif_end()
+static void getif_end (void)
 {
         if (ifs != NULL) {
                 fclose(ifs);
@@ -141,46 +213,19 @@
         return;
 }
 
-
-char *get_ifdsc(const char *ifp)
+const struct interface_info *const netcfg_common_interface_info (const char *interface)
 {
-        int i;
-        struct if_alist_struct {
-                char *interface;
-                char *description;
-        } interface_alist[] = {
-                {
-                "eth", "Ethernet or Fast Ethernet"}
-                , {
-                "pcmcia", "PC-Card (PCMCIA) Ethernet or Token Ring"}
-                , {
-                "tr", "Token Ring"}
-                , {
-                "arc", "Arcnet"}
-                , {
-                "slip", "Serial-line IP"}
-                , {
-                "plip", "Parallel-line IP"}
-                , {
-                "ctc", "Channel-to-channel"}
-                , {
-                "escon", "Real channel-to-channel"}
-                , {
-                "hsi", "Hypersocket"}
-                , {
-                "iucv", "Inter-user communication vehicle"}
-                , {
-                NULL, NULL}
-        };
-
-        for (i = 0; interface_alist[i].interface != NULL; i++)
-                if (!strncmp(ifp, interface_alist[i].interface,
-                             strlen(interface_alist[i].interface)))
-                        return interface_alist[i].description;
-        return "unknown interface";
-}
+	int i;
+
+	for (i = 0; interface_info[i].interface != NULL; i++)
+		if (!strncmp(interface, interface_info[i].interface,
+					strlen(interface_info[i].interface)))
+			return &interface_info[i];
 
+	return &interface_info[i];
+}
 
+#if 0
 FILE *file_open(char *path)
 {
         FILE *fp;
@@ -192,140 +237,131 @@
                 return NULL;
         }
 }
+#endif
 
-
-void dot2num(u_int32_t * num, char *dot)
-{
-        char *p = dot - 1;
-        char *e;
-        int ix;
-        unsigned long val;
-
-        if (!dot)
-                goto exit;
-
-        *num = 0;
-        for (ix = 0; ix < 4; ix++) {
-                *num <<= 8;
-                p++;
-                val = strtoul(p, &e, 10);
-                if (e == p)
-                        val = 0;
-                else if (val > 255)
-                        goto exit;
-                *num += val;
-                /*printf("%#8x, %#2x\n", *num, val); */
-                if (ix < 3 && *e != '.')
-                        goto exit;
-                p = e;
-        }
-
-        return;
-
-      exit:
-        *num = 0;
-}
-
-
-static char num2dot_buf[16];
-
-char *num2dot(u_int32_t num)
-{
-        int byte[4];
-        int ix;
-        char *dot = num2dot_buf;
-
-        for (ix = 3; ix >= 0; ix--) {
-                byte[ix] = num & 0xff;
-                num >>= 8;
-        }
-        sprintf(dot, "%d.%d.%d.%d", byte[0], byte[1], byte[2], byte[3]);
-
-        return dot;
-}
-
-
-
-void netcfg_die(struct debconfclient *client)
+void netcfg_die (void)
 {
-        client->command(client, "input", "high", "netcfg/error", NULL);
+        client->command(client, "fset", TEMPLATE_PREFIX "common/error", "seen", "false", NULL);
+        client->command(client, "input", "high", TEMPLATE_PREFIX "common/error", NULL);
         client->command(client, "go", NULL);
         exit(1);
 }
 
-
-static void
-netcfg_get_interface(struct debconfclient *client, char **interface)
+void netcfg_common_get_interface (char *interface, size_t size)
 {
         char *inter;
         int len;
         int newchars;
         char *ptr;
         int num_interfaces = 0;
-
-        if (*interface) {
-                free(*interface);
-                *interface = NULL;
-        }
+	const struct interface_info *info;
 
         if (!(ptr = malloc(128)))
-                netcfg_die(client);
+		goto error;
+
         len = 128;
         *ptr = '\0';
 
         getif_start();
         while ((inter = getif(1)) != NULL) {
-                newchars = strlen(inter) + strlen(get_ifdsc(inter)) + 5;
+		info = netcfg_common_interface_info (inter);
+		newchars = strlen(inter) + strlen(info->description) + 5;
                 if (len < (strlen(ptr) + newchars)) {
                         if (!(ptr = realloc(ptr, len + newchars + 128)))
                                 goto error;
                         len += newchars + 128;
                 }
 
-                di_snprintfcat(ptr, len, "%s: %s, ", inter,
-                               get_ifdsc(inter));
+		di_snprintfcat(ptr, len, "%s: %s, ", inter, info->description);
                 num_interfaces++;
         }
         getif_end();
 
-        if (num_interfaces == 0) {
-                client->command(client, "input", "high",
-                                "netcfg/no_interfaces", NULL);
-                client->command(client, "go", NULL);
-                free(ptr);
-                exit(1);
-        } else if (num_interfaces > 1) {
-                client->command(client, "subst", "netcfg/choose_interface",
+	if (num_interfaces == 0) {
+		client->command (client, "input", "high", TEMPLATE_PREFIX "common/no_interfaces", NULL);
+		client->command (client, "go", NULL);
+		free(ptr);
+		exit(1);
+	} else if (num_interfaces > 1) {
+		client->command(client, "subst", TEMPLATE_PREFIX "common/choose_interface",
                                 "ifchoices", ptr, NULL);
-                free(ptr);
-                inter =
-                    debconf_input(client, "high",
-                                  "netcfg/choose_interface");
+		free(ptr);
+		inter = debconf_input ("high", "common/choose_interface");
 
-                if (!inter)
-                        netcfg_die(client);
+		if (!inter)
+			goto error;
         } else if (num_interfaces == 1)
                 inter = ptr;
 
-        /* grab just the interface name, not the description too */
-        *interface = inter;
-        ptr = strchr(inter, ':');
-        if (ptr == NULL)
-                goto error;
-        *ptr = '\0';
+	/* grab just the interface name, not the description too */
+	ptr = strchr (inter, ':');
+	if (ptr == NULL)
+		goto error;
+	*ptr = '\0';
 
-        *interface = strdup(*interface);
+	strncpy (interface, inter, size);
 
-        return;
+	return;
 
-      error:
-        if (ptr)
-                free(ptr);
+error:
+	if (ptr)
+		free (ptr);
 
-        netcfg_die(client);
+	netcfg_die ();
 }
 
+int netcfg_common_interface_configured (const char *interface)
+{
+	char *ptr;
+
+	client->command (client, "get", TEMPLATE_PREFIX "interfaces/configured", NULL);
+
+	ptr = strtok (client->value, ",");
+	do
+	{
+		if (!strcmp(ptr, interface))
+			return 1;
+	}
+	while ((ptr = strtok (NULL, ",")));
 
+	return 0;
+}
+
+int netcfg_common_interface_configured_add (const char *interface)
+{
+	char *ptr;
+
+	client->command (client, "get", TEMPLATE_PREFIX "interfaces/configured", NULL);
+
+	if (strlen (client->value))
+	{
+		ptr = strtok (client->value, ",");
+		do
+		{
+			if (!strcmp(ptr, interface))
+				return 0;
+		}
+		while ((ptr = strtok (NULL, ",")));
+	}
+
+	ptr = malloc (strlen (client->value) + strlen (interface) + 2);
+	if (!ptr)
+		netcfg_die ();
+	*ptr = '\0';
+	if (strlen (client->value))
+	{
+		strcat (ptr, client->value);
+		strcat (ptr, ",");
+	}
+	strcat (ptr, interface);
+
+	client->command (client, "set", TEMPLATE_PREFIX "interfaces/configured", ptr, NULL);
+
+	free (ptr);
+	return 1;
+}
+
+#if 0
 void
 netcfg_get_common(struct debconfclient *client, char **interface,
                   char **hostname, char **domain, char **nameservers)
@@ -335,14 +371,11 @@
             "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-";
         size_t len;
 
-        netcfg_get_interface(client, interface);
-
         do {
 		free(*hostname);
 
                 *hostname =
-                    strdup(debconf_input
-                           (client, "medium", "netcfg/get_hostname"));
+                    strdup(debconf_input ("medium", TEMPLATE_PREFIX "common/hostname"));
 
                 len = strlen(*hostname);
 
@@ -360,7 +393,7 @@
 			free(*hostname);
 			*hostname = NULL;
                         client->command(client, "set",
-                                        "netcfg/get_hostname", "debian");
+                                        "netcfg/common/hostname", "debian");
 		}
         
 	} while (!*hostname);
@@ -370,14 +403,14 @@
 
 	*domain = NULL;
         
-	if ((ptr = debconf_input(client, "medium", "netcfg/get_domain")))
+	if ((ptr = debconf_input("medium", "netcfg/common/domain")))
                 *domain = strdup(ptr);
 
 	free(*nameservers);
         
 	*nameservers = NULL;
         if ((ptr =
-             debconf_input(client, "medium", "netcfg/get_nameservers")))
+             debconf_input("medium", "netcfg/commin/nameservers")))
                 *nameservers = strdup(ptr);
 
 }
@@ -391,13 +424,13 @@
                 save = ptr = strdup(nameservers);
 
                 ns = strtok_r(ptr, " \n\t", &ptr);
-                dot2num(&array[0], ns);
+                //dot2num(&array[0], ns);
 
                 ns = strtok_r(NULL, " \n\t", &ptr);
-                dot2num(&array[1], ns);
+                //dot2num(&array[1], ns);
 
                 ns = strtok_r(NULL, " \n\t", &ptr);
-                dot2num(&array[2], ns);
+                //dot2num(&array[2], ns);
 
                 array[3] = 0;
                 free(save);
@@ -418,13 +451,13 @@
         if ((fp = file_open(HOSTS_FILE))) {
                 fprintf(fp, "127.0.0.1\tlocalhost\n");
                 if (ipaddress) {
-                        if (domain)
-                                fprintf(fp, "%s\t%s.%s\t%s\n",
-                                        num2dot(ipaddress), hostname,
-					domain, hostname);
-                        else
-                                fprintf(fp, "%s\t%s\n", num2dot(ipaddress),
-						hostname);
+                        //if (domain)
+                                //fprintf(fp, "%s\t%s.%s\t%s\n",
+                                //        num2dot(ipaddress), hostname,
+				//	domain, hostname);
+                        //else
+                                //fprintf(fp, "%s\t%s\n", num2dot(ipaddress),
+				//		hostname);
                 }
 
                 fclose(fp);
@@ -435,10 +468,11 @@
                 if (domain)
                         fprintf(fp, "search %s\n", domain);
 
-                while (nameservers[i])
-                        fprintf(fp, "nameserver %s\n",
-                                num2dot(nameservers[i++]));
+                //while (nameservers[i])
+                //        fprintf(fp, "nameserver %s\n",
+                //                num2dot(nameservers[i++]));
 
                 fclose(fp);
         }
 }
+#endif
Index: netcfg.h
===================================================================
RCS file: /cvs/debian-boot/debian-installer/tools/netcfg/netcfg.h,v
retrieving revision 1.6
diff -u -r1.6 netcfg.h
--- netcfg.h	16 Oct 2001 17:01:30 -0000	1.6
+++ netcfg.h	4 Nov 2002 18:34:49 -0000
@@ -14,34 +14,30 @@
 #define DHCPCD_FILE     "/etc/dhcpc/config"
 #define DHCLIENT_DIR	"/var/dhcp"
 
+#define TEMPLATE_PREFIX	"debian-installer/netcfg/"
 
-extern int netcfg_mkdir (char *path);
+struct debconfclient *client;
 
-extern int is_interface_up (char *inter);
-
-extern void get_name (char *name, char *p);
-
-extern void getif_start ();
-
-extern void getif_end ();
-
-extern char *get_ifdsc (const char *ifp);
-
-extern FILE *file_open (char *path);
-
-extern void dot2num (u_int32_t * num, char *dot);
-
-extern char *num2dot (u_int32_t num);
-
-extern void netcfg_die (struct debconfclient *client);
-
-extern void netcfg_get_common (struct debconfclient *client, char **interface,
-			       char **hostname, char **domain,
-			       char **nameservers);
-
-extern void netcfg_write_common (u_int32_t ipaddress, char *domain,
-				 char *hostname, u_int32_t nameservers[]);
-
-void netcfg_nameservers_to_array(char *nameservers, u_int32_t array[]);
+struct interface_info
+{
+	char *interface;
+	char *description;
+	enum { PTP_NO, PTP_YES } pointopoint;
+	enum { INET6_NO, INET6_YES, INET6_PART, INET6_ONLY } inet6;
+};
+
+char *debconf_input (char *priority, char *question);
+char *debconf_interface_input (char *interface, char *priority, char *questionprefix, char *question);
+void debconf_interface_ask (char *interface, char *priority, char *questionprefix, char *question);
+char *debconf_interface_get (char *interface, char *questionprefix, char *question);
+void debconf_interface_set (char *interface, char *questionprefix, char *question, char *to);
+void debconf_interface_register (char *interface, char *questionprefix, char *question);
+void debconf_interface_unregister (char *interface, char *questionprefix, char *question);
+
+const struct interface_info *const netcfg_common_interface_info (const char *interface);
+void netcfg_die (void);
+void netcfg_common_get_interface (char *interface, size_t size);
+int netcfg_common_interface_configured (const char *interface);
+int netcfg_common_interface_configured_add (const char *interface);
 
 #endif /* _NETCFG_H_ */
Index: debian/changelog
===================================================================
RCS file: /cvs/debian-boot/debian-installer/tools/netcfg/debian/changelog,v
retrieving revision 1.34
diff -u -r1.34 changelog
--- debian/changelog	24 Oct 2002 10:51:05 -0000	1.34
+++ debian/changelog	4 Nov 2002 18:34:49 -0000
@@ -1,3 +1,15 @@
+netcfg (0.17) unstable; urgency=low
+
+  * NOT RELEASED YET
+  * waldi:
+    - rewrite of netcfg-static
+      + use iproute
+        - remove unneeded pointopoint address
+        - add ipv6 support
+      + save config of each interface in the debconf db
+
+ -- Bastian Blank <waldi@debian.org>  Mon, 04 Nov 2002 19:23:45 +0100
+
 netcfg (0.16) unstable; urgency=low
 
   * Build-dep on libdebian-installer1-dev, not libdebian-installer-dev.
Index: debian/netcfg-common.templates
===================================================================
RCS file: /cvs/debian-boot/debian-installer/tools/netcfg/debian/netcfg-common.templates,v
retrieving revision 1.6
diff -u -r1.6 netcfg-common.templates
--- debian/netcfg-common.templates	20 Oct 2002 21:28:46 -0000	1.6
+++ debian/netcfg-common.templates	4 Nov 2002 18:34:49 -0000
@@ -1,4 +1,4 @@
-Template: netcfg/get_domain
+Template: debian-installer/netcfg/common/domain
 Type: string
 _Description: Choose the domain name.
  The domain name is the part of your Internet address to the right of your
@@ -6,7 +6,7 @@
  If you are setting up a home network, you can make something up, but make
  sure you use the same domain name on all your computers.
 
-Template: netcfg/get_nameservers
+Template: debian-installer/netcfg/common/nameservers
 Type: string
 _Description: Choose the DNS Server Addresses
  Please enter the IP addresses (not host names) of up to 3 name servers,
@@ -14,7 +14,7 @@
  order in which you enter them. If you don't want to use any name servers
  just leave this field blank.
 
-Template: netcfg/choose_interface
+Template: debian-installer/netcfg/common/choose_interface
 Type: select
 Choices: ${ifchoices}
 _Description: Choose an interface.
@@ -22,12 +22,12 @@
  network interface that you will need for installing the Debian system (via
  NFS or HTTP).
 
-Template: netcfg/error_cfg
+Template: debian-installer/netcfg/common/error_cfg
 Type: note
 _Description: An error occured.
  Something went wrong when I tried to activate your network.
 
-Template: netcfg/get_hostname
+Template: debian-installer/netcfg/common/hostname
 Type: string
 Default: debian
 _Description: Enter the system's hostname.
@@ -36,22 +36,26 @@
  administrator.  If you are setting up your own home network, you can make
  something up here.
 
-Template: netcfg/invalid_hostname
+Template: debian-installer/netcfg/common/invalid_hostname
 Type: note
 _Description: The hostname "${hostname}" is invalid.
  A valid hostname may contain only alphanumeric characters and the minus
  sign, be between 2 and 63 characters long, and cannot begin or end with a
  minus sign.
 
-Template: netcfg/error
+Template: debian-installer/netcfg/common/error
 Type: note
 _Description: An error occured and I cannot continue.
  Feel free to retry.
 
-Template: netcfg/no_interfaces
+Template: debian-installer/netcfg/common/no_interfaces
 Type: note
 _Description: No interfaces were detected.
  No network interfaces were found.   That means that the installation
  system was unable to find a network device.  If you do have a network
  card, then it is possible that the module for it hasn't been selected
  yet.  Go back to 'Configure network hardware'.
+
+Template: debian-installer/netcfg/interfaces/configured
+Type: note
+Description: configured interfaces
Index: debian/netcfg-static.templates
===================================================================
RCS file: /cvs/debian-boot/debian-installer/tools/netcfg/debian/netcfg-static.templates,v
retrieving revision 1.8
diff -u -r1.8 netcfg-static.templates
--- debian/netcfg-static.templates	20 Oct 2002 21:28:46 -0000	1.8
+++ debian/netcfg-static.templates	4 Nov 2002 18:34:49 -0000
@@ -1,19 +1,53 @@
-Template: netcfg/get_ipaddress
+Template: debian-installer/netcfg/static/common/confirm_pointopoint
+Type: boolean
+Default: true
+_Description: Is this configuration correct?
+  interface     = ${interface}
+  gateway       = ${gateway}
+
+Template: debian-installer/netcfg/static/common/pointopoint
+Type: boolean
+Default: false
+Description: internal: pointopoint
+
+Template: debian-installer/netcfg/static/common/pointopoint_gateway
+Type: boolean
+Default: true
+_Description: Gateway?
+ Is this interface the connection to your default gateway?
+
+Template: debian-installer/netcfg/static/families/choose
+Type: select
+Choices: INET: IPv4 only, INET6: IPv6 only, INET+INET6: IPv4 and IPv6
+_Description: families?
+ families?
+
+Template: debian-installer/netcfg/static/families/choose_inet6_part
+Type: select
+Choices: INET: IPv4 only, INET6: IPv6 only, INET+INET6: IPv4 and IPv6
+_Description: families?
+ families?
+ .
+ I can't decide if IPv6 is supported.
+
+Template: debian-installer/netcfg/static/families/inet
+Type: boolean
+Default: false
+Description: internal: familie INET
+
+Template: debian-installer/netcfg/static/families/inet6
+Type: boolean
+Default: false
+Description: internal: familie INET6
+
+Template: debian-installer/netcfg/static/inet/address
 Type: string
 _Description: IP address?
  The IP address is unique to your computer and consists of four numbers
  separated by periods.  If you don't know what to use here, consult your
  network administrator.
 
-Template: netcfg/get_pointopoint
-Type: string
-_Description: Pointopoint address?
- The pointopoint address is used to determine the other endpoint of the
- point to point network.  Consult your network administrator if you do not
- know the value.  The pointopoint address should be entered as four numbers
- separated by periods.
-
-Template: netcfg/get_netmask
+Template: debian-installer/netcfg/static/inet/netmask
 Type: string
 _Description: Netmask?
  The netmask is used to determine which machines are local to your
@@ -21,7 +55,7 @@
  value.  The netmask should be entered as four numbers separated by
  periods.
 
-Template: netcfg/get_gateway
+Template: debian-installer/netcfg/static/inet/gateway
 Type: string
 _Description: Gateway?
  This is an IP address (four numbers separated by periods) that indicates
@@ -31,21 +65,49 @@
  can leave this blank.  If you don't know the proper answer to this
  question, consult your network administrator.
 
-Template: netcfg/gateway_unreachable
-Type: note
-_Description: The gateway you entered is unreachable.
- You may have made an error entering your ipaddress, netmask and/or
- gateway.
+Template: debian-installer/netcfg/static/inet6/address
+Type: string
+_Description: IP address?
+ The IP address is unique to your computer and consists of 8 hexadecimal
+ numbers separated by colons.  If you don't know what to use here, consult your
+ network administrator.
+
+Template: debian-installer/netcfg/static/inet6/netmask
+Type: string
+_Description: Netmask?
+ The netmask is used to determine which machines are local to your
+ network.  Consult your network administrator if you do not know the
+ value.  The netmask should be entered as a single number.
+
+Template: debian-installer/netcfg/static/inet6/gateway
+Type: string
+_Description: Gateway?
+ This is an IP address that indicates the gateway router, also known as the
+ default router.  All traffic that goes outside your LAN (for instance, to the
+ Internet) is sent through this router.  In rare circumstances, you may have no
+ router; in that case, you can leave this blank.  If you don't know the proper
+ answer to this question, consult your network administrator.
 
-Template: netcfg/confirm_static
+Template: debian-installer/netcfg/static/confirm
 Type: boolean
 Default: true
 _Description: Is this configuration correct?
   interface     = ${interface}
-  hostname      = ${hostname}
-  domain        = ${domain}
-  ipaddress     = ${ipaddress}
+  address       = ${address}
   netmask       = ${netmask}
   gateway       = ${gateway}
-  pointopoint   = ${pointopoint}
-  nameservers   = ${nameservers}
+
+Template: debian-installer/netcfg/static/confirm_pointopoint
+Type: boolean
+Default: true
+_Description: Is this configuration correct?
+  interface     = ${interface}
+  address       = ${address}
+
+Template: debian-installer/netcfg/static/gateway_unreachable
+Type: note
+_Description: The gateway you entered is unreachable.
+ You may have made an error entering your ipaddress, netmask and/or
+ gateway.
+
+

Attachment: pgpHkidz3SnSI.pgp
Description: PGP signature


Reply to: