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:
Joel Cunningham
2015-05-15 08:50:35 -05:00
committed by goldsimon
parent a6bd0944db
commit d850efdd08
2 changed files with 9 additions and 11 deletions

View File

@@ -89,7 +89,8 @@
(sin6)->sin6_family = AF_INET6; \
(sin6)->sin6_port = htons((port)); \
(sin6)->sin6_flowinfo = 0; \
inet6_addr_from_ip6addr(&(sin6)->sin6_addr, ipaddr); }while(0)
inet6_addr_from_ip6addr(&(sin6)->sin6_addr, ipaddr); \
(sin6)->sin6_scope_id = 0; }while(0)
#define SOCKADDR6_TO_IP6ADDR_PORT(sin6, ipaddr, port) do { \
inet6_addr_to_ip6addr(ip_2_ip6(ipaddr), &((sin6)->sin6_addr)); \
(port) = ntohs((sin6)->sin6_port); }while(0)