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
+1
View File
@@ -49,6 +49,7 @@
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/arp.h> #include <nuttx/net/arp.h>
#include "route/route.h"
#include "arp/arp.h" #include "arp/arp.h"
#ifdef CONFIG_NET_ARP #ifdef CONFIG_NET_ARP
+8
View File
@@ -45,6 +45,7 @@
#include <nuttx/net/ip.h> #include <nuttx/net/ip.h>
#include "devif/devif.h"
#include "route/route.h" #include "route/route.h"
#if defined(CONFIG_NET) && defined(CONFIG_NET_ROUTE) #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; struct route_match_s match;
int ret; int ret;
/* Do not route the special broadcast IP address */
if (net_ipaddr_cmp(target, g_alloneaddr))
{
return -ENOENT;
}
/* Set up the comparison structure */ /* Set up the comparison structure */
memset(&match, 0, sizeof(struct route_match_s)); memset(&match, 0, sizeof(struct route_match_s));