mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 07:12:54 +08:00
IP forwarding: Major rearchitecting of the outgoing portion of the IP forwarding logic necessary into to properly received device-related forwarding events.
This commit is contained in:
@@ -171,12 +171,14 @@
|
||||
#define UDP_NEWDATA TCP_NEWDATA
|
||||
#define PKT_NEWDATA TCP_NEWDATA
|
||||
#define WPAN_NEWDATA TCP_NEWDATA
|
||||
#define IPFWD_NEWDATA TCP_NEWDATA
|
||||
#define TCP_SNDACK (1 << 2)
|
||||
#define TCP_REXMIT (1 << 3)
|
||||
#define TCP_POLL (1 << 4)
|
||||
#define UDP_POLL TCP_POLL
|
||||
#define PKT_POLL TCP_POLL
|
||||
#define WPAN_POLL TCP_POLL
|
||||
#define IPFWD_POLL TCP_POLL
|
||||
#define TCP_BACKLOG (1 << 5)
|
||||
#define TCP_CLOSE (1 << 6)
|
||||
#define TCP_ABORT (1 << 7)
|
||||
|
||||
@@ -87,7 +87,8 @@ void devif_forward(FAR struct forward_s *fwd)
|
||||
DEBUGASSERT(ret == fwd->f_iob->io_pktlen);
|
||||
offset += fwd->f_iob->io_pktlen;
|
||||
|
||||
fwd->f_dev->d_sndlen = offset;
|
||||
fwd->f_dev->d_sndlen = 0;
|
||||
fwd->f_dev->d_len = offset;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NET_IPFORWARD && CONFIG_NETDEV_MULTINIC */
|
||||
|
||||
@@ -251,6 +251,28 @@ static inline int devif_poll_icmpv6(FAR struct net_driver_s *dev,
|
||||
}
|
||||
#endif /* CONFIG_NET_ICMPv6_PING || CONFIG_NET_ICMPv6_NEIGHBOR*/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: devif_poll_forward
|
||||
*
|
||||
* Description:
|
||||
* Poll the device event to see if any task is waiting to forward a packet.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_NET_IPFORWARD) || defined(CONFIG_NETDEV_MULTINIC)
|
||||
static inline int devif_poll_forward(FAR struct net_driver_s *dev,
|
||||
devif_poll_callback_t callback)
|
||||
{
|
||||
/* Perform the ICMPv6 poll */
|
||||
|
||||
devif_dev_event(dev, NULL, IPFWD_POLL);
|
||||
|
||||
/* Call back into the driver */
|
||||
|
||||
return callback(dev);
|
||||
}
|
||||
#endif /* CONFIG_NET_ICMPv6_PING || CONFIG_NET_ICMPv6_NEIGHBOR*/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: devif_poll_igmp
|
||||
*
|
||||
@@ -506,6 +528,15 @@ int devif_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback)
|
||||
bstop = devif_poll_icmpv6(dev, callback);
|
||||
}
|
||||
|
||||
if (!bstop)
|
||||
#endif
|
||||
#if defined(CONFIG_NET_IPFORWARD) || defined(CONFIG_NETDEV_MULTINIC)
|
||||
{
|
||||
/* Traverse all of the tasks waiting to forward a packet to this device. */
|
||||
|
||||
bstop = devif_poll_forward(dev, callback);
|
||||
}
|
||||
|
||||
if (!bstop)
|
||||
#endif
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user