You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/09/22 07:47:51 UTC

[GitHub] [incubator-nuttx] anchao opened a new pull request #4593: net/local: add socket message control support

anchao opened a new pull request #4593:
URL: https://github.com/apache/incubator-nuttx/pull/4593


   ## Summary
   
   net/local: add socket message control support 
   net/local: bypass the message field to support SCM further
   net/local: add local_peerconn helper
   net/local: split the waiter node from lc_node
   net/local: replace the listener list to global
   
   Reference:
   https://www.freebsd.org/cgi/man.cgi?query=CMSG_DATA&apropos=0&sektion=3&manpath=FreeBSD+11-current&format=html
   https://man7.org/linux/man-pages/man3/cmsg.3.html
   
   ## Impact
   
   N/A new feature
   
   ## Testing
   
   test send/recv message with message control data


-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #4593: net/local: add socket message control support

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #4593:
URL: https://github.com/apache/incubator-nuttx/pull/4593#discussion_r713841508



##########
File path: net/local/local_sendpacket.c
##########
@@ -102,6 +103,114 @@ static int local_fifo_write(FAR struct file *filep, FAR const uint8_t *buf,
   return nwritten > 0 ? nwritten : ret;
 }
 
+/****************************************************************************
+ * Name: local_sendctl
+ *
+ * Description:
+ *   Handle the socket message conntrol field
+ *
+ * Input Parameters:
+ *   conn     Local connection instance
+ *   msg      Message to send
+ *
+ * Returned Value:
+ *  On any failure, a negated errno value is returned
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_NET_LOCAL_SCM
+static int local_sendctl(FAR struct local_conn_s *conn,

Review comment:
       call local_sendctl in local_sendmsg, so we don't need modify local_sendctl prototype

##########
File path: net/local/local_recvmsg.c
##########
@@ -375,30 +511,48 @@ psock_dgram_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg,
 ssize_t local_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg,
                       int flags)
 {
+  ssize_t readlen;
+
   DEBUGASSERT(psock && psock->s_conn && msg);
 
   /* Check for a stream socket */
 
 #ifdef CONFIG_NET_LOCAL_STREAM
   if (psock->s_type == SOCK_STREAM)
     {
-      return psock_stream_recvmsg(psock, msg, flags);
+      readlen = psock_stream_recvmsg(psock, msg, flags);
     }
   else
 #endif
 
 #ifdef CONFIG_NET_LOCAL_DGRAM
   if (psock->s_type == SOCK_DGRAM)
     {
-      return psock_dgram_recvmsg(psock, msg, flags);
+      readlen = psock_dgram_recvmsg(psock, msg, flags);
     }
   else
 #endif
     {
       DEBUGPANIC();
       nerr("ERROR: Unrecognized socket type: %" PRIu8 "\n", psock->s_type);
-      return -EINVAL;
+      readlen = -EINVAL;
     }
+
+#ifdef CONFIG_NET_LOCAL_SCM
+  /* Receive the control message */
+
+  if (readlen >= 0 && msg->msg_control &&
+      msg->msg_controllen > sizeof(struct cmsghdr))
+    {
+      int ret = local_recvctl(psock->s_conn, msg);
+      if (ret < 0)

Review comment:
       since local_recvctl is called inside local_recvmsg, we don't need modify psock_dgram_recvmsg/psock_stream_recvmsg naming and prototype




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #4593: net/local: add socket message control support

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #4593:
URL: https://github.com/apache/incubator-nuttx/pull/4593


   


-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #4593: net/local: add socket message control support

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #4593:
URL: https://github.com/apache/incubator-nuttx/pull/4593#discussion_r713824983



##########
File path: net/local/local_conn.c
##########
@@ -35,6 +35,14 @@
 
 #include "local/local.h"
 
+/****************************************************************************
+ * Public Data

Review comment:
       Public -> Private




-- 
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-unsubscribe@nuttx.apache.org

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