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

Bug#282650: default gateway also incorrect



On Fri, 10 Dec 2004, Joey Hess wrote:

> > As an aside, how do I insert an updated udeb into the d-i image without
> > getting an md5 error when it unpacks?  I've updated md5sums.txt but it
> > still complains (trying to avoid rebuilding the whole thing)
>
> Put it in localudebs and list it in pkg-lists/local.

I don't have the whole d-i source, just a directory with the cd contents
which I run mkisofs on.  Its not that important I guess.


> Sorry, besides being very ugly, this assumes that network info is always
> preseeded if preseeding is done, which it is not.


Ok, good point.   How about this one?  Tested with manual, fully preseeded
and partially-preseeded (no networking info) installs.  LMK what you
think... there are probably some debconf monsters lurking in there that I
don't know about.



 Paul.

--
Paul Telford | 1024D/431B38BA | pxt@debian.org | paul@droflet.net
       C903 0E85 9AF5 1B80 6A5F  F169 D7E9 4363 431B 38BA
--- netcfg-1.07/static.c	2004-09-21 09:36:18.000000000 -0700
+++ netcfg-1.07.new/static.c	2004-12-10 11:48:04.000000000 -0800
@@ -90,6 +90,7 @@
     int ret, ok = 0;
     char ptr1[INET_ADDRSTRLEN];
     struct in_addr old_netmask = netmask;
+    char *ptr;
         
     while (!ok)
     {
@@ -119,8 +120,13 @@
       broadcast.s_addr = (network.s_addr | ~netmask.s_addr);
 
       /* Preseed gateway */
-      gateway.s_addr = ipaddress.s_addr & netmask.s_addr;
-      gateway.s_addr |= htonl(1);
+      debconf_get(client, "netcfg/get_gateway");
+      ptr = client->value;
+      if (empty_str(ptr))  {
+      	  gateway.s_addr = ipaddress.s_addr & netmask.s_addr; 
+          gateway.s_addr |= htonl(1); 
+      } else 
+	  netcfg_get_gateway(client);
     }
 
     inet_ntop (AF_INET, &gateway, ptr1, sizeof (ptr1));
@@ -181,15 +187,18 @@
     char *ptr, ptr1[INET_ADDRSTRLEN];
     int ret;
        
-    if (*nameservers)
+    debconf_get(client, "netcfg/get_nameservers");
+    if(!empty_str(client->value))
+	    ptr = client->value;
+    else {
+      if (*nameservers)
         ptr = *nameservers;
-    else if (gateway.s_addr)
-    {
+      else if (gateway.s_addr) {
         inet_ntop (AF_INET, &gateway, ptr1, sizeof (ptr1));
 	ptr = ptr1;
-    }
-    else
+      } else
 	ptr = "";
+    }
     debconf_set(client, "netcfg/get_nameservers", ptr);
     
     debconf_input(client, "critical", "netcfg/get_nameservers");

Reply to: