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

net: ListenMulticastUDP should not disable loopback or should specify this in docs #41752

Closed
ghost opened this issue Oct 2, 2020 · 5 comments
Labels
Documentation FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@ghost
Copy link

ghost commented Oct 2, 2020

https://golang.org/pkg/net/#ListenMulticastUDP

This function internally sets the loopback flag to disabled and thus it is impossible to write tests for a single machine. The flag does not appear to be disabled on any OS except windows though I think in the code it supposedly disables this on other platforms.

The comment glosses completely over what a 'simple multicast application' means and surely the simplest multicast application is a pair of goroutines in a single runtime pushing data across this for tests. In this respect you can say that the contract is not specified correctly ("simple application" does not imply no loopback) and it took quite some searching to actually find the way around this. This is some code that enables loopback for multicast UDP: https://github.com/p9c/pod/blob/master/pkg/comm/multicast/channel.go

Either the comment should be changed to point out that loopback does not function on Windows, or the flag should set to enabled by default as this is the behavior implied in the contract from the documentation, or this functionality should be exposed.

I have the solution for my specific needs, so that's all very well and good but I would like to hear the arguments against flipping it to enabled loopback and justifications for this setting being unspecified and buried two levels deep in the code.

@ianlancetaylor ianlancetaylor changed the title ListenMulticastUDP should not disable loopback or should specify this in docs net: ListenMulticastUDP should not disable loopback or should specify this in docs Oct 2, 2020
@ianlancetaylor
Copy link
Contributor

I don't claim to understand all the nuances here. But clearing the loopback flag was introduced in https://golang.org/cl/5562048 before the Go 1 release, so I think we are unlikely to change that now.

Improving the documentation would of course be fine.

@ianlancetaylor ianlancetaylor added Documentation help wanted NeedsFix The path to resolution is known, but the work has not been done. labels Oct 2, 2020
@ianlancetaylor ianlancetaylor added this to the Backlog milestone Oct 2, 2020
@networkimprov
Copy link

cc @odeke-em

@gopherbot
Copy link

Change https://golang.org/cl/271908 mentions this issue: net: add note about disabling loopback in ListenMulticastUDP()

@ianlancetaylor
Copy link
Contributor

ianlancetaylor commented Nov 23, 2020

@stalker-loki Does https://golang.org/cl/271908 look like a useful documentation change? Thanks.

@ghost
Copy link
Author

ghost commented Nov 23, 2020

looks good to me 👍🏻

@dmitshur dmitshur modified the milestones: Backlog, Go1.16 Nov 30, 2020
@golang golang locked and limited conversation to collaborators Nov 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants