Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential issue joining multicast group? #155

Open
rwarner opened this issue Jan 8, 2025 · 4 comments
Open

Potential issue joining multicast group? #155

rwarner opened this issue Jan 8, 2025 · 4 comments

Comments

@rwarner
Copy link

rwarner commented Jan 8, 2025

Currently debugging an issue potentially with this implementation of SSDP in Golang.

On my current machine, I have no issues with the Minidlna C implementation joining the 239.255.255.250:1900 socket and receiving multicast broadcasts from across subnets.

However, with the same exact interface and calling on this Server in Golang, I only get results for 0.0.0.0:1900 and do not have success with accessing this server like the 239.255.255.250:1900 socket Minidlna has.

Just to be clear, whenever this is ran I only ever get

sudo netstat -tulnp | grep 1900
udp 0 0 0.0.0.0:1900 0.0.0.0:*

Looking here:

dms/ssdp/ssdp.go

Lines 95 to 108 in 07c3224

func makeConn(ifi net.Interface) (ret *net.UDPConn, err error) {
ret, err = net.ListenMulticastUDP("udp", &ifi, NetAddr)
if err != nil {
return
}
p := ipv4.NewPacketConn(ret)
if err := p.SetMulticastTTL(2); err != nil {
log.Print(err)
}
// if err := p.SetMulticastLoopback(true); err != nil {
// log.Println(err)
// }
return
}

Is there any reason there isn't a JoinGroup used?

e.g.

// Bind the multicast group to the interface
if err := p.JoinGroup(&iface, groupAddr); err != nil {
    logger.Debugf("Failed to join multicast group: %v", err)
    return err
}

I haven't had a chance to try to compile a change myself with this repo and then re-implement the library in the other application but wanted to see if there was any decision made with the implementation for this as I haven't been having success as is.

Thanks

@anacrolix
Copy link
Owner

I think I wrote and tested this part in 2012 or so. I'm definitely open to improvements if they fix things for you! Thanks

@rwarner
Copy link
Author

rwarner commented Jan 11, 2025

No problem sounds good. Looking at the commits I figured this might be the case. Will poke around, thanks!

@rwarner
Copy link
Author

rwarner commented Jan 24, 2025

@anacrolix I spent quite a few nights looking into this and poking around. Originally I thought it may have been that joinCall method or something in the rootDesc.xml. Tried integrating a few changes in the ssdp.go and dms.go for this library but was unsuccessful.

I can access the server running this on the same subnet, but different subnets cannot. I ended up finding this: golang/go#34728

Which showcases a lower-level golang issue that might be out of this scope of the library. Thought I would share. I tried to implement what they were discussing in that issue thread and such but haven't been successful of getting that socket bound to that 2xx.xx*:1900 IP

Just wanted to chime in here for you, not looking for you to put in any work on it. Thanks for listening

@anacrolix
Copy link
Owner

I appreciate you looking in to it. Unfortunately my experience with Go for complex networking outside the usual client/server stuff has not been positive. There's a lack of deep networking knowledge amongst the core developers and standard library. There are x/net modules that extend networking support but in my opinion they're badly designed and miss critical features and abstractions. I'm probably using some of my workarounds in dms, if not I'm definitely using them in some of my newer projects.

We'll leave this issue open as I know a few Linux distros package this project and there's some good deep knowledge in some of the maintainers and users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants