summaryrefslogtreecommitdiff
path: root/nuttx/net/net_route.h
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-10-05 19:08:57 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-10-05 19:08:57 -0600
commit2b7e0d90d9f174acc184a77b93a972742dec686e (patch)
tree4a4d95140ecc5cef0c8dfd0123253e259d0a34fb /nuttx/net/net_route.h
parent1d8f6485828b1b2f924dddccd74bc225fb531d1a (diff)
downloadnuttx-2b7e0d90d9f174acc184a77b93a972742dec686e.tar.gz
nuttx-2b7e0d90d9f174acc184a77b93a972742dec686e.tar.bz2
nuttx-2b7e0d90d9f174acc184a77b93a972742dec686e.zip
Another case where we should use the routing table: There may be multiple routers on the same network. In that case, we have to search for the routing table for the router that forwards to the destination address. We do this when we determine the MAC address we want in the ARP logic
Diffstat (limited to 'nuttx/net/net_route.h')
-rw-r--r--nuttx/net/net_route.h36
1 files changed, 35 insertions, 1 deletions
diff --git a/nuttx/net/net_route.h b/nuttx/net/net_route.h
index fec27698e..08039fe01 100644
--- a/nuttx/net/net_route.h
+++ b/nuttx/net/net_route.h
@@ -202,7 +202,41 @@ int net_delroute(uip_ipaddr_t target, uip_ipaddr_t netmask);
#ifdef CONFIG_NET_IPv6
int net_router(uip_ipaddr_t target, uip_ipaddr_t router);
#else
-int net_router(uip_ipaddr_t target, uip_ipaddr_t *router);
+int net_router(uip_ipaddr_t target, FAR uip_ipaddr_t *router);
+#endif
+
+/****************************************************************************
+ * Function: netdev_router
+ *
+ * Description:
+ * Given an IP address on a external network, return the address of the
+ * router on a local network that can forward to the external network.
+ * This is similar to net_router(). However, the set of routers is
+ * constrained to those accessible by the specific device
+ *
+ * Parameters:
+ * dev - We are committed to using this device.
+ * target - An IP address on a remote network to use in the lookup.
+ * router - The address of router on a local network that can forward our
+ * packets to the target.
+ *
+ * NOTE: For IPv6, router will be an array, for IPv4 it will be a scalar
+ * value. Hence, the change in the function signature.
+ *
+ * Returned Value:
+ * None, a router address is always returned (which may just be, perhaps,
+ * device's default router address)
+ *
+ ****************************************************************************/
+
+struct uip_driver_s;
+
+#ifdef CONFIG_NET_IPv6
+void netdev_router(FAR struct uip_driver_s *dev, uip_ipaddr_t target,
+ uip_ipaddr_t router);
+#else
+void netdev_router(FAR struct uip_driver_s *dev, uip_ipaddr_t target,
+ FAR uip_ipaddr_t *router);
#endif
/****************************************************************************