mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 04:52:02 +08:00
net/ipfrag: fix ip fragment assert when iob not enough
insufficient IOB during IP fragment is a normal scenario and should not crash directly. The assert needs to be removed and corresponding error handling needs to be added. Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
committed by
Alan C. Assis
parent
908596dde3
commit
c2a4899941
@@ -361,7 +361,7 @@ int32_t ipv4_fragout(FAR struct net_driver_s *dev, uint16_t mtu)
|
||||
uint32_t nfrags;
|
||||
uint16_t offset = 0;
|
||||
uint16_t hdrlen;
|
||||
FAR struct iob_s *frag;
|
||||
FAR struct iob_s *frag = NULL;
|
||||
FAR struct ipv4_hdr_s *ref = NULL;
|
||||
struct iob_queue_s fragq =
|
||||
{
|
||||
@@ -379,9 +379,15 @@ int32_t ipv4_fragout(FAR struct net_driver_s *dev, uint16_t mtu)
|
||||
*/
|
||||
|
||||
nfrags = ip_fragout_slice(dev->d_iob, PF_INET, mtu, hdrlen, &fragq);
|
||||
ASSERT(nfrags > 1);
|
||||
netdev_iob_clear(dev);
|
||||
|
||||
/* No I/O Buffer is the only cause of failure */
|
||||
|
||||
if (nfrags == 0)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Fill the L3 header into the reserved space */
|
||||
|
||||
for (iter = 0; iter < nfrags; iter++)
|
||||
|
||||
@@ -570,7 +570,7 @@ int32_t ipv6_fragout(FAR struct net_driver_s *dev, uint16_t mtu)
|
||||
uint32_t nfrags;
|
||||
uint16_t hdroff;
|
||||
uint16_t hdrtype;
|
||||
FAR struct iob_s *frag;
|
||||
FAR struct iob_s *frag = NULL;
|
||||
FAR struct ipv6_hdr_s *ref = NULL;
|
||||
FAR struct ipv6_fragment_extension_s *fraghdr;
|
||||
struct iob_queue_s fragq =
|
||||
@@ -590,9 +590,15 @@ int32_t ipv6_fragout(FAR struct net_driver_s *dev, uint16_t mtu)
|
||||
*/
|
||||
|
||||
nfrags = ip_fragout_slice(dev->d_iob, PF_INET6, mtu, unfraglen, &fragq);
|
||||
ASSERT(nfrags > 1);
|
||||
netdev_iob_clear(dev);
|
||||
|
||||
/* No I/O Buffer is the only cause of failure */
|
||||
|
||||
if (nfrags == 0)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ipid = ++g_ipv6id;
|
||||
|
||||
/* Fill the L3 header into the reserved space */
|
||||
|
||||
Reference in New Issue
Block a user