libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] How is MHD_USE_IPv6 supposed to work?


From: Christian Grothoff
Subject: Re: [libmicrohttpd] How is MHD_USE_IPv6 supposed to work?
Date: Tue, 13 Dec 2011 19:41:01 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20111004 Lightning/1.0b1 Icedove/3.0.11

On 12/13/2011 07:26 PM, Sven Geggus wrote:
Hello,

to support dual stack I just changed my code from:

MHD_start_daemon(MHD_NO,...
to
MHD_start_daemon(MHD_USE_IPv6,...

Unfortunately the daemon seems to be ipv6 _only_ now.

How ist this supposed to work?

 From generic socket-programming I usually assume AF_INET6 on to
serverside to be both IPv4 and IPv6. Is this different as far as
libmicrohttpd is concerned?

Yes, assuming an IPv6-socket is for both v4 and v6 is considered bad style and will NOT work on all OSes (and on Linux it'll only work if your kernel uses a particular, outdated configuration).

The correct way to get dual-stack is to call MHD_start_daemon twice, once for IPv4 and once for IPv6.

If you want to insist on one listen-socket for both v4 and v6, you can still force that by doing the bind/listen manually yourself (with the right socket options and appropriate amount of praying) and then give that pre-bound listen socket to MHD (MHD_OPTION_LISTEN_SOCKET). But again, this is NOT the recommended or portable approach.

Happy hacking,

Christian



reply via email to

[Prev in Thread] Current Thread [Next in Thread]