casaroli commented on code in PR #13027:
URL: https://github.com/apache/nuttx/pull/13027#discussion_r4434892695


##########
include/nuttx/net/ioctl.h:
##########
@@ -126,6 +126,8 @@
 /* Network socket control ***************************************************/
 
 #define SIOCDENYINETSOCK _SIOC(0x003C) /* Deny network socket. */
+#define SIOCGETCONTEXT   _SIOC(0x003F) /* Get socket context */

Review Comment:
   `_SIOC(0x003F)` and `_SIOC(0x0040)` are used on master now. Please rebase 
and  take free numbers.



##########
include/nuttx/net/net.h:
##########
@@ -253,6 +253,26 @@ struct socket
   FAR const struct sock_intf_s *s_sockif;
 };
 
+struct socket_ctx_data_s
+{
+  uint8_t s_domain;  /* IP domain */
+  uint8_t s_type;    /* Protocol type */
+  uint8_t s_proto;   /* Socket Protocol */
+  uint8_t s_priv[0]; /* Private socket context */
+};
+
+/* NETDEV ioctl command:
+ *
+ * Command:      SIOCGETCONTEXT or SIOCSETCONTEXT
+ * Description:  Get or Set socket context.
+ */
+
+struct socket_context_s

Review Comment:
   `ctx` is a pointer into the caller's memory. `usrsock` copies only 
`sizeof(struct socket_context_s)` to the daemon, so in a protected or kernel 
build the daemon gets an address it cannot use.
   
   Put the context data in the ioctl argument itself (a size and a flexible 
array member), as xiao asked.



-- 
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