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

Bug#384655: when default interface has been detected, lower choose_interface priority



Package: netcfg
Severity: wishlist
Tags: patch

When a default interface has been detected, chances are DHCP will succeed when
probing it (and if it doesn't, user will be queried anyway).  Besides, I think
critical priority is excessive for this kind of question.

I'm attaching a patch to distinguish this situation and use a lower priority.

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-2-amd64-k8
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8)
Index: netcfg/netcfg-common.c
===================================================================
--- netcfg/netcfg-common.c	(revision 40198)
+++ netcfg/netcfg-common.c	(working copy)
@@ -440,6 +440,7 @@
     char *ptr = NULL;
     char *ifdsc = NULL;
     char *old_selection = NULL;
+    char *tmpif = defif;
 
     if (*interface) {
         free(*interface);
@@ -455,8 +456,8 @@
     num_interfaces = get_all_ifs(1, &ifs);
 
     /* If no default was provided, use the first in the list of interfaces. */
-    if (! defif && num_interfaces > 0) {
-        defif=ifs[0];
+    if (! tmpif && num_interfaces > 0) {
+        tmpif=ifs[0];
     }
 
     /* Remember old interface selection, in case it's preseeded. */
@@ -484,7 +485,7 @@
         snprintf(temp, newchars, "%s: %s", inter, ifdsc);
 
 	if (num_interfaces > 1 &&
-	    ((strcmp(defif, inter) == 0) || (strcmp(defif, temp) == 0)))
+	    ((strcmp(tmpif, inter) == 0) || (strcmp(tmpif, temp) == 0)))
 		debconf_set(client, "netcfg/choose_interface", temp);
 
 	di_snprintfcat(ptr, len, "%s, ", temp);
@@ -516,12 +517,12 @@
         debconf_subst(client, "netcfg/choose_interface", "ifchoices", ptr);
         free(ptr);
 
- 	asked = (debconf_input(client, "critical", "netcfg/choose_interface") == 0);
+ 	asked = (debconf_input(client, defif ? "high" : "critical", "netcfg/choose_interface") == 0);
         ret = debconf_go(client);
 
         /* If the question is not asked, honor preseeded interface name.
 	 * However, if it was preseeded to "auto", or there was no old value,
-	 * leave it set to defif. */
+	 * leave it set to tmpif. */
         if (!asked && strlen(old_selection) && strcmp(old_selection, "auto") != 0) {
 	    debconf_set(client, "netcfg/choose_interface", old_selection);
 	}

Reply to: