From 7e05145672de1ccab2316da5f66152bc74f76343 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Mon, 14 Oct 2013 14:35:53 +0000 Subject: [PATCH] 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 --- FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_UDP_IP.c | 4 ++++ 1 file changed, 4 insertions(+) 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 */ -- 2.39.5