Network routing: Refuse to perform routing table lookups for the Broadcast IP address. From Brennan Ashton

This commit is contained in:
Gregory Nutt 2014-11-23 08:36:34 -06:00
parent d2a323ca19
commit 43d036f587
2 changed files with 9 additions and 0 deletions

View File

@ -49,6 +49,7 @@
#include <nuttx/net/netdev.h>
#include <nuttx/net/arp.h>
#include "route/route.h"
#include "arp/arp.h"
#ifdef CONFIG_NET_ARP

View File

@ -45,6 +45,7 @@
#include <nuttx/net/ip.h>
#include "devif/devif.h"
#include "route/route.h"
#if defined(CONFIG_NET) && defined(CONFIG_NET_ROUTE)
@ -131,6 +132,13 @@ int net_router(net_ipaddr_t target, FAR net_ipaddr_t *router)
struct route_match_s match;
int ret;
/* Do not route the special broadcast IP address */
if (net_ipaddr_cmp(target, g_alloneaddr))
{
return -ENOENT;
}
/* Set up the comparison structure */
memset(&match, 0, sizeof(struct route_match_s));