From d8cd3cb0e4f087bdb93b17ac3226db6995932f6c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 23 Nov 2014 08:36:34 -0600 Subject: Network routing: Refuse to perform routing table lookups for the Broadcast IP address. From Brennan Ashton --- nuttx/net/arp/arp_out.c | 1 + nuttx/net/route/net_router.c | 8 ++++++++ 2 files changed, 9 insertions(+) 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 #include +#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 +#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)); -- cgit v1.2.3