Skip to content

Commit

Permalink
First patch, bug 610752.
Browse files Browse the repository at this point in the history
  • Loading branch information
sorinasandu committed Apr 16, 2012
1 parent 3925ee8 commit 01b5860
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
8 changes: 8 additions & 0 deletions debian/netcfg-common.templates
Expand Up @@ -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.
18 changes: 17 additions & 1 deletion netcfg-common.c
Expand Up @@ -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");
Expand Down
5 changes: 2 additions & 3 deletions netcfg.h
Expand Up @@ -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

Expand Down

0 comments on commit 01b5860

Please sign in to comment.