diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-09-27 08:21:33 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-09-27 08:21:33 -0600 |
commit | c83c95eb6b801da6539fa7ffbca95104ea42605d (patch) | |
tree | 69b06dccc57e11026a08df6822b2848d7a00ea01 /nuttx/net/netdev_txnotify.c | |
parent | cda383a549d16f8b441a423578d69a9dfdf1e579 (diff) | |
download | nuttx-c83c95eb6b801da6539fa7ffbca95104ea42605d.tar.gz nuttx-c83c95eb6b801da6539fa7ffbca95104ea42605d.tar.bz2 nuttx-c83c95eb6b801da6539fa7ffbca95104ea42605d.zip |
Networking: If sending out of the subnet, device lookup by IP will fail. Fall back to ETH0 for now. From Max Holtzberg
Diffstat (limited to 'nuttx/net/netdev_txnotify.c')
-rw-r--r-- | nuttx/net/netdev_txnotify.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/nuttx/net/netdev_txnotify.c b/nuttx/net/netdev_txnotify.c index 4cb705ea8..41f97c401 100644 --- a/nuttx/net/netdev_txnotify.c +++ b/nuttx/net/netdev_txnotify.c @@ -95,6 +95,20 @@ void netdev_txnotify(const uip_ipaddr_t *raddr) /* Find the device driver that serves the subnet of the remote address */ struct uip_driver_s *dev = netdev_findbyaddr(raddr); + + /* The above lookup will fail if the packet is being sent out of our + * out subnet to a router. REVISIT: For now, we fall back and try "eth0". + */ + + if (dev == NULL) + { + /* If the destination address is not in our subnet, assume eth0 as the + * default device. + */ + + dev = netdev_findbyname("eth0"); + } + if (dev && dev->d_txavail) { /* Notify the device driver that new TX data is available. */ |