Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Jul 2009 18:07:53 +0900
From:      Norikatsu Shigemura <nork@FreeBSD.org>
To:        Christophe Fillot <cf@utc.fr>
Cc:        Max, freebsd-emulation@FreeBSD.org, Pavel Volkov <pol@opk.ru>, Norikatsu Shigemura <nork@FreeBSD.org>, Khon <fjoe@FreeBSD.org>
Subject:   Re: Dynamips has two minor bugs.
Message-ID:  <20090719180754.eaeebccb.nork@FreeBSD.org>
In-Reply-To: <20090719152407.c9f3b912.nork@FreeBSD.org>
References:  <20090719152407.c9f3b912.nork@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Sun, 19 Jul 2009 15:24:07 +0900
Norikatsu Shigemura <nork@FreeBSD.org> wrote:
> 	2. dynamips can't communicate to real world via FreeBSD's gen_eth
> 	   (libpcap).  In this case, bpf(4) requires BIOCFEEDBACK.  So I
> 	   investigated like attached 'patch-gen_eth.c'.

	Oops, I missed! I re-made a new patch.  Please see attached file.

[-- Attachment #2 --]
--- gen_eth.c.orig	2007-10-14 17:43:08.000000000 +0900
+++ gen_eth.c	2009-07-19 15:46:08.291856897 +0900
@@ -22,6 +22,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/wait.h>
+#include <sys/ioctl.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <pthread.h>
@@ -45,8 +46,13 @@ pcap_t *gen_eth_init(char *device)
    if (!(p = pcap_open_live(device,2048,TRUE,10,pcap_errbuf)))
       goto pcap_error;
 
-   /* Accept only incoming packets */
-   pcap_setdirection(p,PCAP_D_IN);
+   pcap_setdirection(p,PCAP_D_INOUT);
+#ifdef BIOCFEEDBACK
+   {
+     int on = 1;
+     ioctl(pcap_fileno(p), BIOCFEEDBACK, &on);
+   }
+#endif
 #else
    p = pcap_open(device,2048,
                  PCAP_OPENFLAG_PROMISCUOUS | 

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090719180754.eaeebccb.nork>