From: richardbarry Date: Mon, 14 Oct 2013 14:35:53 +0000 (+0000) Subject: Add a configASSERT() that checks the gateway address is on the same subnet as the... X-Git-Tag: V7.5.3~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7e05145672de1ccab2316da5f66152bc74f76343;p=freertos Add a configASSERT() that checks the gateway address is on the same subnet as the device in FreeRTOS+UDP. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2064 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_UDP_IP.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_UDP_IP.c index a490e481e..dd12aa748 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_UDP_IP.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_UDP_IP.c @@ -581,6 +581,10 @@ static portBASE_TYPE xReturn = pdFALSE; #else { *ipLOCAL_IP_ADDRESS_POINTER = xNetworkAddressing.ulDefaultIPAddress; + + /* Ensure the gateway is on the same subnet as the IP + address. */ + configASSERT( ( ( *ipLOCAL_IP_ADDRESS_POINTER ) & xNetworkAddressing.ulNetMask ) == ( xNetworkAddressing.ulGatewayAddress & xNetworkAddressing.ulNetMask ) ); } #endif /* ipconfigUSE_DHCP == 1 */