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

Bug#282650: default gateway also incorrect



How about something like the attached patch?  So far this seems to do the
right thing for both preseeding and manual installs, though its quite
possible I'm missing something obvious.


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)


Thanks,


 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 08:14:11.000000000 -0800
@@ -9,6 +9,7 @@
 #include <arpa/inet.h>
 #include <debian-installer.h>
 #include <assert.h>
+#include <sys/stat.h>
 
 struct in_addr old_ipaddress = { 0 };
 struct in_addr nameserver_array[4] = { { 0 }, };
@@ -90,6 +91,7 @@
     int ret, ok = 0;
     char ptr1[INET_ADDRSTRLEN];
     struct in_addr old_netmask = netmask;
+    struct stat buf;
         
     while (!ok)
     {
@@ -119,8 +121,12 @@
       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);
+      if(stat("/var/log/debconf-seed", &buf) == 0) 
+      	netcfg_get_gateway(client);
+      else {
+      	gateway.s_addr = ipaddress.s_addr & netmask.s_addr;
+      	gateway.s_addr |= htonl(1); 
+      }
     }
 
     inet_ntop (AF_INET, &gateway, ptr1, sizeof (ptr1));
@@ -180,7 +186,15 @@
 {
     char *ptr, ptr1[INET_ADDRSTRLEN];
     int ret;
+    struct stat buf;
        
+    if(stat("/var/log/debconf-seed", &buf) == 0) {
+    	debconf_get(client, "netcfg/get_nameservers");
+    	ptr = client->value;
+    	if (ptr)
+        	*nameservers = strdup(ptr);
+    }
+
     if (*nameservers)
         ptr = *nameservers;
     else if (gateway.s_addr)

Reply to: