sockets: fix lwip_getsockname/lwip_getpeername for dual-stack: ip_addr_t type "any" (dual) has to be converted to AF_INET6 --- debian/patches/getpeername_dual | 11 +++++++++++ debian/patches/series | 1 + 2 files changed, 12 insertions(+) create mode 100644 debian/patches/getpeername_dual
diff --git a/debian/patches/getpeername_dual b/debian/patches/getpeername_dual new file mode 100644 index 0000000..37be462 --- /dev/null +++ b/debian/patches/getpeername_dual @@ -0,0 +1,11 @@ +--- a/src/api/sockets.c ++++ b/src/api/sockets.c +@@ -123,7 +123,7 @@ + ((((name)->sa_family == AF_INET) && !(NETCONNTYPE_ISIPV6((sock)->conn->type))) || \ + (((name)->sa_family == AF_INET6) && (NETCONNTYPE_ISIPV6((sock)->conn->type)))) + #define IPADDR_PORT_TO_SOCKADDR(sockaddr, ipaddr, port) do { \ +- if (IP_IS_V6(ipaddr)) { \ ++ if (((ipaddr) && IP_IS_ANY_TYPE_VAL(*ipaddr)) || IP_IS_V6(ipaddr)) { \ + IP6ADDR_PORT_TO_SOCKADDR((struct sockaddr_in6*)(void*)(sockaddr), ip_2_ip6(ipaddr), port); \ + } else { \ + IP4ADDR_PORT_TO_SOCKADDR((struct sockaddr_in*)(void*)(sockaddr), ip_2_ip4(ipaddr), port); \ diff --git a/debian/patches/series b/debian/patches/series index 7d92024..e5ca54e 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,5 +3,6 @@ posix errno autoconf bug-36167 +getpeername_dual poll max_sockets -- 2.17.1