Skip to content

netdev panics if an interface w/o MAC address is connected to Windows #132

@ProgramCrafter

Description

@ProgramCrafter

let res = unsafe {
SendARP(
dst_ip_int,
src_ip_int,
target_mac_addr.as_mut_ptr().cast(),
&mut out_buf_len,
)
};
if res == NO_ERROR {
assert_eq!(out_buf_len, 6);

This check panics on my computer, on Windows.
My computer has a TUN interface with no MAC address, and I can only suppose that's the reason.


thread 'main' panicked at C:\Users\*****\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\netdev-0.36.0\src\interface\windows.rs:45:9:
assertion `left == right` failed
  left: 0
 right: 6
stack backtrace:
   0:     0x7ff6ecdc7ad1 - std::backtrace_rs::backtrace::win64::trace
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
   1:     0x7ff6ecdc7ad1 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ff6ecdc7ad1 - std::sys::backtrace::_print_fmt
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\sys\backtrace.rs:66
   3:     0x7ff6ecdc7ad1 - std::sys::backtrace::impl$0::print::impl$0::fmt
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\sys\backtrace.rs:39
   4:     0x7ff6ecdecafa - core::fmt::rt::Argument::fmt
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\core\src\fmt\rt.rs:177
   5:     0x7ff6ecdecafa - core::fmt::write
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\core\src\fmt\mod.rs:1449
   6:     0x7ff6ecdc2b87 - std::io::Write::write_fmt<std::sys::pal::windows::stdio::Stderr>
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\io\mod.rs:1890
   7:     0x7ff6ecdc7915 - std::sys::backtrace::BacktraceLock::print
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\sys\backtrace.rs:42
   8:     0x7ff6ecdc9822 - std::panicking::default_hook::closure$0
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\panicking.rs:298
   9:     0x7ff6ecdc9613 - std::panicking::default_hook
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\panicking.rs:325
  10:     0x7ff6ecdca3ff - std::panicking::rust_panic_with_hook
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\panicking.rs:831
  11:     0x7ff6ecdca199 - std::panicking::begin_panic_handler::closure$0
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\panicking.rs:704
  12:     0x7ff6ecdc863f - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\sys\backtrace.rs:168
  13:     0x7ff6ecdc9d9e - std::panicking::begin_panic_handler
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\panicking.rs:695
  14:     0x7ff6ece3c2a1 - core::panicking::panic_fmt
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\core\src\panicking.rs:75
  15:     0x7ff6ece3c64b - core::panicking::assert_failed_inner
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\core\src\panicking.rs:420
  16:     0x7ff6ece1f3d3 - core::panicking::assert_failed::ha2cdb2e3fec0a1cc
  17:     0x7ff6ec83b17b - core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut::h331c22d68ac4f3fb
  18:     0x7ff6ec83a1db - <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter::hfae172e4438747ad
  19:     0x7ff6ec83b65e - netdev::interface::windows::interfaces::h92f312c1b0464800
  20:     0x7ff6ec838c1d - netdev::interface::get_interfaces::h97861cfa9288b457
  21:     0x7ff6ec2e7006 - core::ptr::drop_in_place<connectivity::main::{{closure}}>::hc97f03a2228dac32
  22:     0x7ff6ec2efd37 - connectivity::main::{{closure}}::hf3a6a7c102e19c4b
  23:     0x7ff6ec2edecc - tokio::runtime::park::CachedParkThread::block_on::h0975a0ca582d7cca
  24:     0x7ff6ec32e5cb - tokio::runtime::context::runtime::enter_runtime::h639a9edda7a95528
  25:     0x7ff6ec33470e - tokio::runtime::runtime::Runtime::block_on::h617ae7f52f8fcd6f
  26:     0x7ff6ec346652 - <std::io::Write::write_fmt::Adapter<T> as core::fmt::Write>::write_str::h56409b29fbf1dd46
  27:     0x7ff6ec33d136 - std::sys::backtrace::__rust_begin_short_backtrace::h6f5d9801e79eedf4
  28:     0x7ff6ec32955a - std::rt::lang_start::{{closure}}::h7f2e4919114a19a9
  29:     0x7ff6ecdba7ac - std::rt::lang_start_internal::closure$0
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\rt.rs:168
  30:     0x7ff6ecdba7ac - std::panicking::try::do_call
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\panicking.rs:587
  31:     0x7ff6ecdba7ac - std::panicking::try
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\panicking.rs:550
  32:     0x7ff6ecdba7ac - std::panic::catch_unwind
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\panic.rs:358
  33:     0x7ff6ecdba7ac - std::rt::lang_start_internal
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\rt.rs:164
  34:     0x7ff6ec3467dc - main
  35:     0x7ff6ece0cacc - invoke_main
                               at d:\a01\_work\12\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  36:     0x7ff6ece0cacc - __scrt_common_main_seh
                               at d:\a01\_work\12\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  37:     0x7ffb80387034 - BaseThreadInitThunk
  38:     0x7ffb81102651 - RtlUserThreadStart

thread 'tokio-runtime-worker' panicked at C:\Users\*****\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\netdev-0.36.0\src\interface\windows.rs:45:9:
assertion `left == right` failed
  left: 0
 right: 6
stack backtrace:
   0:     0x7ff6ecdc7ad1 - std::backtrace_rs::backtrace::win64::trace
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
   1:     0x7ff6ecdc7ad1 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ff6ecdc7ad1 - std::sys::backtrace::_print_fmt
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\sys\backtrace.rs:66
   3:     0x7ff6ecdc7ad1 - std::sys::backtrace::impl$0::print::impl$0::fmt
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\sys\backtrace.rs:39
   4:     0x7ff6ecdecafa - core::fmt::rt::Argument::fmt
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\core\src\fmt\rt.rs:177
   5:     0x7ff6ecdecafa - core::fmt::write
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\core\src\fmt\mod.rs:1449
   6[2025-09-04T18:18:54Z DEBUG mainline::dht] mainline::Dht's actor thread was shutdown after Drop.
:     0x7ff6ecdc2b87 - std::io::Write::write_fmt<std::sys::pal::windows::stdio::Stderr>
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\io\mod.rs:1890
   7:     0x7ff6ecdc7915 - std::sys::backtrace::BacktraceLock::print
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\sys\backtrace.rs:42
   8:     0x7ff6ecdc9822 - std::panicking::default_hook::closure$0
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\panicking.rs:298
   9:     0x7ff6ecdc9613 - std::panicking::default_hook
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\panicking.rs:325
  10:     0x7ff6ecdca3ff - std::panicking::rust_panic_with_hook
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\panicking.rs:831
  11:     0x7ff6ecdca199 - std::panicking::begin_panic_handler::closure$0
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\panicking.rs:704
  12:     0x7ff6ecdc863f - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\sys\backtrace.rs:168
  13:     0x7ff6ecdc9d9e - std::panicking::begin_panic_handler
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\panicking.rs:695
  14:     0x7ff6ece3c2a1 - core::panicking::panic_fmt
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\core\src\panicking.rs:75
  15:     0x7ff6ece3c64b - core::panicking::assert_failed_inner
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\core\src\panicking.rs:420
  16:     0x7ff6ece1f3d3 - core::panicking::assert_failed::ha2cdb2e3fec0a1cc
  17:     0x7ff6ec83b17b - core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut::h331c22d68ac4f3fb
  18:     0x7ff6ec83a1db - <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter::hfae172e4438747ad
  19:     0x7ff6ec83b65e - netdev::interface::windows::interfaces::h92f312c1b0464800
  20:     0x7ff6ec838e2e - netdev::gateway::get_default_gateway::h017a64ca89f03973
  21:     0x7ff6ec823be9 - netwatch::interfaces::HomeRouter::new::h66943087134e9342
  22:     0x7ff6ec6ba2e1 - portmapper::Service::probe_request::hec69acf35728db4b
  23:     0x7ff6ec6b8363 - portmapper::Service::get_mapping::h2410e7b4cb2765e4
  24:     0x7ff6ec766ed8 - <tracing::instrument::Instrumented<T> as core::future::future::Future>::poll::hda69fb891ef5ea52
  25:     0x7ff6ec759ea3 - <tracing::instrument::Instrumented<T> as core::future::future::Future>::poll::h671a01efd9b40d44
  26:     0x7ff6ec6ec9b5 - tokio::runtime::task::core::Core<T,S>::poll::h177e67e2a3e5e0f0
  27:     0x7ff6ec76f040 - tokio::runtime::task::harness::Harness<T,S>::poll::h40eef428c1cc1bb5
  28:     0x7ff6ecd2fde3 - tokio::runtime::scheduler::multi_thread::worker::Context::run::h1ff925e4b865fa2e
  29:     0x7ff6ecd2ddb6 - tokio::runtime::scheduler::multi_thread::worker::Context::run::h1ff925e4b865fa2e
  30:     0x7ff6ecd346fd - tokio::runtime::context::scoped::Scoped<T>::set::h065827ecc17437d2
  31:     0x7ff6ecd3443e - tokio::runtime::context::runtime::enter_runtime::h4e59557d163fe5dd
  32:     0x7ff6ecd2d5e2 - tokio::runtime::scheduler::multi_thread::worker::run::h4578dff2e24757c8
  33:     0x7ff6ecd38e11 - tokio::runtime::task::core::Core<T,S>::poll::h5d876a781f56a78b
  34:     0x7ff6ecd396b2 - tokio::runtime::task::harness::Harness<T,S>::poll::h1183ad5193e84a3f
  35:     0x7ff6ecd3efe0 - tokio::runtime::blocking::pool::Inner::run::h4698f822bd487f31
  36:     0x7ff6ecd194bf - std::sys::backtrace::__rust_begin_short_backtrace::he1aa38b937b1d00c
  37:     0x7ff6ecd276a3 - std::thread::Builder::spawn_unchecked::hde8c62f7d492f152
  38:     0x7ff6ecdd582d - alloc::boxed::impl$28::call_once
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\alloc\src\boxed.rs:1976
  39:     0x7ff6ecdd582d - alloc::boxed::impl$28::call_once
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\alloc\src\boxed.rs:1976
  40:     0x7ff6ecdd582d - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\sys\pal\windows\thread.rs:56
  41:     0x7ffb80387034 - BaseThreadInitThunk
  42:     0x7ffb81102651 - RtlUserThreadStart
error: process didn't exit successfully: `target\release\*****.exe` (exit code: 101)

Reported first at n0-computer/iroh#3451.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions