diff --git a/net/devif/ipv4_input.c b/net/devif/ipv4_input.c index ee1961f74f..aaf854290b 100644 --- a/net/devif/ipv4_input.c +++ b/net/devif/ipv4_input.c @@ -255,8 +255,15 @@ static int ipv4_in(FAR struct net_driver_s *dev) /* Forward broadcast packets */ ipv4_forward_broadcast(dev, ipv4); + + /* Process the incoming packet if not forwardable */ + + if (dev->d_len > 0) #endif - ret = udp_ipv4_input(dev); + { + ret = udp_ipv4_input(dev); + } + goto done; } else @@ -276,8 +283,15 @@ static int ipv4_in(FAR struct net_driver_s *dev) /* Forward broadcast packets */ ipv4_forward_broadcast(dev, ipv4); + + /* Process the incoming packet if not forwardable */ + + if (dev->d_len > 0) #endif - ret = udp_ipv4_input(dev); + { + ret = udp_ipv4_input(dev); + } + goto done; } else @@ -298,6 +312,13 @@ static int ipv4_in(FAR struct net_driver_s *dev) /* Forward multicast packets */ ipv4_forward_broadcast(dev, ipv4); + + /* Return success if the packet was forwarded. */ + + if (dev->d_len == 0) + { + goto done; + } #endif } else diff --git a/net/devif/ipv6_input.c b/net/devif/ipv6_input.c index 914ff43872..7b7dfa4067 100644 --- a/net/devif/ipv6_input.c +++ b/net/devif/ipv6_input.c @@ -395,6 +395,16 @@ static int ipv6_in(FAR struct net_driver_s *dev) } } } + +#ifdef CONFIG_NET_IPFORWARD + /* Return success if the packet was forwarded. */ + + if (dev->d_len == 0) + { + goto done; + } +#endif + #ifdef CONFIG_NET_ICMPv6 /* In other cases, the device must be assigned a non-zero IP address