From 3983433a3b93d2662e0baf9875a4d33dec743cbe Mon Sep 17 00:00:00 2001
From: Alexander Bluhm <alexander.bluhm@gmx.net>
Date: Wed, 7 Dec 2016 23:06:13 +0100
Subject: [PATCH] Use special code path for OpenBSD in sndrcv.

On OpenBSD use the non-blocking recv() after select() in sndrcv().
That was already done for FreeBSD and Darwin.  This fixes sniffing
on real hardware with libdnet backend.
---
 scapy/sendrecv.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scapy/sendrecv.py b/scapy/sendrecv.py
index 5f6274b7..000ddf4f 100644
--- a/scapy/sendrecv.py
+++ b/scapy/sendrecv.py
@@ -11,7 +11,7 @@ import errno
 import cPickle,os,sys,time,subprocess
 import itertools
 from select import select
-from scapy.arch.consts import DARWIN, FREEBSD
+from scapy.arch.consts import DARWIN, FREEBSD, OPENBSD
 from scapy.data import *
 from scapy.config import conf
 from scapy.packet import Gen
@@ -132,7 +132,7 @@ def sndrcv(pks, pkt, timeout = None, inter = 0, verbose=None, chainCC=0, retry=0
                                 inp = bpf_select(inmask)
                                 if pks in inp:
                                     r = pks.recv()
-                            elif not isinstance(pks, StreamSocket) and (FREEBSD or DARWIN):
+                            elif not isinstance(pks, StreamSocket) and (FREEBSD or DARWIN or OPENBSD):
                                 inp, out, err = select(inmask,[],[], 0.05)
                                 if len(inp) == 0 or pks in inp:
                                     r = pks.nonblock_recv()
-- 
GitLab