-
Notifications
You must be signed in to change notification settings - Fork 324
MacOS misaligned pointer dereference in DataLinkReceiver with invalid interface #641
Copy link
Copy link
Closed
Description
I am attempting to run the example at https://github.com/libpnet/libpnet/blob/main/examples/arp_packet.rs on MacOS but am getting a misaligned pointer error:
thread 'main' panicked at /Users/tmgross/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pnet_datalink-0.34.0/src/bpf.rs:416:44:
misaligned pointer dereference: address must be a multiple of 0x4 but is 0x7fd3e400ca0e
stack backtrace:
0: rust_begin_unwind
at /rustc/58eefc33adf769a1abe12ad94b3e6811185b4ce5/library/std/src/panicking.rs:617:5
1: core::panicking::panic_nounwind_fmt
at /rustc/58eefc33adf769a1abe12ad94b3e6811185b4ce5/library/core/src/panicking.rs:96:14
2: core::panicking::panic_misaligned_pointer_dereference
at /rustc/58eefc33adf769a1abe12ad94b3e6811185b4ce5/library/core/src/panicking.rs:175:5
3: <pnet_datalink::backend::DataLinkReceiverImpl as pnet_datalink::DataLinkReceiver>::next
at /Users/tmgross/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pnet_datalink-0.34.0/src/bpf.rs:416:44
4: wakeupcall::arp::get_mac_through_arp
at ./src/arp.rs:79:19
5: wakeupcall::arp::scan
at ./src/arp.rs:26:10
I was testing with interface name lo0 so this is probably not an interface that has any useful data anyway, but I would expect this to fail with an error rather than catching a misaligned read.
Compiling in release mode actually seems to make this do the right thing, I get an Err("failure") instead.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels