Coder Social home page Coder Social logo

Windows: Failed to create daemon: Msg("join multicast group on addr 192.168.82.56: The requested address is not valid in its context. (os error 10049)" about mdns-sd HOT 6 CLOSED

jlamain avatar jlamain commented on August 16, 2024
Windows: Failed to create daemon: Msg("join multicast group on addr 192.168.82.56: The requested address is not valid in its context. (os error 10049)"

from mdns-sd.

Comments (6)

jlamain avatar jlamain commented on August 16, 2024 1

All tests Ok !

from mdns-sd.

jlamain avatar jlamain commented on August 16, 2024

I fixed it by using this patch:

diff --git a/src/service_daemon.rs b/src/service_daemon.rs
index 03aaa2a..c3feeff 100644
--- a/src/service_daemon.rs
+++ b/src/service_daemon.rs
@@ -446,12 +446,14 @@ fn new_socket_bind(intf_ip: &Ipv4Addr) -> Result<Socket> {
     let sock = new_socket(Ipv4Addr::new(0, 0, 0, 0), MDNS_PORT, true)?;

     // Join mDNS group to receive packets.
-    sock.join_multicast_v4(&GROUP_ADDR, intf_ip)
-        .map_err(|e| e_fmt!("join multicast group on addr {}: {}", intf_ip, e))?;
+    if let Err(e) = sock.join_multicast_v4(&GROUP_ADDR, intf_ip) {
+        error!("join multicast group on addr {}: {}", &intf_ip, e);
+    }

     // Set IP_MULTICAST_IF to send packets.
-    sock.set_multicast_if_v4(intf_ip)
-        .map_err(|e| e_fmt!("set multicast_if on addr {}: {}", intf_ip, e))?;
+    if let Err(e) = sock.set_multicast_if_v4(intf_ip) {
+        error!("set multicast_if on addr {}: {}", &intf_ip, e);
+    }

     Ok(sock)
 }

This fixes my Chromecast browsing. However, it breaks an integration test:
Running tests\mdns_test.rs (target\debug\deps\mdns_test-c4fdcd0cd49a069d.exe)

running 5 tests
test service_name_check ... ok
test subtype ... ok
test service_without_properties_with_alter_net ... ok
test service_with_invalid_addr ... ok
test integration_success ... FAILED

failures:

---- integration_success stdout ----
My IPv4 addr(s): [Ifv4Addr { ip: 192.168.82.56, netmask: 31.0.0.0, broadcast: Some(224.255.255.255) }, Ifv4Addr { ip: 172.28.112.1, netmask: 255.255.31.0, broadcast: Some(172.28.240.255) }, Ifv4Addr { ip: 192.168.68.86, netmask: 255.255.127.0, broadcast: Some(192.168.196.255) }, Ifv4Addr { ip: 172.31.240.1, netmask: 255.255.31.0, broadcast: Some(172.31.240.255) }]
Service browse (_mdns-sd-it._udp.local.) returns Error::Again
Search started for _mdns-sd-it._udp.local.
Found a new service: 1671973293471265._mdns-sd-it._udp.local.
Resolved a new service: 1671973293471265._mdns-sd-it._udp.local. addr(s): {192.168.82.56}
Search started for _mdns-sd-it._udp.local.
Removed service: 1671973293471265._mdns-sd-it._udp.local.
Search started for _mdns-sd-it._udp.local.
Search stopped for _mdns-sd-it._udp.local.
metrics: {"cache-refresh": 0, "browse": 3, "register-resend": 1, "unregister": 1, "register": 1, "unregister-resend": 4}
thread 'integration_success' panicked at 'no entry found for key', tests\mdns_test.rs:154:13
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\std\src\panicking.rs:575
   1: core::panicking::panic_fmt
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\core\src\panicking.rs:65
   2: core::panicking::panic_display<str>
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\core\src\panicking.rs:139
   3: core::panicking::panic_str
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\core\src\panicking.rs:123
   4: core::option::expect_failed
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\core\src\option.rs:1879
   5: std::collections::hash::map::impl$9::index<alloc::string::String,str,i64,std::collections::hash::map::RandomState>
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943\library\std\src\collections\hash\map.rs:1340
   6: mdns_test::integration_success
             at .\tests\mdns_test.rs:154
   7: mdns_test::integration_success::closure$0
             at .\tests\mdns_test.rs:12
   8: core::ops::function::FnOnce::call_once<mdns_test::integration_success::closure_env$0,tuple$<> >
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943\library\core\src\ops\function.rs:251
   9: core::ops::function::FnOnce::call_once
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\core\src\ops\function.rs:251
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.


failures:
    integration_success

test result: FAILED. 4 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 4.81s

from mdns-sd.

keepsimple1 avatar keepsimple1 commented on August 16, 2024

I do not know why it uses 192.168.82.56. That is not my current network, and not in ipconfig /all. It seems to be the same one as #52

You are right. It think it is the same one as in #52 . For some reason, I lost the fix #53 in a refactoring later. Sorry about that. I will submit a new PR.

from mdns-sd.

keepsimple1 avatar keepsimple1 commented on August 16, 2024

However, it breaks an integration test:

In your diff, we still return Ok(sock) and add the interface in the list. In the PR, we will skip the errored interface. I think it should fix the problem. Let me know if any issues or questions.

from mdns-sd.

jlamain avatar jlamain commented on August 16, 2024

Hi,

I checked out branch fix-vpn-again. This fixes the query for chromecasts.

However, the mdns_test fails:

     Running tests\mdns_test.rs (target\debug\deps\mdns_test-c4fdcd0cd49a069d.exe)

running 5 tests
test service_name_check ... ok
test service_with_invalid_addr ... ok
test service_without_properties_with_alter_net ... FAILED
test subtype ... FAILED
test integration_success ... FAILED

failures:

---- service_without_properties_with_alter_net stdout ----
Received event SearchStarted("_serv-no-prop._tcp.local.")
Received event SearchStarted("_serv-no-prop._tcp.local.")
browse error: timed out waiting on a channel
thread 'service_without_properties_with_alter_net' panicked at 'assertion failed: false', tests\mdns_test.rs:255:17
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\std\src\panicking.rs:575
   1: core::panicking::panic_fmt
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\core\src\panicking.rs:65
   2: core::panicking::panic
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\core\src\panicking.rs:115
   3: mdns_test::service_without_properties_with_alter_net
             at .\tests\mdns_test.rs:255
   4: mdns_test::service_without_properties_with_alter_net::closure$0
             at .\tests\mdns_test.rs:203
   5: core::ops::function::FnOnce::call_once<mdns_test::service_without_properties_with_alter_net::closure_env$0,tuple$<> >
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943\library\core\src\ops\function.rs:251
   6: core::ops::function::FnOnce::call_once
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\core\src\ops\function.rs:251
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---- subtype stdout ----
Received event SearchStarted("_test._tcp.local.")
Received event SearchStarted("_test._tcp.local.")
browse error: timed out waiting on a channel
thread 'subtype' panicked at 'assertion failed: false', tests\mdns_test.rs:370:21
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\std\src\panicking.rs:575
   1: core::panicking::panic_fmt
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\core\src\panicking.rs:65
   2: core::panicking::panic
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\core\src\panicking.rs:115
   3: mdns_test::subtype
             at .\tests\mdns_test.rs:370
   4: mdns_test::subtype::closure$0
             at .\tests\mdns_test.rs:325
   5: core::ops::function::FnOnce::call_once<mdns_test::subtype::closure_env$0,tuple$<> >
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943\library\core\src\ops\function.rs:251
   6: core::ops::function::FnOnce::call_once
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\core\src\ops\function.rs:251
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---- integration_success stdout ----
My IPv4 addr(s): [Ifv4Addr { ip: 192.168.82.56, netmask: 31.0.0.0, broadcast: Some(224.255.255.255) }, Ifv4Addr { ip: 172.28.112.1, netmask: 255.255.31.0, broadcast: Some(172.28.240.255) }, Ifv4Addr { ip: 192.168.68.86, netmask: 255.255.127.0, broadcast: Some(192.168.196.255) }, Ifv4Addr { ip: 172.31.240.1, netmask: 255.255.31.0, broadcast: Some(172.31.240.255) }]
Service browse (_mdns-sd-it._udp.local.) returns Error::Again
Search started for _mdns-sd-it._udp.local.
Search started for _mdns-sd-it._udp.local.
Search started for _mdns-sd-it._udp.local.
thread 'integration_success' panicked at 'assertion failed: `(left == right)`
  left: `0`,
 right: `1`', tests\mdns_test.rs:132:5
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\std\src\panicking.rs:575
   1: core::panicking::panic_fmt
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\core\src\panicking.rs:65
   2: core::fmt::Arguments::new_v1
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\core\src\fmt\mod.rs:398
   3: core::panicking::assert_failed_inner
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\core\src\panicking.rs:246
   4: core::panicking::assert_failed<i32,i32>
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943\library\core\src\panicking.rs:203
   5: mdns_test::integration_success
             at .\tests\mdns_test.rs:132
   6: mdns_test::integration_success::closure$0
             at .\tests\mdns_test.rs:12
   7: core::ops::function::FnOnce::call_once<mdns_test::integration_success::closure_env$0,tuple$<> >
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943\library\core\src\ops\function.rs:251
   8: core::ops::function::FnOnce::call_once
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\core\src\ops\function.rs:251
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.


failures:
    integration_success
    service_without_properties_with_alter_net
    subtype

test result: FAILED. 2 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.99s

error: test failed, to rerun pass `--test mdns_test`

Thanks for helping out. Let me know if you need more info.

from mdns-sd.

keepsimple1 avatar keepsimple1 commented on August 16, 2024

Thanks for checking the fix. I've updated the test to validate the IPv4 address. Could you please try it again? Thanks!

from mdns-sd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.