diff --git a/debian/netcfg-common.templates b/debian/netcfg-common.templates index e22983a6..10e7e359 100644 --- a/debian/netcfg-common.templates +++ b/debian/netcfg-common.templates @@ -329,3 +329,11 @@ Description: for internal use; can be preseeded Set to false to prevent /etc/network/interfaces being adjusted for use by network-manager. If you do this, network-manager will probably not work correctly. + +Template: netcfg/link_wait_timeout +Type: string +_Description: Waiting time + Enter waiting time (in seconds) for detecting the link. You + must enter a greater than zero value in order for it to be + considered. You can leave the field blank and a default value + will be used. diff --git a/netcfg-common.c b/netcfg-common.c index 129b86af..86a28bfc 100644 --- a/netcfg-common.c +++ b/netcfg-common.c @@ -1268,12 +1268,28 @@ int netcfg_detect_link(struct debconfclient *client, const char *if_name) int count, rv = 0; int link_waits = NETCFG_LINK_WAIT_TIME * 4; int gw_tries = NETCFG_GATEWAY_REACHABILITY_TRIES; + int ret; if (gateway.s_addr) { inet_ntop(AF_INET, &gateway, s_gateway, sizeof(s_gateway)); sprintf(arping, "arping -c 1 -w 1 -f -I %s %s", if_name, s_gateway); } - + + /* Ask for link detection timeout. */ + debconf_input(client, "low", "netcfg/link_wait_timeout"); + ret = debconf_go(client); + + if (!ret) + debconf_get(client, "netcfg/link_wait_timeout"); + + if (!ret && client->value) { + link_waits = atoi(client->value); + + if (link_waits <= 0) { + link_waits = NETCFG_LINK_WAIT_TIME * 4; + } + } + debconf_capb(client, "progresscancel"); debconf_subst(client, "netcfg/link_detect_progress", "interface", if_name); debconf_progress_start(client, 0, 100, "netcfg/link_detect_progress"); diff --git a/netcfg.h b/netcfg.h index 27e9049d..eebc12b3 100644 --- a/netcfg.h +++ b/netcfg.h @@ -46,9 +46,8 @@ "ff02::1 ip6-allnodes\n" \ "ff02::2 ip6-allrouters\n" -/* The time, in seconds, that we will wait for a link to be established - * via link autonegotiation. Sometime in the future this may become a - * preseed option. +/* The default time, in seconds, that we will wait for a link to be + * established via link autonegotiation. */ #define NETCFG_LINK_WAIT_TIME 3