diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-10-05 13:16:18 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-10-05 13:16:18 -0600 |
commit | e2f7a1a610753465c2f9f47054ce9365cd131289 (patch) | |
tree | f5f316db87c490f053f74d3232adec3736f74276 /nuttx/net/net_router.c | |
parent | 572252ef94d174774b2455c45657c8255bdf01f0 (diff) | |
download | nuttx-e2f7a1a610753465c2f9f47054ce9365cd131289.tar.gz nuttx-e2f7a1a610753465c2f9f47054ce9365cd131289.tar.bz2 nuttx-e2f7a1a610753465c2f9f47054ce9365cd131289.zip |
netdev_findbyaddr() will not use a routing table if one is available. It will also make a better decision in the case there there is no routing table but only a single network interface.
Diffstat (limited to 'nuttx/net/net_router.c')
-rw-r--r-- | nuttx/net/net_router.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/nuttx/net/net_router.c b/nuttx/net/net_router.c index 3317f4006..71344f842 100644 --- a/nuttx/net/net_router.c +++ b/nuttx/net/net_router.c @@ -109,6 +109,12 @@ static int net_match(FAR struct net_route_s *route, FAR void *arg) * router on a local network that can forward to the external network. * * Parameters: + * 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: * OK on success; Negated errno on failure. @@ -116,9 +122,9 @@ static int net_match(FAR struct net_route_s *route, FAR void *arg) ****************************************************************************/ #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) +#else +int net_router(uip_ipaddr_t target, uip_ipaddr_t *router) #endif { struct route_match_s match; @@ -133,9 +139,9 @@ int net_router(uip_ipaddr_t target, uip_ipaddr_t router) ret = net_foreachroute(net_match, &match) ? OK : -ENOENT; #ifdef CONFIG_NET_IPv6 - uip_ipaddr_copy(*router, match.target); -#else uip_ipaddr_copy(router, match.target); +#else + uip_ipaddr_copy(*router, match.target); #endif return ret; |