Bug#537271: closed by Matthew Palmer <mpalmer@debian.org>
Matthew Palmer wrote:
> On Sun, Feb 06, 2011 at 10:15:48PM -0500, Robert Edmonds wrote:
> > (this should probably
> > actually be a loop that repeatedly invokes arping with a short
> > timeout in order to update the progress bar.)
>
> This really needs to be implemented. Leaving users hanging with no clue as
> to what's happening for 45 seconds isn't right.
>
> I've left the patch tag on the bug for now, on the assumption that this can
> be fixed RSN.
ok, i've rewritten the patch such that the first 50% of the progress bar
is waiting for the link to come up and the second 50% of the progress
bar is the gateway reachability test. the reachability test now
repeatedly invokes arping with a one second timeout (up to 50 times)
until arping exits with a status of 0. (arping exits with a status of 1
if the time expired.)
in cases where the gateway is reachable as soon as the link is up or no
gateway is configured there will be an instantaneous jump from <50% to
100%.
in cases where the gateway takes 30 seconds to become reachable the
progress bar will increment by 1%/second until instantaneously jumping
from ~80% to 100%.
> Also, busybox patches should be put into a separate bug report which blocks
> this one, to keep things clear.
#612249
--
Robert Edmonds
edmonds@debian.org
diff -Npru netcfg-1.60.orig/netcfg-common.c netcfg-1.60/netcfg-common.c
--- netcfg-1.60.orig/netcfg-common.c 2011-02-05 20:42:06.000000000 -0500
+++ netcfg-1.60/netcfg-common.c 2011-02-07 01:36:38.683940125 -0500
@@ -1035,23 +1035,40 @@ void netcfg_update_entropy (void)
*/
int netcfg_detect_link(struct debconfclient *client, const char *if_name)
{
- int wait_count, rv = 0;
+ char arping[256];
+ char s_gateway[INET_ADDRSTRLEN];
+ int count, rv = 0;
+ int link_waits = NETCFG_LINK_WAIT_TIME * 4;
+ int gw_tries = NETCFG_GATEWAY_REACHABILITY_TRIES;
+
+ 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);
+ }
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");
- for (wait_count = 0; wait_count < NETCFG_LINK_WAIT_TIME * 4; wait_count++) {
+ debconf_progress_start(client, 0, 100, "netcfg/link_detect_progress");
+ for (count = 0; count < link_waits; count++) {
usleep(250000);
- if (debconf_progress_step(client, 1) == 30) {
+ if (debconf_progress_set(client, 50 * count / link_waits) == 30) {
/* User cancelled on us... bugger */
rv = 0;
break;
}
- if (ethtool_lite (if_name) == 1) /* ethtool-lite's CONNECTED */ {
- debconf_progress_set(client, NETCFG_LINK_WAIT_TIME * 4);
+ if (ethtool_lite(if_name) == 1) /* ethtool-lite's CONNECTED */ {
+ if (gateway.s_addr) {
+ for (count = 0; count < gw_tries; count++) {
+ if (di_exec_shell_log(arping) == 0)
+ break;
+ if (debconf_progress_set(client, 50 + 50 * count / gw_tries) == 30)
+ break;
+ }
+ }
rv = 1;
break;
}
+ debconf_progress_set(client, 100);
}
debconf_progress_stop(client);
diff -Npru netcfg-1.60.orig/netcfg.h netcfg-1.60/netcfg.h
--- netcfg-1.60.orig/netcfg.h 2011-02-05 20:42:06.000000000 -0500
+++ netcfg-1.60/netcfg.h 2011-02-07 01:32:02.895935476 -0500
@@ -47,6 +47,11 @@
*/
#define NETCFG_LINK_WAIT_TIME 3
+/* The number of times to attempt to verify gateway reachability.
+ * Each try invokes arping with a one second timeout.
+ */
+#define NETCFG_GATEWAY_REACHABILITY_TRIES 50
+
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 63
#endif
Reply to: