GNOME Bugzilla – Bug 702002
setting address pool with only ipv4 addresses doesn't work
Last modified: 2014-02-25 22:28:45 UTC
Since I patched the ipv4/6 support in rtsp-stream.c there is a new problem: setting an address pool causes the allocate_ports behaviour to change, it will choose ports from that pool and try to bind to these. If we don't have ipv4 AND ipv6 addresses in the pool this will fail. So question is what the desired behavior is: * Is it allowed to not define an ipv6 address? The answer must be yes, but in that case we need to handle ipv6 alloc_ports to fail in a controlled manner without compromising the rest of the functionality * Is it allowed to not define an ipv4 address? Probably yes * If ipv4 OR ipv6 fails to allocate ports but not both (even though both having addresses in the pool), is this a failure? * If there is no ipv6 address defined, perhaps we should allocate a port with the algorithm used when we haven't set a pool at all?
IMO, the stream should not fail if it can't get an address of the right version. the stream will simply only be available for clients requesting the available version. If no versions are possible, we fail. If you want to explicitly limit the amount of IPv4 addresses but allow any IPv6, you should add an IPv6 range that includes everything. so: no pool = no restrictions for ipv4 and ipv6 ports pool = restricts ipv4 and ipv6 addresses an alternative is to set a 2 pools one for ipv4 and another for ipv6 but that maybe that's a bit too much.
First patch to not fail when one of ipv4 or ipv6 fails. Next is to only allow setup requests for this stream in one of the supported families. commit 82812988a6f37da1b19adc00ce4ccd6ac8b97cfb Author: Wim Taymans <wim.taymans@collabora.co.uk> Date: Mon Jul 1 14:45:49 2013 +0200 stream: handle failed port allocation Allow for ipv4 or ipv6 socket allocations to fail. Only report failure if we can't allocate any family at all. Also keep track of what port families we allocated. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=703175
Now it should work. If the client connects with ipv6 and there is no ipv6 in the pool, or when it connects with ipv4 without ipv4 in the pool, there is an error now. commit a7fe63298cd0535eda939ccb3c89d0f0d8d2bdae Author: Wim Taymans <wim.taymans@collabora.co.uk> Date: Mon Jul 1 16:46:07 2013 +0200 stream: add more support for IPv6 Rename _get_address to _get_multicast_address in GstRTSPStream to make it clear that this function only deals with multicast. Make it possible to have both an IPv4 and IPv6 multicast address on a stream. Give the client an IPv4 or IPv6 address depending on the address it used to connect to the server. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=702002