Setting NTP server address according to some conditions
I’m using LWIP 2.0.3. In my code I have a static NTP server address. But this address can be invalid or valid (depending what the user will write in it). If DHCP is enabled I want to reach the following behavior:
If the NTP server address is delivered via the DHCP, it will be set and used (it doesn’t matter what is the static address).
If the NTP server address is not delivered via the DHCP and the static NTP server address is invalid, the NTP will not be initialized.
If the NTP server address is not delivered, but the static NTP server address is valid, the NTP will be initialized and will use the static address.
To reach this, I need to decide what to do in the call of the function dhcp_set_ntp_address(). But there is no callback, so I cannot call my own code. How can I reach this behavior without modifying the original code of the stack (file sntp.c)?