Dynamips has two minor bugs.

Norikatsu Shigemura nork at FreeBSD.org
Sun Jul 19 06:24:10 UTC 2009


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)?
-------------- next part --------------
--- 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);
-------------- next part --------------
--- 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 | 


More information about the freebsd-emulation mailing list