Merged in antmerlino/nuttx/ipforward (pull request #981)
net/ipforward: Check if interface is up early on when forwarding to avoid extra work. As noticed in a previous wireless commit, when forwarding is enabled and a packet comes in, the packet is attempted to be sent on each other netdev without regard for whether it is in the UP state. Of course this is eventually caught, but it can be caught earlier to avoid unnecessary work, especially in the 6LoWPAN case where a useless packet conversion will occur. Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
parent
1e3a60155e
commit
7c06438315
@ -348,6 +348,15 @@ static int ipv6_dev_forward(FAR struct net_driver_s *dev,
|
||||
#endif
|
||||
int ret;
|
||||
|
||||
/* If the interface isn't "up", we can't forward. */
|
||||
|
||||
if ((fwddev->d_flags & IFF_UP) == 0)
|
||||
{
|
||||
nwarn("WARNING: device is DOWN\n");
|
||||
ret = -EHOSTUNREACH;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
/* Perform any necessary packet conversions. */
|
||||
|
||||
ret = ipv6_packet_conversion(dev, fwddev, ipv6);
|
||||
|
Loading…
Reference in New Issue
Block a user