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

phy: fix FaultInjector returning a too big buffer #463

Merged
merged 1 commit into from
Apr 7, 2021

Conversation

Dirbaio
Copy link
Member

@Dirbaio Dirbaio commented Apr 7, 2021

Device impls must return a buffer of the exact requested size. This caused an assertion failure in Interface:

[1617755835.841s] (phy::fault_injector): tx: randomly dropping a packet
thread 'main' panicked at 'assertion failed: tx_buffer.as_ref().len() == tx_len', /home/dirbaio/akiles/smoltcp/src/iface/interface.rs:1553:13
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/core/src/panicking.rs:50:5
   3: smoltcp::iface::interface::InterfaceInner::dispatch_ethernet::{{closure}}
             at ./src/iface/interface.rs:1553:13
   4: <smoltcp::phy::fault_injector::TxToken<Tx> as smoltcp::phy::TxToken>::consume
             at ./src/phy/fault_injector.rs:300:20
   5: smoltcp::iface::interface::InterfaceInner::dispatch_ethernet
             at ./src/iface/interface.rs:1552:9
   6: smoltcp::iface::interface::InterfaceInner::dispatch_ip
             at ./src/iface/interface.rs:1705:17
   7: smoltcp::iface::interface::InterfaceInner::dispatch
             at ./src/iface/interface.rs:1541:17
   8: smoltcp::iface::interface::Interface<DeviceT>::socket_ingress::{{closure}}::{{closure}}
             at ./src/iface/interface.rs:604:37
   9: core::result::Result<T,E>::and_then
             at /home/dirbaio/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:704:22
  10: smoltcp::iface::interface::Interface<DeviceT>::socket_ingress::{{closure}}
             at ./src/iface/interface.rs:594:25
  11: <smoltcp::phy::fault_injector::RxToken<Rx> as smoltcp::phy::RxToken>::consume::{{closure}}
             at ./src/phy/fault_injector.rs:268:17
  12: <smoltcp::phy::tracer::RxToken<Rx> as smoltcp::phy::RxToken>::consume::{{closure}}
             at ./src/phy/tracer.rs:89:13
  13: <smoltcp::phy::pcap_writer::RxToken<Rx,S> as smoltcp::phy::RxToken>::consume::{{closure}}
             at ./src/phy/pcap_writer.rs:189:13
  14: <smoltcp::phy::tuntap_interface::RxToken as smoltcp::phy::RxToken>::consume
             at ./src/phy/tuntap_interface.rs:88:9
  15: <smoltcp::phy::pcap_writer::RxToken<Rx,S> as smoltcp::phy::RxToken>::consume
             at ./src/phy/pcap_writer.rs:183:9
  16: <smoltcp::phy::tracer::RxToken<Rx> as smoltcp::phy::RxToken>::consume
             at ./src/phy/tracer.rs:83:9
  17: <smoltcp::phy::fault_injector::RxToken<Rx> as smoltcp::phy::RxToken>::consume
             at ./src/phy/fault_injector.rs:256:9
  18: smoltcp::iface::interface::Interface<DeviceT>::socket_ingress
             at ./src/iface/interface.rs:590:13
  19: smoltcp::iface::interface::Interface<DeviceT>::poll
             at ./src/iface/interface.rs:527:33
  20: server::main
             at ./examples/server.rs:78:15

@Dirbaio Dirbaio enabled auto-merge April 7, 2021 00:42
@Dirbaio Dirbaio merged commit 09f9418 into master Apr 7, 2021
@Dirbaio Dirbaio deleted the faultinjector-fix branch April 7, 2021 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant