2) If you want something that works now, the easiest thing to do is
modify this piece of code in dhcp.c:
---
static void dhcp_timeout(struct netif *netif)
{
/* back-off period has passed, or server selection timed out */
if ((dhcp->state == DHCP_BACKING_OFF) ||
(dhcp->state == DHCP_SELECTING)) {
dhcp_discover(netif);
/* receiving the requested lease timed out */
} else if (dhcp->state == DHCP_REQUESTING) {
---
into this:
---
static void dhcp_timeout(struct netif *netif)
{
if ((dhcp->state == DHCP_BACKING_OFF)
{
/* stop trying DHCP */
dhcp_stop(netif);
/* fallback */
ipconfig_fallback(netif);
} else if (dhcp->state == DHCP_SELECTING) {
if (dhcp->tries <= 2) {
dhcp_discover(netif);
} else {
/* stop trying DHCP */
dhcp_stop(netif);
/* fallback */
ipconfig_fallback(netif);
}
}
In ipconfig_fallback() configure the network interface as you like.