IP forwarding: In check it the Ethernet MAC address is in the ARP/Neighbor table, add an additional check to skip in the case of CONFIG_NET_MULTILINK and the devices is not an Ethernet device.

This commit is contained in:
Gregory Nutt 2017-07-05 12:40:26 -06:00
parent 10f5f8f192
commit edf16c5805
5 changed files with 64 additions and 5 deletions

View File

@ -44,6 +44,7 @@
#include <net/if.h>
#include <nuttx/mm/iob.h>
#include <nuttx/net/net.h>
#include <nuttx/net/netdev.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netstats.h>
@ -51,6 +52,8 @@
#include "devif/ip_forward.h"
#include "devif/devif.h"
#include "netdev/netdev.h"
#include "arp/arp.h"
#include "neighbor/neighbor.h"
#include "icmpv6/icmpv6.h"
#if defined(CONFIG_NET_IPFORWARD) && defined(CONFIG_NET_ICMPv6) && \
@ -82,7 +85,8 @@
* fwd - The forwarding state structure
*
* Returned Value:
* None
* true - The Ethernet MAC address is in the ARP or Neighbor table (OR
* the network device is not Ethernet).
*
* Assumptions:
* The network is locked.
@ -92,6 +96,15 @@
#ifdef CONFIG_NET_ETHERNET
static inline bool icmpv6_forward_addrchck(FAR struct forward_s *fwd)
{
/* REVISIT: Could the MAC address not also be in a routing table? */
#ifdef CONFIG_NET_MULTILINK
if (fwd->f_dev->d_lltype != NET_LL_ETHERNET)
{
return true;
}
#endif
#ifdef CONFIG_NET_IPv4
#ifdef CONFIG_NET_IPv6
if (conn->domain == PF_INET)

View File

@ -45,6 +45,7 @@
#include <net/if.h>
#include <nuttx/mm/iob.h>
#include <nuttx/net/net.h>
#include <nuttx/net/netdev.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netstats.h>
@ -52,6 +53,8 @@
#include "devif/ip_forward.h"
#include "devif/devif.h"
#include "netdev/netdev.h"
#include "arp/arp.h"
#include "neighbor/neighbor.h"
#include "tcp/tcp.h"
#if defined(CONFIG_NET_IPFORWARD) && defined(CONFIG_NET_TCP) && \
@ -124,7 +127,8 @@ static inline void forward_ipselect(FAR struct forward_s *fwd)
* fwd - The forwarding state structure
*
* Returned Value:
* None
* true - The Ethernet MAC address is in the ARP or Neighbor table (OR
* the network device is not Ethernet).
*
* Assumptions:
* The network is locked.
@ -136,6 +140,15 @@ static inline bool tcp_forward_addrchck(FAR struct forward_s *fwd)
{
FAR struct tcp_conn_s *conn = &fwd->f_conn.tcp;
/* REVISIT: Could the MAC address not also be in a routing table? */
#ifdef CONFIG_NET_MULTILINK
if (fwd->f_dev->d_lltype != NET_LL_ETHERNET)
{
return true;
}
#endif
#ifdef CONFIG_NET_IPv4
#ifdef CONFIG_NET_IPv6
if (conn->domain == PF_INET)

View File

@ -270,7 +270,8 @@ static inline void send_ipselect(FAR struct net_driver_s *dev,
* conn - The TCP connection structure
*
* Returned Value:
* None
* true - The Ethernet MAC address is in the ARP or Neighbor table (OR
* the network device is not Ethernet).
*
* Assumptions:
* Running at the interrupt level
@ -280,6 +281,15 @@ static inline void send_ipselect(FAR struct net_driver_s *dev,
#ifdef CONFIG_NET_ETHERNET
static inline bool psock_send_addrchck(FAR struct tcp_conn_s *conn)
{
/* REVISIT: Could the MAC address not also be in a routing table? */
#ifdef CONFIG_NET_MULTILINK
if (conn->dev->d_lltype != NET_LL_ETHERNET)
{
return true;
}
#endif
#ifdef CONFIG_NET_IPv4
#ifdef CONFIG_NET_IPv6
if (conn->domain == PF_INET)

View File

@ -221,7 +221,8 @@ static inline void tcpsend_ipselect(FAR struct net_driver_s *dev,
* conn - The TCP connection structure
*
* Returned Value:
* None
* true - The Ethernet MAC address is in the ARP or Neighbor table (OR
* the network device is not Ethernet).
*
* Assumptions:
* The network is locked.
@ -231,6 +232,15 @@ static inline void tcpsend_ipselect(FAR struct net_driver_s *dev,
#ifdef CONFIG_NET_ETHERNET
static inline bool psock_send_addrchck(FAR struct tcp_conn_s *conn)
{
/* REVISIT: Could the MAC address not also be in a routing table? */
#ifdef CONFIG_NET_MULTILINK
if (conn->dev->d_lltype != NET_LL_ETHERNET)
{
return true;
}
#endif
#ifdef CONFIG_NET_IPv4
#ifdef CONFIG_NET_IPv6
if (conn->domain == PF_INET)

View File

@ -44,6 +44,7 @@
#include <net/if.h>
#include <nuttx/mm/iob.h>
#include <nuttx/net/net.h>
#include <nuttx/net/netdev.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netstats.h>
@ -51,6 +52,8 @@
#include "devif/ip_forward.h"
#include "devif/devif.h"
#include "netdev/netdev.h"
#include "arp/arp.h"
#include "neighbor/neighbor.h"
#include "udp/udp.h"
#if defined(CONFIG_NET_IPFORWARD) && defined(CONFIG_NET_UDP) && \
@ -118,7 +121,8 @@ static inline void forward_ipselect(FAR struct forward_s *fwd)
* fwd - The forwarding state structure
*
* Returned Value:
* None
* true - The Ethernet MAC address is in the ARP or Neighbor table (OR
* the network device is not Ethernet).
*
* Assumptions:
* The network is locked.
@ -128,6 +132,15 @@ static inline void forward_ipselect(FAR struct forward_s *fwd)
#ifdef CONFIG_NET_ETHERNET
static inline bool udp_forward_addrchk(FAR struct forward_s *fwd)
{
/* REVISIT: Could the MAC address not also be in a routing table? */
#ifdef CONFIG_NET_MULTILINK
if (fwd->f_dev->d_lltype != NET_LL_ETHERNET)
{
return true;
}
#endif
#ifdef CONFIG_NET_IPv4
#ifdef CONFIG_NET_IPv6
if (conn->domain == PF_INET)