I have done this, not sure if this would find much support for the mainline tcp.
in FreeRTOS_DHCP.h
typedef enum eDHCP_PHASE
{
eDHCPPhasePreDiscover, /* Driver is about to send a DHCP discovery. */
eDHCPPhasePreRequest, /* Driver is about to request DHCP an IP address. */
eDHCPPhaseFailed,//<-- added
#if( ipconfigDHCP_SEND_DISCOVER_AFTER_AUTO_IP != 0 )
eDHCPPhasePreLLA, /* Driver is about to try get an LLA address */
#endif /* ipconfigDHCP_SEND_DISCOVER_AFTER_AUTO_IP */
} eDHCPCallbackPhase_t;
in FreeRTOS_DHCP.c
if( xGivingUp != pdFALSE )
{
/* xGivingUp became true either because of a time-out, or because
xApplicationDHCPHook() returned another value than 'eDHCPContinue',
meaning that the conversion is canceled from here. */
#if( ipconfigUSE_DHCP_HOOK != 0 )//<-- Added, line 520
eAnswer = xApplicationDHCPHook( eDHCPPhaseFailed, xNetworkAddressing.ulDefaultIPAddress );
#endif /* ipconfigUSE_DHCP_HOOK */
/* Revert to static IP address. */
taskENTER_CRITICAL();