right now icecast2 listens to 0.0.0.0 by default if bind-address is not defined. it should rather listen to :: if ipv6 is available. the change is rather small. i do not know how that works on systems that do not support IPv6 yet. so i added #ifdef AF_INET6, is that the right way to check for ipv6? attached is a patch against http://svn.xiph.org/icecast/trunk/net/ if it is ok like that it would be good to apply it for the next release. j -------------- next part -------------- A non-text attachment was scrubbed... Name: icecast2-listentoipv6_by_default.patch Type: text/x-patch Size: 702 bytes Desc: not available Url : http://lists.xiph.org/pipermail/icecast-dev/attachments/20041210/9e81ccbf/icecast2-listentoipv6_by_default.bin
Michael Smith
2004-Dec-12 15:11 UTC
[Icecast-dev] listen to port on ipv6 by default[patch]
On Saturday 11 December 2004 07:56, j@v2v.cc wrote:> right now icecast2 listens to 0.0.0.0 by default if bind-address is not > defined. it should rather listen to :: if ipv6 is available. > the change is rather small. i do not know how that works on systems that > do not support IPv6 yet. > so i added #ifdef AF_INET6, is that the right way to check for ipv6? > > attached is a patch against http://svn.xiph.org/icecast/trunk/net/ > > if it is ok like that it would be good to apply it for the next release. > > jThis doesn't look right to me. This makes the runtime behaviour depend on compile-time availability of AF_INET6. Also, I'm not sure if the runtime behaviour is correct - I'm not that familiar with IPv6. If you have a v6 socket open, will it accept v4 connections? In short, a more complex patch would be needed - at the least, it'd need to query availability of ipv6 sockets at runtime (as well as having the compile-time checks for the appropriate functions/constants/etc.). Mike
On Mon, 2004-12-13 at 10:10 +1100, Michael Smith wrote:> This doesn't look right to me. This makes the runtime behaviour depend on > compile-time availability of AF_INET6.right, HAVE_INET_PTON might be ok than, since AF_INET6 is used in the #ifdef HAVE_INET_PTON section before.> Also, I'm not sure if the runtime behaviour is correct - I'm not that familiar > with IPv6. If you have a v6 socket open, will it accept v4 connections?it will, applications listening on ::, listen on all interfaces ipv4 and ipv6.> In short, a more complex patch would be needed - at the least, it'd need to > query availability of ipv6 sockets at runtime (as well as having the > compile-time checks for the appropriate functions/constants/etc.).as AF_INET6 is needed with PTON i am not sure if that is true. the open question is does ((struct sockaddr_in6*)&sa)->sin6_addr = in6addr_any; ((struct sockaddr_in6*)&sa)->sin6_family = AF_INET6; ((struct sockaddr_in6*)&sa)->sin6_port = htons(port); work on ipv4 only if the kernel has no ipv6 support, i will try to find out, but have not seen a kernel without ipv6 in a long time... j