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

new API to set multicast loop v4 for ServiceDaemon #281

Merged
merged 5 commits into from
Dec 11, 2024
Merged

Conversation

keepsimple1
Copy link
Owner

This patch is trying to solve issue #278 . I'm curious if this new API can support what was asked:

/// Enable or disable the loopback for locally sent multicast packets.
///
/// When disabled, a local querier will not receive announcements from a local responder.
pub fn set_multicast_loop_v4(&self, on: bool) -> Result<()>

@AMythicDev
Copy link

So I finally got the time to look into this. For some reason, I wasn't able to reproduce the effect. Here are the info logs that I collected and cleaned up.

Received other event: ServiceFound("_myservice._tcp.local.", "arijit-laptop._myservice._tcp.local.")

service resolved: ServiceInfo { ty_domain: "_myservice._tcp.local.", sub_domain: None, fullname: "arijit-laptop._myservice._tcp.local.", server: "arijit-laptop.local.", addresses: {192.168.31.204, fe80::dfed:529c:84ef:d24a}, port: 10116, host_ttl: 120, other_ttl: 4500, priority: 0, weight: 0, txt_properties: TxtProperties { properties: [] }, addr_auto: false, status: {}, requires_probe: true }

service resolved: ServiceInfo { ty_domain: "_myservice._tcp.local.", sub_domain: None, fullname: "arijit-laptop._myservice._tcp.local.", server: "arijit-laptop.local.", addresses: {fe80::dfed:529c:84ef:d24a, 192.168.31.204}, port: 10116, host_ttl: 120, other_ttl: 4500, priority: 0, weight: 0, txt_properties: TxtProperties { properties: [] }, addr_auto: false, status: {}, requires_probe: true }

service resolved: ServiceInfo { ty_domain: "_myservice._tcp.local.", sub_domain: None, fullname: "arijit-laptop._myservice._tcp.local.", server: "arijit-laptop.local.", addresses: {fe80::dfed:529c:84ef:d24a, 2409:40e5:167:6011:3b95:d952:c425:3f82, 192.168.31.204}, port: 10116, host_ttl: 120, other_ttl: 4500, priority: 0, weight: 0, txt_properties: TxtProperties { properties: [] }, addr_auto: false, status: {}, requires_probe: true }

service resolved: ServiceInfo { ty_domain: "_myservice._tcp.local.", sub_domain: None, fullname: "arijit-laptop._myservice._tcp.local.", server: "arijit-laptop.local.", addresses: {2409:40e5:167:6011:3b95:d952:c425:3f82, 192.168.31.204, fe80::dfed:529c:84ef:d24a}, port: 10116, host_ttl: 120, other_ttl: 4500, priority: 0, weight: 0, txt_properties: TxtProperties { properties: [] }, addr_auto: false, status: {}, requires_probe: true }

service resolved: ServiceInfo { ty_domain: "_myservice._tcp.local.", sub_domain: None, fullname: "arijit-laptop._myservice._tcp.local.", server: "arijit-laptop.local.", addresses: {fe80::dfed:529c:84ef:d24a, 2409:40e5:167:6011:3b95:d952:c425:3f82, 192.168.31.204}, port: 10116, host_ttl: 120, other_ttl: 4500, priority: 0, weight: 0, txt_properties: TxtProperties { properties: [] }, addr_auto: false, status: {}, requires_probe: true }

Hope this helps, if you want more verbose logs feel free to hit me.

Thanks

@keepsimple1
Copy link
Owner Author

So I finally got the time to look into this. For some reason, I wasn't able to reproduce the effect. Here are the info logs that I collected and cleaned up.

Thanks for trying it out! Was it on Windows on Unix platforms? The first version of the diff was not working on Windows. Now I've found that it's the client side that needs to call set_multicast_loop_v4 on Windows and fixed the test.

I've also added the support for v6: set_multicast_loop_v6 . You can use both APIs in case you want to cover both v4 and v6 interfaces. Let me know if that works for you. Thanks!

@AMythicDev
Copy link

Oops my bad, I didn't look into the changes and assumed that this option should be enabled by default. Anyways, I disabled both the IPv4 and IPv6 loopbacks and everything seems perfect.

Thanks for working on this.

@keepsimple1
Copy link
Owner Author

keepsimple1 commented Dec 11, 2024

Not a problem, thank you for trying it out! That's very helpful! I will merge this API.

And I updated the doc comments to mention that "By default, multicast loop is enabled".

@keepsimple1 keepsimple1 merged commit 1ddae63 into main Dec 11, 2024
3 checks passed
@keepsimple1 keepsimple1 deleted the loopback branch December 11, 2024 05:16
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

Successfully merging this pull request may close these issues.

2 participants