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
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
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.
Take a look at this question and check the IFF_DYNAMIC flag - that may be set when DHCP is active on an interface.
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.