Opened 14 years ago

Last modified 14 years ago

#1058 closed defect

Structure pj_sockaddr_in6 has different size than native sockaddr_in6 on Linux — at Initial Version

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-1.6
Component: pjlib Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported:

Description

On Linux, sizeof(struct sockaddr_in6) is 28 bytes, while sizeof(pj_sockaddr_in6) is 32 bytes. This is because struct pj_in6_addr is aligned to 8 bytes:

typedef union pj_in6_addr
{
    /* This is the main entry */
    pj_uint8_t  s6_addr[16];   /**< 8-bit array */

    /* While these are used for proper alignment */
    pj_uint32_t	u6_addr32[4];

    /* Do not use this with Winsock2, as this will align pj_sockaddr_in6
     * to 64-bit boundary and Winsock2 doesn't like it!
     */
#if defined(PJ_HAS_INT64) && PJ_HAS_INT64!=0 && \
    (!defined(PJ_WIN32) || PJ_WIN32==0)
    pj_int64_t	u6_addr64[2];
#endif

} pj_in6_addr;

Change History (0)

Note: See TracTickets for help on using tickets.