Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Jul 2009 15:24:07 +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:   Dynamips has two minor bugs.
Message-ID:  <20090719152407.c9f3b912.nork@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

--Multipart=_Sun__19_Jul_2009_15_24_07_+0900_HNiXccZAy.jMgNZB
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Hi Christophe, and FreeBSD's dynamips port maintainer.

	I found two minor bugs.

	1. dynamips -m can't parse Cisco format (0001.0002.0003), because
	   parse_mac_addr() can parse it, but not return(0).  Please see
	   also attached 'patch-net.c'.

	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'.

	   SEE ALSO: http://lists.freebsd.org/pipermail/freebsd-net/2009-July/022423.html


	>> ports maintainers
	May I commit these patch to ports/emulators/dynamips-devel (0.2.8RC2)
	and ports/emulators/dynamips (0.2.7)?

--Multipart=_Sun__19_Jul_2009_15_24_07_+0900_HNiXccZAy.jMgNZB
Content-Type: text/plain;
 name="patch-net.c"
Content-Disposition: attachment;
 filename="patch-net.c"
Content-Transfer-Encoding: 7bit

--- net.c.orig	2007-10-14 17:43:07.000000000 +0900
+++ net.c	2009-07-19 15:03:19.654842448 +0900
@@ -209,6 +209,7 @@ int parse_mac_addr(n_eth_addr_t *addr,ch
       addr->eth_addr_byte[3] = v[1] & 0xFF;
       addr->eth_addr_byte[4] = (v[2] >> 8) & 0xFF;
       addr->eth_addr_byte[5] = v[2] & 0xFF;
+      return(0);
    }
 
    return(-1);

--Multipart=_Sun__19_Jul_2009_15_24_07_+0900_HNiXccZAy.jMgNZB
Content-Type: text/plain;
 name="patch-gen_eth.c"
Content-Disposition: attachment;
 filename="patch-gen_eth.c"
Content-Transfer-Encoding: 7bit

--- gen_eth.c.orig	2007-10-14 17:43:08.000000000 +0900
+++ gen_eth.c	2009-07-19 15:02:43.491124095 +0900
@@ -45,8 +45,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
+   {
+     in on = 1;
+     ioctl(pcap_fileno(p), BIOCFEEDBACK, &on);
+   }
+#endif
 #else
    p = pcap_open(device,2048,
                  PCAP_OPENFLAG_PROMISCUOUS | 

--Multipart=_Sun__19_Jul_2009_15_24_07_+0900_HNiXccZAy.jMgNZB--



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