From 43d036f5873e4c84e49ddc51353b885593178d93 Mon Sep 17 00:00:00 2001
From: Gregory Nutt <gnutt@nuttx.org>
Date: Sun, 23 Nov 2014 08:36:34 -0600
Subject: [PATCH] Network routing:  Refuse to perform routing table lookups for
 the Broadcast IP address.  From Brennan Ashton

---
 net/arp/arp_out.c      | 1 +
 net/route/net_router.c | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/net/arp/arp_out.c b/net/arp/arp_out.c
index 7e77bfc4ae..6b5b038c78 100644
--- a/net/arp/arp_out.c
+++ b/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/net/route/net_router.c b/net/route/net_router.c
index 86c37b457e..1755b0209a 100644
--- a/net/route/net_router.c
+++ b/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));
-- 
GitLab