Skip to content

webrtc: Panics for non-stun packets #107

Open
@lexnv

Description

@lexnv

Discovered during testing a polkadot node with litep2p + webrtc and integrating with smol-dot/smoldot#1806.

Substrate PR used for enabling webrtc: paritytech/polkadot-sdk#4310

Repro case: port scanning

sudo nmap -p 33999 -sU my-ip

msg => {
if let Err(error) = self.opening.get_mut(&source).expect("to exist").on_input(msg) {
tracing::error!(
target: LOG_TARGET,
?error,
?source,
"failed to handle inbound datagram"
);
}
}

2024-05-07 16:03:55.886 DEBUG tokio-runtime-worker litep2p::webrtc: received non-stun message source=192.168.0.8:33669

====================

Version: 1.10.0-1c04ef63751

   0: sp_panic_handler::set::{{closure}}
   1: std::panicking::rust_panic_with_hook
   2: std::panicking::begin_panic_handler::{{closure}}
   3: std::sys_common::backtrace::__rust_end_short_backtrace
   4: rust_begin_unwind
   5: core::panicking::panic_fmt
   6: core::option::expect_failed
   7: <litep2p::transport::webrtc::WebRtcTransport as futures_core::stream::Stream>::poll_next
   8: <litep2p::transport::manager::TransportContext as futures_core::stream::Stream>::poll_next
   9: litep2p::transport::manager::TransportManager::next::{{closure}}
  10: <sc_network::litep2p::Litep2pNetworkBackend as sc_network::service::traits::NetworkBackend<B,H>>::run::{{closure}}
  11: sc_service::build_network_future::{{closure}}::{{closure}}::{{closure}}
  12: <futures_util::future::poll_fn::PollFn<F> as core::future::future::Future>::poll
  13: <sc_service::task_manager::prometheus_future::PrometheusFuture<T> as core::future::future::Future>::poll
  14: <futures_util::future::select::Select<A,B> as core::future::future::Future>::poll
  15: <tracing_futures::Instrumented<T> as core::future::future::Future>::poll
  16: tokio::runtime::park::CachedParkThread::block_on
  17: tokio::runtime::context::runtime::enter_runtime
  18: <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll
  19: tokio::runtime::task::core::Core<T,S>::poll
  20: tokio::runtime::task::harness::Harness<T,S>::poll
  21: tokio::runtime::blocking::pool::Inner::run
  22: std::sys_common::backtrace::__rust_begin_short_backtrace
  23: core::ops::function::FnOnce::call_once{{vtable.shim}}
  24: std::sys::pal::unix::thread::Thread::new::thread_start
  25: start_thread
             at ./nptl/pthread_create.c:442:8
  26: __GI___clone3
             at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81


Thread 'tokio-runtime-worker' panicked at 'to exist', /home/lexnv/.cargo/git/checkouts/litep2p-2515ad90543f141a/eaec7ce/src/transport/webrtc/mod.rs:360

This is a bug. Please report it at:

	https://github.com/paritytech/polkadot-sdk/issues/new

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions