Skip to content

Commit

Permalink
Open the raw socket with O_NONBLOCK
Browse files Browse the repository at this point in the history
  • Loading branch information
ritikmishra committed Jul 19, 2023
1 parent f9b064a commit ab214a6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/phy/sys/bpf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ fn open_device() -> io::Result<libc::c_int> {
unsafe {
for i in 0..256 {
let dev = format!("/dev/bpf{}\0", i);
match libc::open(dev.as_ptr() as *const libc::c_char, libc::O_RDWR) {
match libc::open(
dev.as_ptr() as *const libc::c_char,
libc::O_RDWR | libc::O_NONBLOCK,
) {
-1 => continue,
fd => return Ok(fd),
};
Expand Down

0 comments on commit ab214a6

Please sign in to comment.