Re: [libmicrohttpd] How to get the client IP as IPv4 in dual stack mode?

2019-11-28 Thread Christian Grothoff
Hi silvioprog, Have you considered simply using IN6_IS_ADDR_V4MAPPED on the v6 address, and if it matches, extracting the mapped v4 address? Happy hacking! Christian On 11/28/19 4:35 AM, silvioprog wrote: > Hi. > > I haveĀ a function which checks if the sa_family is AF_INET or AF_INET6 > and

Re: [libmicrohttpd] How to get the client IP as IPv4 in dual stack mode?

2019-11-28 Thread silvioprog
Hi Christian. It solved the problem. Thank you so much! :-) This is the updated version of the function, if someone need it: int get_ip(const void *socket, char *buf, size_t size) { const struct sockaddr *sa; const void *addr6; size_t len; if (!socket || !buf || (ssize_t) size < 0) r