[BusyBox] Serious bug in udhcpc

Michael Sternberg mishka at sdf.lonestar.org
Mon Apr 21 04:44:07 UTC 2003


> From: Russ Dill [mailto:Russ.Dill at asu.edu]
> its declared static, it will be initialized to 0, are you using
> some weird compiler?


~> ppc_8xx-gcc -v
ppc_8xx-gcc: Actual path = '/opt/hardhat/devkit/ppc/8xx/bin/'
	Actual name = 'ppc_8xx-gcc'
	Invoking /opt/hardhat/devkit/ppc/8xx/bin/../lib/gcc-lib/powerpc-hardhat-linux/2.95.3/ppc_8xx-gcc
Reading specs from /opt/hardhat/devkit/ppc/8xx/bin/../lib/gcc-lib/powerpc-hardhat-linux/2.95.3/specs
gcc version 2.95.3 20010315 (release/MontaVista)
-----------------------------------------------------------

I found your problem. Please define timeout just "long" and not
"unsigned long". In line 335 instead of receiving negative value
you receive a huge positive value.

Check out the following code:

static unsigned long timeout;
struct timeval tv;
int main()
{
   printf("timeout is %ld, ", timeout);
   tv.tv_sec = timeout - time(0);
   printf("tv.tv_sec is %ld\n", tv.tv_sec);
}

Here are results on Intel:
timeout is 0, tv.tv_sec is -1050899824

Here are results on PPC:
timeout is 0, tv.tv_sec is 1645163368

And just as off topic question - why just not to call send_discover
as first thing when you start program ??

			Michael.

-- 




More information about the busybox mailing list