Ifconfig timeout

Hi all,

I am building an application which can be setup with either DHCP or static IP through a web UI.

The changing from DHCP to static IP, and vice versa, is done in a function called toggle_dhcp().
One of the first lines in the method is “ifconfig(IF_DEFAULT, IFG_DHCP, IFS_END)” to check if DHCP is currently being used.
However, this call consistently times out each time.

Is this there something wrong with this use of ifconfig?

Any help is appreciated.

Tor Erik

When using IFG_x you need an additional argument which is the pointer to where to store the result. For your example you would use:

bool bDHCP;

This fetches the current DHCP state into bDHCP.