[PATCH 6/7] dhcp: add retries limit support

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Thu Sep 13 03:38:38 EDT 2012


On 09:12 Thu 13 Sep     , Sascha Hauer wrote:
> On Wed, Sep 12, 2012 at 04:48:27PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > via -r opt, global.dhcp.retries or dhcp_retries
> > 
> > set the priority order;
> > 
> > This will allow to do not stay infinite loop if no dhcp availlable
> 
> s/availlable/available/
> 
> > @@ -746,11 +767,17 @@ static int do_dhcp(int argc, char *argv[])
> >  	while (dhcp_state != BOUND) {
> >  		if (ctrlc())
> >  			break;
> > +		if (!retries) {
> > +			ret = ETIMEDOUT;
> 
> -ETIMEDOUT
> 
> BTW currently we have in most commands:
> 
> 	return ret ? 1 : 0;
> 
> This is because the shell interpreted negative values as 'exit'. hush
> does not do this anymore, so now we can think about a path to just
> return negative error codes from the commands.
> 
> 
> > @@ -785,7 +812,8 @@ BAREBOX_CMD_HELP_OPT  ("-u <client_uuid>",
> >  BAREBOX_CMD_HELP_OPT  ("-U <user_class>",
> >  "DHCP User class (code 77) submitted in DHCP requests. It can\n"
> >  "be used in the DHCP server's configuration to select options\n"
> > -"(e.g. bootfile or server) which are valid for barebox clients only.\n");
> > +"(e.g. bootfile or server) which are valid for barebox clients only.\n")
> > +BAREBOX_CMD_HELP_OPT  ("-r <retry>", "retry limi\n");
> 
> s/limi/limit/
what do you think to put something else than infinite loop by default

I thinnk 20 is enough

Best Regards,
J.



More information about the barebox mailing list