After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 707042 - udpsrc binds to INADDR_ANY instead of multicast group address
udpsrc binds to INADDR_ANY instead of multicast group address
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
1.x
Other Linux
: Normal blocker
: 1.1.90
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-08-29 12:01 UTC by Baldur Gislason
Modified: 2013-09-18 16:49 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Baldur Gislason 2013-08-29 12:01:09 UTC
udpsrc binds to INADDR_ANY instead of binding to the multicast group address as is the correct behaviour on Linux.
Binding to INADDR_ANY makes it impossible to join two groups on the same machine, receiving data on the same port, as the Linux kernel will not discriminate packets based on multicast group joined.

Caveat: The Windows IP stack does not allow binding to a multicast group address but does discriminate packets based on group address when joined to a multicast group.

Test:
gst-launch-1.0 udpsrc uri=udp://239.192.192.192:1234

And in another terminal:
$ lsof  | grep 1234
gst-launc 13774          medizza    5u     IPv4            4586602      0t0      UDP *:1234
udpsrc0:s 13774 13775    medizza    5u     IPv4            4586602      0t0      UDP *:1234
gmain     13774 13776    medizza    5u     IPv4            4586602      0t0      UDP *:1234

While compared to another application that has the correct behaviour:
$ lsof  | grep 5500
recordmca 13897          medizza    3u     IPv4            4587787      0t0      UDP 239.192.192.192:1234
Comment 1 Sebastian Dröge (slomo) 2013-08-29 13:02:34 UTC
You can't bind on a multicast address on Windows. Would it help you if we kept bind-address separate and always bind to the bind address for multicast? And for non-multicast always bind to the receiver address and ignore bind-address?
Comment 2 Baldur Gislason 2013-08-29 14:19:15 UTC
That would certainly work, although it requires a linux user to know about the behaviour of the linux ip stack if using more than one multicast group at the same time.
Comment 3 Sebastian Dröge (slomo) 2013-09-03 09:24:46 UTC
commit 7f594369791547095eaff13cbbfcb596defbef9c
Author: Sebastian Dröge <slomo@circular-chaos.org>
Date:   Tue Sep 3 11:23:24 2013 +0200

    udpsrc: Bind to multicast addresses on non-Windows systems
    
    On Windows it's not possible to bind to a multicast address
    but the OS will make sure to filter out all packets that
    arrive not for the multicast address the socket joined.
    
    On Linux and others it is necessary to bind to a multicast
    address to let the OS filter out all packets that are received
    on the same port but for different addresses than the multicast
    address
    
    And deprecate the multicast-group property and replace it with the
    address property.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=707042