diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-11-23 08:36:34 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-11-23 08:36:34 -0600 |
commit | d8cd3cb0e4f087bdb93b17ac3226db6995932f6c (patch) | |
tree | b4704463350b74c04b1ef991d638f0a86c0e6fae | |
parent | b9ab52e9e27c22325b383537c4692b809ca81ce0 (diff) | |
download | nuttx-d8cd3cb0e4f087bdb93b17ac3226db6995932f6c.tar.gz nuttx-d8cd3cb0e4f087bdb93b17ac3226db6995932f6c.tar.bz2 nuttx-d8cd3cb0e4f087bdb93b17ac3226db6995932f6c.zip |
Network routing: Refuse to perform routing table lookups for the Broadcast IP address. From Brennan Ashton
-rw-r--r-- | nuttx/net/arp/arp_out.c | 1 | ||||
-rw-r--r-- | nuttx/net/route/net_router.c | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/nuttx/net/arp/arp_out.c b/nuttx/net/arp/arp_out.c index 7e77bfc4a..6b5b038c7 100644 --- a/nuttx/net/arp/arp_out.c +++ b/nuttx/net/arp/arp_out.c @@ -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 diff --git a/nuttx/net/route/net_router.c b/nuttx/net/route/net_router.c index 86c37b457..1755b0209 100644 --- a/nuttx/net/route/net_router.c +++ b/nuttx/net/route/net_router.c @@ -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)); |