tags:

views:

480

answers:

3

Hello,

I am working on embedded device who run BusyBox. The system is getting its address by using the ip command. I want to figure out from my C program whether the device ip static or received from DHCP server. How do I do that ?

amit

+1  A: 

The dumpleases command is supposed to show the current leases. I guess if you can determine that you have an IP address, but no lease, then the address is static.

unwind
the device get its address using ip command and not udhcp so dumpleases does not work
amitp
A: 

Take a look at this question and check the IFF_DYNAMIC flag - that may be set when DHCP is active on an interface.

Adam Liss
IFF_DYNAMIC indicate dialup device with changing addresses
amitp
in Solaris there is IFF_DHCPRUNNING flag. Is there Linux equivalent ?
amitp
A: 

If you control the enviroment, I suggest setting an env variable, or creating a flag file somewhere you can stat, when the IP adress is set.

gnud