anchao commented on code in PR #7616:
URL: https://github.com/apache/nuttx/pull/7616#discussion_r1037779107


##########
net/icmpv6/icmpv6_reply.c:
##########
@@ -108,6 +108,64 @@ void icmpv6_reply(FAR struct net_driver_s *dev, int type, 
int code, int data)
   if (datalen > ICMPv6_MINMTULEN - ipicmplen)
     {
       datalen = ICMPv6_MINMTULEN - ipicmplen;
+      iob_trimtail(dev->d_iob, dev->d_iob->io_pktlen - datalen);
+    }
+
+  /* Save the original datagram */
+
+  if (CONFIG_IOB_BUFSIZE >= datalen + ipicmplen +
+                            CONFIG_NET_LL_GUARDSIZE)
+    {
+      /* Reuse current iob */
+
+      memmove((FAR char *)ipv6 + ipicmplen, ipv6, datalen);
+
+      /* Skip icmp header from iob */
+
+      iob_update_pktlen(dev->d_iob, datalen + ipicmplen);
+    }
+  else
+    {
+      FAR struct iob_s *iob;
+
+      /* Save the original datagram to iob chain */
+
+      iob = dev->d_iob;
+      dev->d_iob = NULL;
+
+      /* Re-prepare device buffer */
+
+      if (netdev_iob_prepare(dev, false, 0) != OK)
+        {
+          dev->d_len = 0;
+          dev->d_iob = iob;
+          netdev_iob_release(dev);
+          return;
+        }
+
+      /* Copy ipv4 header to device buffer */
+
+      if (iob_trycopyin(dev->d_iob, (FAR void *)ipv6,

Review Comment:
   parameter prototype conflict, cast is needed
   
   ```
   int iob_trycopyin(FAR struct iob_s *iob, FAR const uint8_t *src,
   unsigned int len, unsigned int offset, bool throttled)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to