vuhuyhop197 opened a new issue, #7082: URL: https://github.com/apache/incubator-nuttx/issues/7082
We are implementing a USRSOCK for our WIFI chip. The issue is the function psock_setsockopt doesn't call usrsock_setsockopt. Because it prioritizes checking the protocol level. I think the code flow should be: ``` int psock_setsockopt(FAR struct socket *psock, int level, int option, FAR const void *value, socklen_t value_len) { int ret; /* Verify that the sockfd corresponds to valid, allocated socket */ if (psock == NULL || psock->s_conn == NULL) { return -EBADF; } #ifdef CONFIG_NET_USRSOCK if (psock->s_type == SOCK_USRSOCK_TYPE) { /* Handle setting of the socket option with usrsock */ ret = usrsock_setsockopt(psock->s_conn, level, option, value, value_len); } else #endif /* CONFIG_NET_USRSOCK */ { /* Handle setting of the socket option according to the level at which * option should be applied. */ switch (level) { case SOL_SOCKET: /* Socket-level options (see include/sys/socket.h) */ ret = psock_socketlevel_option(psock, option, value, value_len); break; #ifdef CONFIG_NET_TCPPROTO_OPTIONS case IPPROTO_TCP:/* TCP protocol socket options (see include/netinet/tcp.h) */ ret = tcp_setsockopt(psock, option, value, value_len); break; #endif #ifdef CONFIG_NET_UDPPROTO_OPTIONS case IPPROTO_UDP:/* UDP protocol socket options (see include/netinet/udp.h) */ ret = udp_setsockopt(psock, option, value, value_len); break; #endif #ifdef CONFIG_NET_IPv4 case IPPROTO_IP:/* TCP protocol socket options (see include/netinet/in.h) */ ret = ipv4_setsockopt(psock, option, value, value_len); break; #endif #ifdef CONFIG_NET_IPv6 case IPPROTO_IPV6:/* TCP protocol socket options (see include/netinet/in.h) */ ret = ipv6_setsockopt(psock, option, value, value_len); break; #endif #ifdef CONFIG_NET_CANPROTO_OPTIONS case SOL_CAN_RAW: /* CAN protocol socket options (see include/netpacket/can.h) */ ret = can_setsockopt(psock, option, value, value_len); break; #endif default: /* The provided level is invalid */ ret = -ENOPROTOOPT; break; } } return ret; } ``` -- 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.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org