> when udhcpc fails to get a lease, it waits a full minute before
 > trying again.  in some cases this is far too long.  clearly
 > the udhcpc commandline is becoming over-burdened, but without
 > a config file, there's not much choice:  i'd like to add
 > an option (i chose '-A', for "again") which lets one set the
 > try-again value.

this patch is incorrect.  don't apply, please.  (i botched the
getopt calls during a minor reword before posting.  sigh.)

paul

 > 
 > Index: networking/udhcp/dhcpc.c
 > ===================================================================
 > RCS file: /cvs/thirdparty/busybox-1.8.0/networking/udhcp/dhcpc.c,v
 > retrieving revision 1.1.1.1
 > diff -u -r1.1.1.1 dhcpc.c
 > --- networking/udhcp/dhcpc.c 5 Nov 2007 13:45:42 -0000       1.1.1.1
 > +++ networking/udhcp/dhcpc.c 5 Nov 2007 17:13:59 -0000
 > @@ -144,7 +144,7 @@
 >  int udhcpc_main(int argc, char **argv)
 >  {
 >      uint8_t *temp, *message;
 > -    char *str_c, *str_V, *str_h, *str_F, *str_r, *str_T, *str_t;
 > +    char *str_c, *str_V, *str_h, *str_F, *str_r, *str_T, *str_A, *str_t;
 >      uint32_t xid = 0;
 >      uint32_t lease = 0; /* can be given as 32-bit quantity */
 >      unsigned t1 = 0, t2 = 0; /* what a wonderful names */
 > @@ -179,6 +179,7 @@
 >              OPT_t = 1 << 16,
 >              OPT_v = 1 << 17,
 >              OPT_S = 1 << 18,
 > +            OPT_A = 1 << 19,
 >      };
 >  #if ENABLE_GETOPT_LONG
 >      static const char udhcpc_longopts[] ALIGN1 =
 > @@ -200,6 +201,7 @@
 >              "timeout\0"       Required_argument "T"
 >              "version\0"       No_argument       "v"
 >              "retries\0"       Required_argument "t"
 > +            "tryagain\0"      Required_argument "A"
 >              "syslog\0"        No_argument       "S"
 >              ;
 >  #endif
 > @@ -208,6 +210,7 @@
 >      client_config.script = DEFAULT_SCRIPT;
 >      client_config.retries = 3;
 >      client_config.timeout = 3;
 > +    client_config.tryagain = 60;
 >  
 >      /* Parse command line */
 >      opt_complementary = "c--C:C--c" // mutually exclusive
 > @@ -215,10 +218,10 @@
 >  #if ENABLE_GETOPT_LONG
 >      applet_long_options = udhcpc_longopts;
 >  #endif
 > -    opt = getopt32(argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:vS",
 > +    opt = getopt32(argv, "c:CV:fbH:h:F:i:np:qRr:s:T:A:t:vS",
 >              &str_c, &str_V, &str_h, &str_h, &str_F,
 >              &client_config.interface, &client_config.pidfile, &str_r,
 > -            &client_config.script, &str_T, &str_t
 > +            &client_config.script, &str_T, &str_A, &str_t
 >              );
 >  
 >      if (opt & OPT_c)
 > @@ -259,6 +262,8 @@
 >              client_config.timeout = xatoi_u(str_T);
 >      if (opt & OPT_t)
 >              client_config.retries = xatoi_u(str_t);
 > +    if (opt & OPT_A)
 > +            client_config.tryagain = xatoi_u(str_A);
 >      if (opt & OPT_v) {
 >              puts("version "BB_VER);
 >              return 0;
 > @@ -355,7 +360,7 @@
 >                                      }
 >                                      /* wait to try again */
 >                                      packet_num = 0;
 > -                                    timeout = now + 60;
 > +                                    timeout = now + client_config.tryagain;
 >                              }
 >                              break;
 >                      case RENEW_REQUESTED:
 > Index: networking/udhcp/dhcpc.h
 > ===================================================================
 > RCS file: /cvs/thirdparty/busybox-1.8.0/networking/udhcp/dhcpc.h,v
 > retrieving revision 1.1.1.1
 > diff -u -r1.1.1.1 dhcpc.h
 > --- networking/udhcp/dhcpc.h 5 Nov 2007 13:45:42 -0000       1.1.1.1
 > +++ networking/udhcp/dhcpc.h 5 Nov 2007 17:13:59 -0000
 > @@ -30,6 +30,7 @@
 >      int ifindex;                    /* Index number of the interface to use 
 > */
 >      int retries;                    /* Max number of request packets */
 >      int timeout;                    /* Number of seconds to try to get a 
 > lease */
 > +    int tryagain;                   /* Seconds to wait after failure */
 >      uint8_t arp[6];                 /* Our arp address */
 >  };
 >  
 > Index: include/usage.h
 > ===================================================================
 > RCS file: /cvs/thirdparty/busybox-1.8.0/include/usage.h,v
 > retrieving revision 1.1.1.1
 > diff -u -r1.1.1.1 usage.h
 > --- include/usage.h  5 Nov 2007 13:45:42 -0000       1.1.1.1
 > +++ include/usage.h  5 Nov 2007 17:13:59 -0000
 > @@ -3835,6 +3835,8 @@
 >         "\n  -r,--request=IP         IP address to request" \
 >         "\n  -s,--script=file        Run file at dhcp events (default: 
 > /usr/share/udhcpc/default.script)" \
 >         "\n  -t,--retries=N          Send up to N request packets"\
 > +       "\n  -T,--timeout=N          Try to get a lease for N seconds 
 > (default: 3)"\
 > +       "\n  -A,--tryagain=N         Wait N seconds (default: 60) after 
 > failure"\
 >         "\n  -f,--foreground Run in foreground" \
 >         "\n  -b,--background Background if lease cannot be immediately 
 > negotiated" \
 >         "\n  -S,--syslog     Log to syslog too" \
 > 
 > 
 > 
 > =---------------------
 >  paul fox, [EMAIL PROTECTED]
 > _______________________________________________
 > busybox mailing list
 > [email protected]
 > http://busybox.net/cgi-bin/mailman/listinfo/busybox

=---------------------
 paul fox, [EMAIL PROTECTED]
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to