Support for Source-Specific Multicast

396 views
Skip to first unread message

coby....@gmail.com

unread,
May 28, 2014, 11:20:14 AM5/28/14
to golan...@googlegroups.com
Hello,

I am working on a (linux) app that needs to join Source-Specific Multicast channels, and am looking for some better options on how to accomplish this with golang.

I’ve made some initial progress by adapting much of the logic behind net.ListenMulicastUDP() into my own package, with some tweaks to:

A) Allow the Source address to be passed through in the setsockopt call that triggers the Multicast join (syscall.IP_ADD_SOURCE_MEMBERSHIP).
 
B) Bypass the provisions for shared-access and nonblocking-IO provided by net.UDPConn and instead work directly on the socket’s file descriptor.  I only need to read a single multicast channel from a single goroutine, so I don’t miss the shared-access logic.  I would have liked to use the nonblocking IO provided by netFd, but there are dependencies on runtime assembly (see: fd_poll_runtime.go) that I couldn't figure out how to tease out of the "net" package.

In isolation, this approach works, and I’m able to use syscall.Recvfrom() to pull the datagrams from the multicast channel.  However, when I introduced other goroutines in my app that are performing unrelated blocking IO (to the filesystem), I start running into problems that seem to manifest as missing packets from multicast stream.  I’m still trying to debug/understand this.

Before I get too far off on this tangent, I thought it would be a good time to check in with this group to see if there are other/better ideas to get Source-Specific Multicast working with go.

Thanks in advance for any pointers, feedback, or ideas you think may be helpful.

Regards,
Coby Young

Mikio Hara

unread,
May 28, 2014, 11:09:45 PM5/28/14
to coby....@gmail.com, golang-nuts
On Thu, May 29, 2014 at 12:20 AM, <coby....@gmail.com> wrote:

> I am working on a (linux) app that needs to join Source-Specific Multicast
> channels, and am looking for some better options on how to accomplish this
> with golang.

I have a plan to add SSM stuff into go.net/ipv4 and ipv6. Does this work to you?
http://godoc.org/code.google.com/p/go.net/ipv4
http://godoc.org/code.google.com/p/go.net/ipv6

Coby Young

unread,
May 29, 2014, 10:32:56 AM5/29/14
to golan...@googlegroups.com, coby....@gmail.com
> I have a plan to add SSM stuff into go.net/ipv4 and ipv6. Does this work to you? 

Yes, that sounds wonderful.  What release timeframe do you have in mind?

Mikio Hara

unread,
Jun 4, 2014, 6:06:32 AM6/4/14
to Coby Young, golang-nuts
On Thu, May 29, 2014 at 11:32 PM, Coby Young <coby....@gmail.com> wrote:

> Yes, that sounds wonderful. What release timeframe do you have in mind?

soon, once the tree is open for go1.4. ;) note that patches to
go.net{ipv4,ipv6} will require a few code fragments of syscall package
for go1.4, but i think you can use tip's z*_linux_*.go files with
go1.3.
Reply all
Reply to author
Forward
0 new messages