zhhyu7 commented on code in PR #21517:
URL: https://github.com/apache/nuttx/pull/21517#discussion_r4505033066


##########
net/pkt/pkt_recvmsg.c:
##########
@@ -411,6 +439,19 @@ static inline int pkt_readdata(FAR struct pkt_recvfrom_s 
*pstate,
 
       tsfunc(pstate, iob);
 
+      /* Fill in the sender's address information if requested */
+
+      if (dev != NULL && pstate->pr_msg->msg_name != NULL)
+        {
+          pkt_recvfrom_sender(dev->d_ifindex, iob, pstate);
+        }
+
+      /* Remove the I/O buffer chain from the head of the read-ahead
+       * buffer queue.
+       */
+
+      iob_remove_queue(&conn->readahead);

Review Comment:
   Done.



##########
net/pkt/pkt_recvmsg.c:
##########
@@ -154,9 +156,33 @@ static void pkt_recvfrom_newdata(FAR struct net_driver_s 
*dev,
  *
  ****************************************************************************/
 
-static inline void pkt_recvfrom_sender(FAR struct net_driver_s *dev,
+static inline void pkt_recvfrom_sender(int ifindex, FAR struct iob_s *iob,
                                        FAR struct pkt_recvfrom_s *pstate)
 {
+  FAR struct sockaddr_ll *from;
+
+  if (pstate->pr_msg->msg_name != NULL)
+    {
+      from = (FAR struct sockaddr_ll *)pstate->pr_msg->msg_name;
+      from->sll_family = AF_PACKET;
+      from->sll_ifindex = ifindex;
+      from->sll_protocol = pstate->pr_type;
+
+      from->sll_halen = ETH_ALEN;
+
+      if (iob != NULL && iob->io_pktlen >= sizeof(struct eth_hdr_s))
+        {
+          FAR struct eth_hdr_s *ethhdr =
+              (FAR struct eth_hdr_s *)iob->io_data;

Review Comment:
   Done.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to