diff --git a/net/devif/devif_poll.c b/net/devif/devif_poll.c index 4b4d42a4a1..28baba33d1 100644 --- a/net/devif/devif_poll.c +++ b/net/devif/devif_poll.c @@ -925,6 +925,7 @@ int devif_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback) if (netdev_iob_prepare(dev, false, 0) != OK) { + nwarn("WARNING: IOB Prepare failed for dev %s!\n", dev->d_ifname); bstop = true; break; } diff --git a/net/ipforward/Kconfig b/net/ipforward/Kconfig index cc18dee4ce..3be48eac75 100644 --- a/net/ipforward/Kconfig +++ b/net/ipforward/Kconfig @@ -36,3 +36,7 @@ config NET_IPFORWARD_NSTRUCT packets that may be waiting to be forwarded from one network device to another. CONFIG_IOB_NBUFFERS also limits the forward because the payload of the packet (up to the MSS) is retain in IOBs. + + WARNING: DO NOT set this setting to a value greater than or equal to + CONFIG_IOB_NBUFFERS, otherwise it may consume all the IOB and let + netdev fail to work. diff --git a/net/ipforward/ipforward.h b/net/ipforward/ipforward.h index 30b8a9d973..29087c03aa 100644 --- a/net/ipforward/ipforward.h +++ b/net/ipforward/ipforward.h @@ -27,6 +27,7 @@ #include +#include #include #undef HAVE_FWDALLOC @@ -42,6 +43,9 @@ # define CONFIG_NET_IPFORWARD_NSTRUCT 4 #endif +static_assert(CONFIG_IOB_NBUFFERS > CONFIG_NET_IPFORWARD_NSTRUCT, + "IP forward may consume all the IOB and break netdev logic"); + /* Allocate a new IP forwarding data callback */ #define ipfwd_callback_alloc(dev) devif_callback_alloc(dev, \