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

Fix bpf ffi and add OpenBSD bpf cfg #421

Merged
merged 1 commit into from
Feb 18, 2021

Conversation

pk-j-xyz
Copy link
Contributor

@pk-j-xyz pk-j-xyz commented Feb 18, 2021

This fixes the as_ptr call which currently is causing a dealloc before the FFI call to libc open. This resulted in a permanent "file not found" when opening any device.

OpenBSD 6.8 amd64. Rust 1.46.0. smoltcp 15f3bc5.

core::ptr::slice_from_raw_parts_mut::h6b6d2aa746578da4 (data=0xc5035c4c420 "/dev/bpf0\000", len=10)
alloc::alloc::dealloc::h4e59c1527d840d21 (ptr=0xc5035c4c420 "/dev/bpf0\000", layout=...)
alloc::alloc::dealloc::h4e59c1527d840d21 (ptr=0xc5035c4c420 '\337' <repeats 32 times>, "\000",
smoltcp::phy::sys::bpf::open_device::h9e20766127888bdc ()
_libc_open_cancel (path=0xc5035c4c420 '\337' <repeats 32 times>, flags=2)

This also adds OpenBSD support by adjusting the existing cfg options in bpf.rs.

Thanks for your work! smoltcp is awesome.

This fixes the ordering that was causing a dealloc before the FFI call
to libc open.
@whitequark whitequark merged commit 68a6147 into smoltcp-rs:master Feb 18, 2021
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.

3 participants