diff --git a/arch/sim/src/sim/up_usrsock.c b/arch/sim/src/sim/up_usrsock.c index 0d4121bc6e..6381d77e2b 100644 --- a/arch/sim/src/sim/up_usrsock.c +++ b/arch/sim/src/sim/up_usrsock.c @@ -138,11 +138,11 @@ static int usrsock_send_event(FAR struct usrsock_s *usrsock, { struct usrsock_message_socket_event_s event; - event.head.msgid = USRSOCK_MESSAGE_SOCKET_EVENT; - event.head.flags = USRSOCK_MESSAGE_FLAG_EVENT; + event.head.msgid = USRSOCK_MESSAGE_SOCKET_EVENT; + event.head.flags = USRSOCK_MESSAGE_FLAG_EVENT; + event.head.events = events; event.usockid = usockid; - event.events = events; return usrsock_send(usrsock, &event, sizeof(event)); } diff --git a/include/nuttx/net/usrsock.h b/include/nuttx/net/usrsock.h index 540c2dcc7d..49f295dd50 100644 --- a/include/nuttx/net/usrsock.h +++ b/include/nuttx/net/usrsock.h @@ -220,6 +220,7 @@ begin_packed_struct struct usrsock_message_common_s { int8_t msgid; int8_t flags; + uint16_t events; } end_packed_struct; /* Request acknowledgment/completion message */ @@ -228,7 +229,6 @@ begin_packed_struct struct usrsock_message_req_ack_s { struct usrsock_message_common_s head; - int16_t reserved; int32_t result; uint64_t xid; } end_packed_struct; @@ -253,7 +253,6 @@ begin_packed_struct struct usrsock_message_socket_event_s struct usrsock_message_common_s head; int16_t usockid; - uint16_t events; } end_packed_struct; #endif /* __INCLUDE_NUTTX_NET_USRSOCK_H */ diff --git a/net/usrsock/usrsock_dev.c b/net/usrsock/usrsock_dev.c index 9d92cb6bd9..723ed6459b 100644 --- a/net/usrsock/usrsock_dev.c +++ b/net/usrsock/usrsock_dev.c @@ -479,13 +479,13 @@ static ssize_t usrsockdev_handle_event(FAR struct usrsockdev_s *dev, #ifdef CONFIG_DEV_RANDOM /* Add randomness. */ - add_sw_randomness((hdr->events << 16) - hdr->usockid); + add_sw_randomness((hdr->head.events << 16) - hdr->usockid); #endif /* Handle event. */ ret = usrsock_event(conn, - hdr->events & ~USRSOCK_EVENT_INTERNAL_MASK); + hdr->head.events & ~USRSOCK_EVENT_INTERNAL_MASK); if (ret < 0) { return ret;