openbsd-ports/emulators/dynamips/patches/patch-gen_eth_c
claudio 52c8bdcac4 Make the gen_eth netio_type work by adding a crude hack in the setup
function to ensure that the pcap fd is in non-blocking mode as expected
by the pthread lib. While doing that add plist bin markers and a new
MESSAGE (that came from sthen@)
OK sthen@, dlg@ who forced me into the pain to run a cisco on my X40
2008-11-24 23:29:48 +00:00

21 lines
772 B
Plaintext

$OpenBSD: patch-gen_eth_c,v 1.1 2008/11/24 23:29:48 claudio Exp $
--- gen_eth.c.orig Sat Nov 22 11:36:00 2008
+++ gen_eth.c Sat Nov 22 11:41:33 2008
@@ -47,6 +47,16 @@ pcap_t *gen_eth_init(char *device)
/* Accept only incoming packets */
pcap_setdirection(p,PCAP_D_IN);
+
+ /*
+ * on OpenBSD we need to force the bpf into non-blocking mode because
+ * userland threads need this (at the same time it will fuckup kthreads).
+ * Now pcap_open_live() would do this but it sets the device to non-blocking
+ * but resets the setting by issuing a BIOCSRTIMEOUT. So force it on again.
+ */
+ if (pcap_setnonblock(p, 1, pcap_errbuf) == -1)
+ goto pcap_error;
+
#else
p = pcap_open(device,2048,
PCAP_OPENFLAG_PROMISCUOUS |