Advertisement
sorinasandu

netcfg_bug#610752_first_attempt

Mar 31st, 2012
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.34 KB | None | 0 0
  1. diff --git a/debian/netcfg-common.templates b/debian/netcfg-common.templates
  2. index e22983a..10e7e35 100644
  3. --- a/debian/netcfg-common.templates
  4. +++ b/debian/netcfg-common.templates
  5. @@ -329,3 +329,11 @@ Description: for internal use; can be preseeded
  6.   Set to false to prevent /etc/network/interfaces being adjusted for use by
  7.   network-manager. If you do this, network-manager will probably not work
  8.   correctly.
  9. +
  10. +Template: netcfg/link_wait_timeout
  11. +Type: string
  12. +_Description: Waiting time
  13. + Enter waiting time (in seconds) for detecting the link. You
  14. + must enter a greater than zero value in order for it to be
  15. + considered. You can leave the field blank and a default value
  16. + will be used.
  17. diff --git a/netcfg-common.c b/netcfg-common.c
  18. index 129b86a..86a28bf 100644
  19. --- a/netcfg-common.c
  20. +++ b/netcfg-common.c
  21. @@ -1268,12 +1268,28 @@ int netcfg_detect_link(struct debconfclient *client, const char *if_name)
  22.      int count, rv = 0;
  23.      int link_waits = NETCFG_LINK_WAIT_TIME * 4;
  24.      int gw_tries = NETCFG_GATEWAY_REACHABILITY_TRIES;
  25. +    int ret;
  26.  
  27.      if (gateway.s_addr) {
  28.          inet_ntop(AF_INET, &gateway, s_gateway, sizeof(s_gateway));
  29.          sprintf(arping, "arping -c 1 -w 1 -f -I %s %s", if_name, s_gateway);
  30.      }
  31. -    
  32. +
  33. +    /* Ask for link detection timeout. */
  34. +    debconf_input(client, "low", "netcfg/link_wait_timeout");
  35. +    ret = debconf_go(client);
  36. +
  37. +    if (!ret)
  38. +        debconf_get(client, "netcfg/link_wait_timeout");
  39. +
  40. +    if (!ret && client->value) {
  41. +        link_waits = atoi(client->value);
  42. +
  43. +        if (link_waits <= 0) {
  44. +            link_waits = NETCFG_LINK_WAIT_TIME * 4;
  45. +        }
  46. +    }
  47. +
  48.      debconf_capb(client, "progresscancel");
  49.      debconf_subst(client, "netcfg/link_detect_progress", "interface", if_name);
  50.      debconf_progress_start(client, 0, 100, "netcfg/link_detect_progress");
  51. diff --git a/netcfg.h b/netcfg.h
  52. index 27e9049..eebc12b 100644
  53. --- a/netcfg.h
  54. +++ b/netcfg.h
  55. @@ -46,9 +46,8 @@
  56.  "ff02::1 ip6-allnodes\n" \
  57.  "ff02::2 ip6-allrouters\n"
  58.  
  59. -/* The time, in seconds, that we will wait for a link to be established
  60. - * via link autonegotiation.  Sometime in the future this may become a
  61. - * preseed option.
  62. +/* The default time, in seconds, that we will wait for a link to be
  63. + * established via link autonegotiation.
  64.   */
  65.  #define NETCFG_LINK_WAIT_TIME 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement