nuttxs commented on code in PR #13156:
URL: https://github.com/apache/nuttx/pull/13156#discussion_r1770738300
##########
include/sys/socket.h:
##########
@@ -314,10 +319,22 @@
struct sockaddr_storage
{
- sa_family_t ss_family; /* Address family */
- char ss_data[SS_MAXSIZE - sizeof(sa_family_t)];
-}
-aligned_data(SS_ALIGNSIZE); /* Force desired alignment */
+ sa_family_t ss_family; /* Address family */
+
+ /* Following fields are implementation-defined */
+
+ struct
+ {
+ char ss_pad1[SS_PAD1SIZE]; /* 6-byte pad; this is to make
implementation-defined
+ * pad up to alignment field that follows
explicit in
+ * the data structure */
+ int64_t ss_align; /* Field to force desired structure storage
alignment */
Review Comment:
The use of an **int64_t** type for the ss_align member in the
sockaddr_storage structure can result in alignment problems that may prevent
functions such as **getifaddrs(&ifap)** from correctly retrieving IP addresses.
Here, should **int32_t ss_align**; be used or should the **structure
sockaddr_storage** for the generic socket address be modified with
**__attribute__((packed))**?

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