Browse Source

Wait for link detection on static interfaces. Closes: #606515

The code I wrote for link detection/progress bar fun previously was only
used on DHCP / autoconfigured NICs.  I've now added it to static interfaces,
too.
tags/1.60
Matt Palmer 10 years ago
parent
commit
776026360e
3 changed files with 10 additions and 6 deletions
  1. +4
    -6
      netcfg-common.c
  2. +1
    -0
      netcfg.c
  3. +5
    -0
      static.c

+ 4
- 6
netcfg-common.c View File

@@ -1028,16 +1028,15 @@ void netcfg_update_entropy (void)
#endif
}

/* Bring up an interface and attempt to find out whether we've got link.
* Use a progress bar so the user knows what's going on. Return true
* if we got link, and false otherwise.
/* Attempt to find out whether we've got link on an interface. Don't try to
* bring the interface up or down, we leave that to the caller. Use a
* progress bar so the user knows what's going on. Return true if we got
* link, and false otherwise.
*/
int netcfg_detect_link(struct debconfclient *client, const char *if_name)
{
int wait_count, rv = 0;
interface_up(if_name);
debconf_capb(client, "progresscancel");
debconf_subst(client, "netcfg/link_detect_progress", "interface", if_name);
debconf_progress_start(client, 0, NETCFG_LINK_WAIT_TIME * 4, "netcfg/link_detect_progress");
@@ -1055,7 +1054,6 @@ int netcfg_detect_link(struct debconfclient *client, const char *if_name)
}
}

interface_down(if_name);
debconf_progress_stop(client);
debconf_capb(client, "");


+ 1
- 0
netcfg.c View File

@@ -135,6 +135,7 @@ int main(int argc, char *argv[])
}
}

interface_up(*ifaces);
if (netcfg_detect_link (client, *ifaces) == 1) /* CONNECTED */ {
di_info("found link on interface %s, making it the default.", *ifaces);
defiface = strdup(*ifaces);


+ 5
- 0
static.c View File

@@ -382,6 +382,11 @@ int netcfg_activate_static(struct debconfclient *client)
return -1;
}

/* Wait to detect link. Don't error out if we fail, though; link detection
* may not work on this NIC or something.
*/
netcfg_detect_link(client, interface);

return 0;
}



Loading…
Cancel
Save