mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-05-16 13:16:49 +08:00
IPv6 sockaddr clean ups
This commit address two issues with sockaddr struct implementations for
IPv6:
1) struct sockaddr_in6 should have 32-bit unsigned field sin6_scope_id
as specified in Section 3.4 of RFC 3493 (Basic Socket Interface
Extensions for IPv6)
2) struct sockaddr is not extended in IPv6 to contain space for
struct sockaddr_in6. Applications should be using struct
sockaddr_storage when needing generic storage. This removes the
extra bytes added when LWIP_IPV6 is defined
This commit is contained in:
committed by
goldsimon
parent
a6bd0944db
commit
d850efdd08
@@ -71,22 +71,19 @@ struct sockaddr_in {
|
||||
|
||||
#if LWIP_IPV6
|
||||
struct sockaddr_in6 {
|
||||
u8_t sin6_len; /* length of this structure */
|
||||
sa_family_t sin6_family; /* AF_INET6 */
|
||||
in_port_t sin6_port; /* Transport layer port # */
|
||||
u32_t sin6_flowinfo; /* IPv6 flow information */
|
||||
struct in6_addr sin6_addr; /* IPv6 address */
|
||||
u8_t sin6_len; /* length of this structure */
|
||||
sa_family_t sin6_family; /* AF_INET6 */
|
||||
in_port_t sin6_port; /* Transport layer port # */
|
||||
u32_t sin6_flowinfo; /* IPv6 flow information */
|
||||
struct in6_addr sin6_addr; /* IPv6 address */
|
||||
u32_t sin6_scope_id; /* Set of interfaces for scope */
|
||||
};
|
||||
#endif /* LWIP_IPV6 */
|
||||
|
||||
struct sockaddr {
|
||||
u8_t sa_len;
|
||||
sa_family_t sa_family;
|
||||
#if LWIP_IPV6
|
||||
char sa_data[22];
|
||||
#else /* LWIP_IPV6 */
|
||||
char sa_data[14];
|
||||
#endif /* LWIP_IPV6 */
|
||||
};
|
||||
|
||||
struct sockaddr_storage {
|
||||
@@ -95,7 +92,7 @@ struct sockaddr_storage {
|
||||
char s2_data1[2];
|
||||
u32_t s2_data2[3];
|
||||
#if LWIP_IPV6
|
||||
u32_t s2_data3[2];
|
||||
u32_t s2_data3[3];
|
||||
#endif /* LWIP_IPV6 */
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user