[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r20343: {torvm} Update Tor to 0.2.1.19, Qemu to 0.10.5, TorButton to 1.2.2, (in torvm/trunk: . build/kamikaze/common build/kamikaze/patches build/win32 build/win32/files build/win32/patches build/win32/src/torvm-w32)



Author: coderman
Date: 2009-08-20 05:05:44 -0400 (Thu, 20 Aug 2009)
New Revision: 20343

Added:
   torvm/trunk/build/win32/patches/qemu-winpcap.patch
Removed:
   torvm/trunk/build/win32/patches/qemu-winpcap-0.9.1.patch
Modified:
   torvm/trunk/Makefile
   torvm/trunk/build/kamikaze/common/pkg-cache.mk
   torvm/trunk/build/kamikaze/patches/001-kamikaze-tor-package.patch
   torvm/trunk/build/kamikaze/patches/003-kamikaze-kernel-config.patch
   torvm/trunk/build/win32/Makefile
   torvm/trunk/build/win32/files/buildall.sh
   torvm/trunk/build/win32/patches/qemu-kernel-cmdline-from-stdin.patch
   torvm/trunk/build/win32/src/torvm-w32/torvm.c
Log:
Update Tor to 0.2.1.19, Qemu to 0.10.5, TorButton to 1.2.2, and pycrypto git. Add support for GeoIP file to Tor inside the VM as well.

Modified: torvm/trunk/Makefile
===================================================================
--- torvm/trunk/Makefile	2009-08-20 04:16:47 UTC (rev 20342)
+++ torvm/trunk/Makefile	2009-08-20 09:05:44 UTC (rev 20343)
@@ -84,7 +84,7 @@
 	@if [ ! -f .build_prereqs_verified ]; then \
 		echo "Verifying build prerequisites ..." >&2; \
 		NOFOUND=""; \
-		REQS="make gcc g++ gawk bison flex unzip bzip2 patch perl wget tar svn git autoconf mkisofs md5sum"; \
+		REQS="make gcc g++ gawk bison flex unzip bzip2 patch perl wget tar svn git autoconf mkisofs md5sum cut"; \
 		for REQ in $$REQS; do \
 			which $$REQ >/dev/null 2>&1; \
 			if (( $$? != 0 )); then \

Modified: torvm/trunk/build/kamikaze/common/pkg-cache.mk
===================================================================
--- torvm/trunk/build/kamikaze/common/pkg-cache.mk	2009-08-20 04:16:47 UTC (rev 20342)
+++ torvm/trunk/build/kamikaze/common/pkg-cache.mk	2009-08-20 09:05:44 UTC (rev 20343)
@@ -128,9 +128,9 @@
 OPENSSL_URL=http://www.openssl.org/source/$(OPENSSL_F)
 OPENSSL_SUM=7e7cd4f3974199b729e6e3a0af08bd4279fde0370a1120c1a3b351ab090c6101
 
-TOR_F=tor-0.2.1.17-rc.tar.gz
+TOR_F=tor-0.2.1.19.tar.gz
 TOR_URL=http://www.torproject.org/dist/$(TOR_F)
-TOR_SUM=89d4d16865374c80419ec93abccf49bef4ad81fd869cb0cf7b83b00ddabc3fdb
+TOR_SUM=cb4f88ad30d6ba4c015734f3058a6e35151cff586f7708691d52d289ee78d183
 
 
 

Modified: torvm/trunk/build/kamikaze/patches/001-kamikaze-tor-package.patch
===================================================================
--- torvm/trunk/build/kamikaze/patches/001-kamikaze-tor-package.patch	2009-08-20 04:16:47 UTC (rev 20342)
+++ torvm/trunk/build/kamikaze/patches/001-kamikaze-tor-package.patch	2009-08-20 09:05:44 UTC (rev 20343)
@@ -314,8 +314,8 @@
 +
 diff -Naur a/package/tor/files/tor.init b/package/tor/files/tor.init
 --- a/package/tor/files/tor.init	1970-01-01 00:00:00.000000000 +0000
-+++ b/package/tor/files/tor.init	2009-07-24 12:19:57.898944904 +0000
-@@ -0,0 +1,147 @@
++++ b/package/tor/files/tor.init	2009-08-19 00:59:09.853905297 +0000
+@@ -0,0 +1,150 @@
 +#!/bin/sh 
 +# make sure we check the system bin dirs
 +export PATH=/usr/sbin:/sbin:$PATH
@@ -323,7 +323,7 @@
 +DEFAULT=/etc/default/$BIN
 +HOME_D=/home/$BIN
 +CONF_F=$HOME_D/torrc
-+GEOIP_F=$HOME_D/geoip
++GEOIP_F=/rofs/GEOIP.TXT
 +LOG_D=/var/log/$BIN
 +LOG_F=$LOG_D/notices.log
 +SLOG_F=$LOG_D/start.log
@@ -390,6 +390,9 @@
 +	  echo "SocksPort $TOR_SOCKSPORT" >> $TMP_F; \
 +	  mv -f $TMP_F $CONF_F; \
 +	fi; \
++	if [ -f $GEOIP_F ]; then \
++		echo "GeoIPFile $GEOIP_F" >> $CONF_F; \
++	fi; \
 +	chown $RUN_USER:$RUN_GROUP $CONF_F ; \
 +        vmr_fwdadd $TOR_INT
 +        vmr_opentcp $TOR_INTF $MYIP $CTLPORT
@@ -491,8 +494,8 @@
 +TransListenAddress 0.0.0.0
 diff -Naur a/package/tor/files/torvminit b/package/tor/files/torvminit
 --- a/package/tor/files/torvminit	1970-01-01 00:00:00.000000000 +0000
-+++ b/package/tor/files/torvminit	2009-07-18 09:37:22.267830591 +0000
-@@ -0,0 +1,256 @@
++++ b/package/tor/files/torvminit	2009-08-19 09:11:07.321473102 +0000
+@@ -0,0 +1,267 @@
 +#!/bin/sh
 +# Copyright (C) 2008-2009  The Tor Project, Inc.
 +# See LICENSE file for rights and terms.
@@ -594,6 +597,17 @@
 +  sleep 3
 +fi
 +
++# if a read-only directory is available to mount from host OS mnt it too.
++rofsdev=/dev/hdc1
++rofsopt="-oro,noexec,nodev"
++if [ -e $rofsdev ]; then
++  mkdir /rofs
++  mount $rofsopt $rofsdev /rofs 
++  if [ $? -ne 0 ]; then
++    rmdir /rofs
++  fi
++fi
++
 +mkdir -p /var/run
 +mkdir -p /var/log
 +mkdir -p /var/lock
@@ -751,7 +765,7 @@
 +fi
 diff -Naur a/package/tor/files/vmrouter.sh b/package/tor/files/vmrouter.sh
 --- a/package/tor/files/vmrouter.sh	1970-01-01 00:00:00.000000000 +0000
-+++ b/package/tor/files/vmrouter.sh	2009-07-24 12:17:59.397042898 +0000
++++ b/package/tor/files/vmrouter.sh	2009-08-19 09:11:53.693450376 +0000
 @@ -0,0 +1,153 @@
 +#!/bin/bash
 +# Utility script for Tor VM routing

Modified: torvm/trunk/build/kamikaze/patches/003-kamikaze-kernel-config.patch
===================================================================
--- torvm/trunk/build/kamikaze/patches/003-kamikaze-kernel-config.patch	2009-08-20 04:16:47 UTC (rev 20342)
+++ torvm/trunk/build/kamikaze/patches/003-kamikaze-kernel-config.patch	2009-08-20 09:05:44 UTC (rev 20343)
@@ -1,6 +1,6 @@
 diff -Naur a/target/linux/x86/config-2.6.28 b/target/linux/x86/config-2.6.28
 --- a/target/linux/x86/config-2.6.28	2009-05-15 10:40:04.149461000 +0000
-+++ b/target/linux/x86/config-2.6.28	2009-05-31 22:30:50.832743731 +0000
++++ b/target/linux/x86/config-2.6.28	2009-08-20 05:43:28.977447720 +0000
 @@ -2,7 +2,6 @@
  CONFIG_4KSTACKS=y
  # CONFIG_60XX_WDT is not set
@@ -368,7 +368,7 @@
  CONFIG_X86_RESERVE_LOW_64K=y
  # CONFIG_X86_SPEEDSTEP_CENTRINO is not set
  # CONFIG_X86_SPEEDSTEP_ICH is not set
-@@ -392,6 +433,240 @@
+@@ -392,6 +433,241 @@
  CONFIG_X86_UP_APIC=y
  CONFIG_X86_UP_IOAPIC=y
  CONFIG_X86_VERBOSE_BOOTUP=y
@@ -553,7 +553,7 @@
 +CONFIG_INOTIFY=y
 +CONFIG_INOTIFY_USER=y
 +CONFIG_ISO9660_FS=y
-+# CONFIG_VFAT_FS is not set
++CONFIG_VFAT_FS=y
 +# CONFIG_JFFS2_FS is not set
 +# CONFIG_JFFS2_CMODE_PRIORITY is not set
 +# CONFIG_SQUASHFS is not set
@@ -563,6 +563,7 @@
 +CONFIG_NLS_ASCII=y
 +CONFIG_NLS_ISO8859_1=y
 +CONFIG_NLS_UTF8=y
++CONFIG_NLS_CODEPAGE_437=y
 +# CONFIG_DEBUG_FS is not set
 +# CONFIG_SYSCTL_SYSCALL_CHECK is not set
 +# CONFIG_X86_VERBOSE_BOOTUP is not set

Modified: torvm/trunk/build/win32/Makefile
===================================================================
--- torvm/trunk/build/win32/Makefile	2009-08-20 04:16:47 UTC (rev 20342)
+++ torvm/trunk/build/win32/Makefile	2009-08-20 09:05:44 UTC (rev 20343)
@@ -192,9 +192,9 @@
 WPCAPSRC_URL=http://www.winpcap.org/install/bin/$(WPCAPSRC_F)
 WPCAPSRC_SUM=9e147ff344141da0ac76e71c31be7a8036ccba6030adfe208f27a97b793a9299
 
-QEMU_F=qemu-0.9.1.tar.gz
-QEMU_URL=http://bellard.org/qemu/$(QEMU_F)
-QEMU_SUM=4756d0b4a4dc7dd88354bc6b37d381e4462dd328d0feef94803e90c0455835a5
+QEMU_F=qemu-0.10.5.tar.gz
+QEMU_URL=http://download.savannah.gnu.org/releases/qemu/$(QEMU_F)
+QEMU_SUM=d54f268f5545dd182d96c1b09e79af58efaf2e51695efd1331d560a552d657c1
 
 OVPN_F=openvpn-2.1_rc15.tar.gz
 OVPN_URL=http://openvpn.net/release/$(OVPN_F)
@@ -213,10 +213,10 @@
 POLIPO_URL=http://www.pps.jussieu.fr/~jch/software/files/polipo/$(POLIPO_F)
 POLIPO_SUM=c4c8b6f4d32e6d17e71160f2d4683a3ac444c81de321eeb1394a5575d973a200
 
-TORBUTTON_XPI_VER=1.2.1
+TORBUTTON_XPI_VER=1.2.2
 TORBUTTON_XPI_F=torbutton-$(TORBUTTON_XPI_VER)-fx.xpi
 TORBUTTON_XPI_URL=http://releases.mozilla.org/pub/mozilla.org/addons/2275/$(TORBUTTON_XPI_F)
-TORBUTTON_XPI_SUM=9d2ae4f1bcc272ae6360087df483ed3f46bb9b06948104e19203dbed75ba242e
+TORBUTTON_XPI_SUM=d08fa9c1efc0203b5cf9c3fbc551dc158963821b45f1e9fe5763427332e00192
 
 MARBLE_NAME=marble-latest
 MARBLE_TGZ=$(MARBLE_NAME).tar.gz
@@ -230,23 +230,25 @@
 VIDALIA_BR=trunk
 VIDALIA_VER=3730
 
-# for package resources
 TORSRC_NAME=tor-latest
 TORSRC_TGZ=$(TORSRC_NAME).tar.gz
 TORSRC_GIT=git://git.torproject.org/git/tor
-TORSRC_VER=358efe1eea9be4c0e1c5e0e5e90dfb2cb0e24235
+TORSRC_VER=b9e45cc508b6fbf596e1ba40761e11d0629a3291
 
+GEOIP_F=ip-to-country.csv.zip
+GEOIP_URL=http://ip-to-country.webhosting.info/downloads/$(GEOIP_F)
+GEOIP_SUM=cb5234a10504ba2b243fb5b8f59693245ca952d42883cb3191c3287839cc1c1f
+
 TORBUTTON_NAME=torbutton-latest
 TORBUTTON_TGZ=$(TORBUTTON_NAME).tar.gz
 TORBUTTON_SVN=https://tor-svn.freehaven.net/svn/torbutton/
 TORBUTTON_BR=trunk
-TORBUTTON_VER=19101
+TORBUTTON_VER=20331
 
-# XXX add / switch to signed tags one key mgmt resolved
 PYCRYPTO_NAME=pycrypto-latest
 PYCRYPTO_TGZ=$(PYCRYPTO_NAME).tar.gz
 PYCRYPTO_GIT=git://git.pycrypto.org:9419/crypto/pycrypto-2.x.git
-PYCRYPTO_VER=d1c4875e1f220652fe7ff8358f56dee3b2aba31b
+PYCRYPTO_VER=812e01736ca936124daa36d15a4159e92a43b9db
 
 THANDY_NAME=thandy-latest
 THANDY_TGZ=$(THANDY_NAME).tar.gz
@@ -259,7 +261,7 @@
 
 CACHE_URL_BASE=http://data.peertech.org/pkgcache
 
-ALLPKGNAMES=ZLIB GZIP BZIP2 LIBARCH BINUTILS GCCORE GPP MINGWRUN MINGWUTIL MAKE W32API MSYSCORE LIBTOOL MINIRES MSYSZLIB MSYSCRYPT MSYSSSL MSYSSSH ZLIBSRC PTHREADS LIBEVENT AMAKE ACONF PERL GROFF CMAKE QT NSIS SSLSRC PYTHON PY2EXE WIX WIXSRC GNURX POLIPO SDL WPCAPSRC QEMU TORBUTTON_XPI OVPN
+ALLPKGNAMES=ZLIB GZIP BZIP2 LIBARCH BINUTILS GCCORE GPP MINGWRUN MINGWUTIL MAKE W32API MSYSCORE LIBTOOL MINIRES MSYSZLIB MSYSCRYPT MSYSSSL MSYSSSH ZLIBSRC PTHREADS LIBEVENT AMAKE ACONF PERL GROFF CMAKE QT NSIS SSLSRC PYTHON PY2EXE WIX WIXSRC GNURX POLIPO SDL WPCAPSRC QEMU TORBUTTON_XPI OVPN GEOIP
 
 # adjust if we're dealing with non source, zip or tar archives for a package
 SEVNZIP_OPT_DL=
@@ -392,6 +394,10 @@
 		( cd $(TORBUTTON_NAME); $(SHELL) makexpi.sh ; ); \
 		mv $(TORBUTTON_NAME)/pkg/*.xpi $(ISODIR)/dl/src/torbutton.xpi ; rm -rf $(TORBUTTON_NAME); \
 	fi; \
+	if [ -f $(WDLDIR)/$(GEOIP_F) ]; then \
+		echo "--- Creating Tor GEOIP file from $(GEOIP_F) source ..."; \
+		$(UNZIP) $(WDLDIR)/$(GEOIP_F) -d tmp; cat tmp/*.csv | cut -d, -f1-3 | sed 's/"//g' > $(ISODIR)/dl/geoip.txt; rm -rf tmp; rm $(ISODIR)/dl/$(GEOIP_F); \
+	fi; \
 	echo "--- Creating source archives from win32 tree ..."; \
 	( cd src && tar zcf ../$(ISODIR)/dl/src/torvm-w32.tgz torvm-w32 ); \
 	( cd src && tar zcf ../$(ISODIR)/dl/src/pkg.tgz pkg ); \

Modified: torvm/trunk/build/win32/files/buildall.sh
===================================================================
--- torvm/trunk/build/win32/files/buildall.sh	2009-08-20 04:16:47 UTC (rev 20342)
+++ torvm/trunk/build/win32/files/buildall.sh	2009-08-20 09:05:44 UTC (rev 20343)
@@ -113,7 +113,7 @@
   export WPCAP_INCLUDE="-I/src/${WPCAP_DIR}/wpcap/libpcap -I/src/${WPCAP_DIR}/wpcap/libpcap/Win32/Include"
   export WPCAP_LDFLAGS="-L/src/${WPCAP_DIR}/wpcap/PRJ -L/src/${WPCAP_DIR}/packetNtx/Dll/Project"
 
-  export QEMU_VER=0.9.1
+  export QEMU_VER=0.10.5
   export QEMU_DIR="qemu-${QEMU_VER}"
   export QEMU_FILE="${QEMU_DIR}.tar.gz"
 
@@ -232,7 +232,7 @@
     chmod 600 ~/.ssh/id_rsa >/dev/null 2>&1
   fi
 
-  for dir in $ddir $bdlibdir $bindir $statedir $brootdir $instdir $thandir $bundledir $licensedir; do
+  for dir in $ddir $bdlibdir $bindir $statedir $statedir/rofs $brootdir $instdir $thandir $bundledir $licensedir; do
     if [ ! -d $dir ]; then
       mkdir -p $dir
     fi
@@ -540,7 +540,7 @@
     echo "ERROR: Qemu cmdline via stdin patch failed." >&2
     exit 1
   fi
-  patch -p1 < ../qemu-winpcap-0.9.1.patch 2> /dev/null
+  patch -p1 < ../qemu-winpcap.patch 2> /dev/null
   if (( $? != 0 )); then
     echo "ERROR: Qemu winpcap patch failed." >&2
     exit 1
@@ -551,10 +551,10 @@
     --disable-system \
     --disable-kqemu \
     --disable-vnc-tls \
-    --extra-cflags="-DHAVE_INTSZ_TYPES -I. -I.. -I/src/$ZLIB_DIR -I/usr/include -I/usr/local/include $WPCAP_INCLUDE -I/src/pthreads-w32 -I/usr/include/SDL" \
+    --disable-bluez \
+    --extra-cflags="-I. -I.. -I/src/$ZLIB_DIR -I/usr/include -I/usr/local/include $WPCAP_INCLUDE -I/src/pthreads-w32 -I/usr/include/SDL" \
     --extra-ldflags="-L/src/$ZLIB_DIR -L/usr/lib -L/usr/local/lib $WPCAP_LDFLAGS -L/src/pthreads-w32" \
-    --target-list=i386-softmmu \
-    --enable-mingw32 --cross-prefix=""
+    --target-list=i386-softmmu 
   if (( $? != 0 )); then
     echo "ERROR: Qemu configure failed." >&2
     exit 1

Modified: torvm/trunk/build/win32/patches/qemu-kernel-cmdline-from-stdin.patch
===================================================================
--- torvm/trunk/build/win32/patches/qemu-kernel-cmdline-from-stdin.patch	2009-08-20 04:16:47 UTC (rev 20342)
+++ torvm/trunk/build/win32/patches/qemu-kernel-cmdline-from-stdin.patch	2009-08-20 09:05:44 UTC (rev 20343)
@@ -1,7 +1,7 @@
-diff -Naur orig-qemu-0.9.1/vl.c mod-qemu-0.9.1/vl.c
---- orig-qemu-0.9.1/vl.c	2008-01-06 19:38:42.000000000 +0000
-+++ mod-qemu-0.9.1/vl.c	2008-08-23 05:07:36.576478509 +0000
-@@ -7582,6 +7582,7 @@
+diff -Naur a/vl.c b/vl.c
+--- a/vl.c	2009-05-20 20:47:01.000000000 +0000
++++ b/vl.c	2009-08-19 10:07:39.161453868 +0000
+@@ -4042,6 +4042,7 @@
             "Linux boot specific:\n"
             "-kernel bzImage use 'bzImage' as kernel image\n"
             "-append cmdline use 'cmdline' as kernel command line\n"
@@ -9,23 +9,23 @@
             "-initrd file    use 'file' as initial ram disk\n"
             "\n"
             "Debug/Expert options:\n"
-@@ -7719,6 +7720,7 @@
-     QEMU_OPTION_old_param,
-     QEMU_OPTION_clock,
-     QEMU_OPTION_startdate,
+@@ -4182,6 +4183,7 @@
+     /* Linux boot specific: */
+     QEMU_OPTION_kernel,
+     QEMU_OPTION_append,
 +    QEMU_OPTION_appendstdin,
- };
+     QEMU_OPTION_initrd,
  
- typedef struct QEMUOption {
-@@ -7827,6 +7829,7 @@
- #endif
-     { "clock", HAS_ARG, QEMU_OPTION_clock },
-     { "startdate", HAS_ARG, QEMU_OPTION_startdate },
+     /* Debug/Expert options: */
+@@ -4302,6 +4304,7 @@
+     /* Linux boot specific: */
+     { "kernel", HAS_ARG, QEMU_OPTION_kernel },
+     { "append", HAS_ARG, QEMU_OPTION_append },
 +    { "appendstdin", 0, QEMU_OPTION_appendstdin },
-     { NULL },
- };
+     { "initrd", HAS_ARG, QEMU_OPTION_initrd },
  
-@@ -7869,6 +7872,29 @@
+     /* Debug/Expert options: */
+@@ -4532,6 +4535,29 @@
      }
  }
  
@@ -52,10 +52,10 @@
 +    return parms;
 +}
 +
- /* XXX: currently we cannot use simultaneously different CPUs */
- static void register_machines(void)
+ #ifdef _WIN32
+ static BOOL WINAPI qemu_ctrl_handler(DWORD type)
  {
-@@ -8316,6 +8342,13 @@
+@@ -4861,6 +4887,13 @@
              case QEMU_OPTION_append:
                  kernel_cmdline = optarg;
                  break;
@@ -67,5 +67,5 @@
 +                }
 +                break;
              case QEMU_OPTION_cdrom:
- 		drive_add("file=\"%s\"," CDROM_ALIAS, optarg);
+                 drive_add(optarg, CDROM_ALIAS);
                  break;

Deleted: torvm/trunk/build/win32/patches/qemu-winpcap-0.9.1.patch
===================================================================
--- torvm/trunk/build/win32/patches/qemu-winpcap-0.9.1.patch	2009-08-20 04:16:47 UTC (rev 20342)
+++ torvm/trunk/build/win32/patches/qemu-winpcap-0.9.1.patch	2009-08-20 09:05:44 UTC (rev 20343)
@@ -1,392 +0,0 @@
-diff -Naur a/Makefile.target b/Makefile.target
---- a/Makefile.target	2008-01-06 19:38:41.000000000 +0000
-+++ b/Makefile.target	2009-05-04 18:27:30.000000000 +0000
-@@ -237,7 +237,7 @@
- LIBS+=-lz
- endif
- ifdef CONFIG_WIN32
--LIBS+=-lwinmm -lws2_32 -liphlpapi
-+LIBS+=-lwinmm -lws2_32 -liphlpapi -lpthreadGC2 -ltorpkt -ltorpcap
- endif
- ifdef CONFIG_SOLARIS
- LIBS+=-lsocket -lnsl -lresolv
-diff -Naur a/configure b/configure
---- a/configure	2008-01-06 19:38:42.000000000 +0000
-+++ b/configure	2008-11-30 09:35:06.914417288 +0000
-@@ -600,7 +600,7 @@
- #undef main /* We don't want SDL to override our main() */
- int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
- EOF
--        if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp/qemu-$$-sdl-config.log ; then
-+        if $cc -o $TMPE ${OS_CFLAGS} ${CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC ${LDFLAGS} `$sdl_config --libs 2> /dev/null` 2> /tmp/qemu-$$-sdl-config.log ; then
-             _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
-             if test "$_sdlversion" -lt 121 ; then
-                 sdl_too_old=yes
-@@ -883,7 +883,10 @@
- fi
- if test "$slirp" = "yes" ; then
-   echo "CONFIG_SLIRP=yes" >> $config_mak
-+  echo "CONFIG_PCAP=yes" >> $config_mak
-+  echo "PCAP_LIBS=-lpthreadGC2 -lpacket -lwpcap" >> $config_mak
-   echo "#define CONFIG_SLIRP 1" >> $config_h
-+  echo "#define CONFIG_PCAP 1" >> $config_h
- fi
- if test "$adlib" = "yes" ; then
-   echo "CONFIG_ADLIB=yes" >> $config_mak
-diff -Naur a/dyngen-exec.h b/dyngen-exec.h
---- a/dyngen-exec.h	2008-01-06 19:38:42.000000000 +0000
-+++ b/dyngen-exec.h	2008-11-30 09:35:06.915417136 +0000
-@@ -32,6 +32,7 @@
-    host headers do not allow that. */
- #include <stddef.h>
- 
-+#ifndef HAVE_INTSZ_TYPES
- typedef unsigned char uint8_t;
- typedef unsigned short uint16_t;
- typedef unsigned int uint32_t;
-@@ -62,9 +63,6 @@
- #endif
- #endif
- 
--/* XXX: This may be wrong for 64-bit ILP32 hosts.  */
--typedef void * host_reg_t;
--
- #define INT8_MIN		(-128)
- #define INT16_MIN		(-32767-1)
- #define INT32_MIN		(-2147483647-1)
-@@ -78,6 +76,11 @@
- #define UINT32_MAX		(4294967295U)
- #define UINT64_MAX		((uint64_t)(18446744073709551615))
- 
-+#endif /* HAVE_INTSZ_TYPES */
-+
-+/* XXX: This may be wrong for 64-bit ILP32 hosts.  */
-+typedef void * host_reg_t;
-+
- #ifdef _BSD
- typedef struct __sFILE FILE;
- #else
-diff -Naur a/vl.c b/vl.c
---- a/vl.c	2008-01-06 19:38:42.000000000 +0000
-+++ b/vl.c	2009-05-04 18:27:30.000000000 +0000
-@@ -3858,6 +3858,263 @@
- 
- #endif /* CONFIG_SLIRP */
- 
-+/////////////////////////////////////////////////////////////////////////////
-+#ifdef CONFIG_PCAP
-+#define HAVE_U_INT8_T
-+#define HAVE_U_INT16_T
-+#define HAVE_U_INT32_T
-+#define HAVE_U_INT64_T
-+#include <pcap.h>
-+#include <string.h>
-+char pcap_devicename[64];
-+
-+#if defined(_WIN32)
-+#include <winreg.h>
-+#endif
-+
-+#include <pthread.h>
-+
-+static VLANClientState *pcap_vc;
-+pcap_t* pcaphandle;
-+static void pcap_receive(void *opaque, const uint8_t *buf, int size);
-+void eth_callback(u_char *user, const struct pcap_pkthdr *phdr, const u_char *pdata);
-+void *pcap_send(void *threadid);
-+int eth_open(char* name);
-+
-+#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
-+#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
-+#define DEVICE_PREFIX "\\Device\\TORNPF_"
-+#define NETGUIDLEN 38
-+
-+static int get_net_device_guid(
-+    char *name,
-+    int name_size,
-+    char *actual_name,
-+    int actual_name_size)
-+{
-+    LONG status;
-+    HKEY control_net_key;
-+    DWORD len;
-+    int i = 0;
-+    int stop = 0;
-+
-+    status = RegOpenKeyEx(
-+        HKEY_LOCAL_MACHINE,
-+        NETWORK_CONNECTIONS_KEY,
-+        0,
-+        KEY_READ,
-+        &control_net_key);
-+
-+    if (status != ERROR_SUCCESS) {
-+        return -1;
-+    }
-+
-+    while (!stop)
-+    {
-+        char enum_name[256];
-+        char connection_string[256];
-+        HKEY connection_key;
-+        char name_data[256];
-+        DWORD name_type;
-+        const char name_string[] = "Name";
-+
-+        len = sizeof (enum_name);
-+        status = RegEnumKeyEx(
-+            control_net_key,
-+            i,
-+            enum_name,
-+            &len,
-+            NULL,
-+            NULL,
-+            NULL,
-+            NULL);
-+
-+        if (status == ERROR_NO_MORE_ITEMS)
-+            break;
-+        else if (status != ERROR_SUCCESS) {
-+            return -1;
-+        }
-+
-+        snprintf(connection_string,
-+             sizeof(connection_string),
-+             "%s\\%s\\Connection",
-+             NETWORK_CONNECTIONS_KEY, enum_name);
-+
-+        status = RegOpenKeyEx(
-+            HKEY_LOCAL_MACHINE,
-+            connection_string,
-+            0,
-+            KEY_READ,
-+            &connection_key);
-+
-+        if (status == ERROR_SUCCESS) {
-+            len = sizeof (name_data);
-+            status = RegQueryValueEx(
-+                connection_key,
-+                name_string,
-+                NULL,
-+                &name_type,
-+                name_data,
-+                &len);
-+
-+            if (status != ERROR_SUCCESS || name_type != REG_SZ) {
-+                    return -1;
-+            }
-+            else {
-+                if (actual_name) {
-+                    if (strcmp(name, name_data) != 0) {
-+                        fprintf(stderr, "pcap: %s does not match requested %s (guid: %s)\n", name, name_data, enum_name);
-+                        RegCloseKey (connection_key);
-+                        ++i;
-+                        continue;
-+                    }
-+                    else {
-+                        snprintf(actual_name, actual_name_size, "%s%s", DEVICE_PREFIX, enum_name);
-+                        fprintf(stderr, "pcap: matched requested %s to guid: %s\n\tpcap open devname: %s", name_data, enum_name, actual_name);
-+                    }
-+                }
-+                stop = 1;
-+            }
-+
-+            RegCloseKey (connection_key);
-+        }
-+        ++i;
-+    }
-+
-+    RegCloseKey (control_net_key);
-+
-+    if (stop == 0)
-+        return -1;
-+
-+    return 0;
-+}
-+
-+static int net_pcap_init(VLANState *vlan)
-+{
-+    pcap_vc = qemu_new_vlan_client(vlan,pcap_receive,NULL,NULL);
-+    snprintf(pcap_vc->info_str,sizeof(pcap_vc->info_str),"pcap redirector");
-+    char dev_guid[256];
-+    *dev_guid = 0;
-+
-+    /* we don't have strnlen??? */
-+    pcap_devicename[sizeof(pcap_devicename)-1] = 0;
-+
-+    /* accept passing a GUID instead of name, which is more precise.  there is a known
-+     * issue with disabled adapters sharing names of active ones leading to open failure.
-+     */
-+    if ( (strlen(pcap_devicename) == NETGUIDLEN) && (*pcap_devicename == '{') ) {
-+        snprintf(dev_guid, sizeof(dev_guid), "%s%s", DEVICE_PREFIX, pcap_devicename);
-+        /* fprintf(stderr, "qemu: pcap bridge using explicit device guid: %s\n", dev_guid); */
-+    }
-+    else {
-+        if (get_net_device_guid (pcap_devicename, sizeof(pcap_devicename), dev_guid, sizeof(dev_guid))) {
-+            fprintf(stderr, "qemu: could not set up pcap bridge to alias: %s\n", pcap_devicename);
-+            exit(1);
-+        }
-+    }
-+    /* either this works or we exit. don't bother with retval */
-+    eth_open(dev_guid);
-+
-+    pthread_attr_t attr;
-+    pthread_t threads;
-+    int rc;
-+    rc=pthread_create (&threads,NULL,pcap_send,NULL);
-+    pthread_attr_destroy(&attr);
-+    return 0;
-+}
-+
-+static void pcap_receive(void *opaque, const uint8_t *buf, int size)
-+{
-+    pcap_sendpacket((pcap_t*)pcaphandle, (u_char*)buf, size);
-+}
-+
-+void *pcap_send(void *threadid)
-+{
-+    struct timeval timeout;
-+    timeout.tv_sec = 0;
-+    timeout.tv_usec = 200*1000;
-+    int status;
-+
-+    while(pcaphandle)
-+    {
-+        fd_set setl;
-+        FD_ZERO(&setl);
-+        status = pcap_dispatch((pcap_t*)pcaphandle, 1, &eth_callback, NULL);
-+    }
-+    return NULL;
-+}
-+
-+void eth_callback(u_char *user, const struct pcap_pkthdr *phdr, const u_char *pdata)
-+{
-+    if(phdr->len<1501)
-+    {
-+        qemu_send_packet(pcap_vc, pdata, phdr->len);
-+    }
-+}
-+
-+/* bad winpcap api only sets these when remote-pcap is enabled. */
-+#define PCAP_OPENFLAG_PROMISCUOUS 1
-+#define PCAP_OPENFLAG_NOCAPTURE_LOCAL 8
-+#define PCAP_READ_TIMEOUT 15
-+
-+int eth_open(char* name)
-+{
-+    const int bufsz = 1520;
-+    char errbuf[PCAP_ERRBUF_SIZE];
-+    char* msg;
-+
-+    /* attempt to connect device */
-+    memset(errbuf, 0, sizeof(errbuf));
-+    pcaphandle = (void*) pcap_open_live(name,
-+                                        bufsz,
-+                                        PCAP_OPENFLAG_PROMISCUOUS | PCAP_OPENFLAG_NOCAPTURE_LOCAL,
-+                                        PCAP_READ_TIMEOUT,
-+                                        errbuf);
-+    if (!pcaphandle) { /* try non-promisc open device */
-+        pcaphandle = (void*) pcap_open_live(name,
-+                                            bufsz,
-+                                            PCAP_OPENFLAG_NOCAPTURE_LOCAL,
-+                                            PCAP_READ_TIMEOUT,
-+                                            errbuf);
-+        if (!pcaphandle) { /* cannot open device */
-+            msg = "Eth: pcap_open_live error for device %s - %s\r\n";
-+            fprintf (stderr, msg, name, errbuf);
-+            exit (1);
-+        }
-+        msg = "Eth: opened non-promisc %s\r\n";
-+        /* fprintf (stderr, msg, name); */
-+    } else {
-+        msg = "Eth: opened promisc %s\r\n";
-+        /* fprintf (stderr, msg, name); */
-+    }
-+
-+#if defined (USE_READER_THREAD)
-+    {
-+        pthread_attr_t attr;
-+
-+        ethq_init (&dev->read_queue, 200); /* initialize FIFO queue */
-+        pthread_mutex_init (&dev->lock, NULL);
-+        pthread_attr_init(&attr);
-+        pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
-+        pthread_create (&dev->reader_thread, &attr, _pcap_send, (void *)dev);
-+        pthread_attr_destroy(&attr);
-+    }
-+#else /* !defined (USE_READER_THREAD */
-+#ifdef USE_SETNONBLOCK
-+    /* set ethernet device non-blocking so pcap_dispatch() doesn't hang */
-+    if (pcap_setnonblock (dev->pcaphandle, 1, errbuf) == -1) {
-+        msg = "Eth: Failed to set non-blocking: %s\r\n";
-+        printf (msg, errbuf);
-+    }
-+#endif
-+#endif /* !defined (USE_READER_THREAD */
-+    return 0;
-+}
-+#endif //CONFIG_PCAP
-+//////////////////////////////////////////////////////////////////////////////
-+
-+/////////////////////////////////////////////////////////////////////////////
-+
- #if !defined(_WIN32)
- 
- typedef struct TAPState {
-@@ -4733,6 +4990,14 @@
-         ret = net_slirp_init(vlan);
-     } else
- #endif
-+#ifdef CONFIG_PCAP
-+if (!strcmp(device, "pcap")) {
-+       if (get_param_value(buf, sizeof(buf),"devicename",p)){
-+               pstrcpy(pcap_devicename,sizeof(pcap_devicename),buf);
-+       }
-+ret = net_pcap_init(vlan);
-+} else
-+#endif
- #ifdef _WIN32
-     if (!strcmp(device, "tap")) {
-         char ifname[64];
-@@ -7551,6 +7816,9 @@
-            "                connect the user mode network stack to VLAN 'n' and send\n"
-            "                hostname 'host' to DHCP clients\n"
- #endif
-+#ifdef CONFIG_PCAP
-+              "-net pcap[,vlan=n],devicename=name\n"
-+#endif
- #ifdef _WIN32
-            "-net tap[,vlan=n],ifname=name\n"
-            "                connect the host TAP network interface to VLAN 'n'\n"
-@@ -7656,9 +7924,6 @@
-     QEMU_OPTION_pflash,
-     QEMU_OPTION_boot,
-     QEMU_OPTION_snapshot,
--#ifdef TARGET_I386
--    QEMU_OPTION_no_fd_bootchk,
--#endif
-     QEMU_OPTION_m,
-     QEMU_OPTION_nographic,
-     QEMU_OPTION_portrait,
-@@ -7746,9 +8011,6 @@
-     { "pflash", HAS_ARG, QEMU_OPTION_pflash },
-     { "boot", HAS_ARG, QEMU_OPTION_boot },
-     { "snapshot", 0, QEMU_OPTION_snapshot },
--#ifdef TARGET_I386
--    { "no-fd-bootchk", 0, QEMU_OPTION_no_fd_bootchk },
--#endif
-     { "m", HAS_ARG, QEMU_OPTION_m },
-     { "nographic", 0, QEMU_OPTION_nographic },
-     { "portrait", 0, QEMU_OPTION_portrait },
-@@ -8355,11 +8617,6 @@
- 		drive_add("file=\"%s\"," FD_ALIAS, optarg,
- 		          popt->index - QEMU_OPTION_fda);
-                 break;
--#ifdef TARGET_I386
--            case QEMU_OPTION_no_fd_bootchk:
--                fd_bootchk = 0;
--                break;
--#endif
-             case QEMU_OPTION_no_code_copy:
-                 code_copy_enabled = 0;
-                 break;

Copied: torvm/trunk/build/win32/patches/qemu-winpcap.patch (from rev 20342, torvm/trunk/build/win32/patches/qemu-winpcap-0.9.1.patch)
===================================================================
--- torvm/trunk/build/win32/patches/qemu-winpcap.patch	                        (rev 0)
+++ torvm/trunk/build/win32/patches/qemu-winpcap.patch	2009-08-20 09:05:44 UTC (rev 20343)
@@ -0,0 +1,419 @@
+diff -Naur a/Makefile.target b/Makefile.target
+--- a/Makefile.target	2009-05-20 20:46:58.000000000 +0000
++++ b/Makefile.target	2009-08-19 10:12:57.009455378 +0000
+@@ -119,7 +119,7 @@
+ CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+ LIBS+=-lm
+ ifdef CONFIG_WIN32
+-LIBS+=-lwinmm -lws2_32 -liphlpapi
++LIBS+=-lwinmm -lws2_32 -liphlpapi -lpthreadGC2 -ltorpkt -ltorpcap
+ endif
+ ifdef CONFIG_SOLARIS
+ LIBS+=-lsocket -lnsl -lresolv
+diff -Naur a/configure b/configure
+--- a/configure	2009-05-20 20:46:58.000000000 +0000
++++ b/configure	2009-08-20 05:03:53.073452974 +0000
+@@ -462,7 +462,9 @@
+ 
+ # default flags for all hosts
+ CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
+-CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
++# XXX: tons of warning on mingw32
++# CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
++CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wstrict-prototypes"
+ LDFLAGS="$LDFLAGS -g"
+ if test "$werror" = "yes" ; then
+ CFLAGS="$CFLAGS -Werror"
+@@ -774,7 +776,7 @@
+ #undef main /* We don't want SDL to override our main() */
+ int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
+ EOF
+-    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > $TMPSDLLOG 2>&1 ; then
++    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} ${CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC ${LDFLAGS} `$sdl_config --libs 2> /dev/null` > $TMPSDLLOG 2>&1 ; then
+         _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
+         if test "$_sdlversion" -lt 121 ; then
+             sdl_too_old=yes
+@@ -786,16 +788,7 @@
+ 
+         # static link with sdl ?
+         if test "$sdl" = "yes" ; then
+-            aa="no"
+-            `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
+-            sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
+-            if [ "$aa" = "yes" ] ; then
+-                sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
+-            fi
+-
+-            if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
+-                sdl_static=yes
+-            fi
++           sdl_static=no
+         fi # static link
+     fi # sdl compile test
+ else
+@@ -1035,7 +1028,8 @@
+ EOF
+   if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
+     aio=yes
+-    AIOLIBS="-lpthread"
++    # XXX: on mingw32 we specify our own pthread lib
++    # AIOLIBS="-lpthread"
+   fi
+ fi
+ 
+@@ -1353,6 +1347,9 @@
+ if test "$slirp" = "yes" ; then
+   echo "CONFIG_SLIRP=yes" >> $config_mak
+   echo "#define CONFIG_SLIRP 1" >> $config_h
++  echo "CONFIG_PCAP=yes" >> $config_mak
++  echo "PCAP_LIBS=-lpthreadGC2 -lpacket -lwpcap" >> $config_mak
++  echo "#define CONFIG_PCAP 1" >> $config_h
+ fi
+ if test "$vde" = "yes" ; then
+   echo "CONFIG_VDE=yes" >> $config_mak
+diff -Naur a/dyngen-exec.h b/dyngen-exec.h
+--- a/dyngen-exec.h	2009-05-20 20:46:58.000000000 +0000
++++ b/dyngen-exec.h	2009-08-20 05:30:09.493456510 +0000
+@@ -35,6 +35,7 @@
+ #ifdef __OpenBSD__
+ #include <sys/types.h>
+ #else
++#ifndef __MINGW32__
+ typedef unsigned char uint8_t;
+ typedef unsigned short uint16_t;
+ typedef unsigned int uint32_t;
+@@ -46,8 +47,10 @@
+ #else
+ typedef unsigned long long uint64_t;
+ #endif
++#endif /* __MINGW32__ */
+ #endif
+ 
++#ifndef __MINGW32__
+ /* if Solaris/__sun__, don't typedef int8_t, as it will be typedef'd
+    prior to this and will cause an error in compliation, conflicting
+    with /usr/include/sys/int_types.h, line 75 */
+@@ -65,10 +68,12 @@
+ #endif
+ #endif
+ #endif
++#endif /* __MINGW32__ */
+ 
+ /* XXX: This may be wrong for 64-bit ILP32 hosts.  */
+ typedef void * host_reg_t;
+ 
++#ifndef __MINGW32__
+ #define INT8_MIN		(-128)
+ #define INT16_MIN		(-32767-1)
+ #define INT32_MIN		(-2147483647-1)
+@@ -81,6 +86,7 @@
+ #define UINT16_MAX		(65535)
+ #define UINT32_MAX		(4294967295U)
+ #define UINT64_MAX		((uint64_t)(18446744073709551615))
++#endif /* __MINGW32__ */
+ 
+ #ifdef _BSD
+ typedef struct __sFILE FILE;
+diff -Naur a/net.c b/net.c
+--- a/net.c	2009-05-20 20:46:59.000000000 +0000
++++ b/net.c	2009-08-20 05:13:47.981451257 +0000
+@@ -1043,6 +1043,261 @@
+ 
+ #endif /* !_WIN32 */
+ 
++#ifdef CONFIG_PCAP
++#define HAVE_U_INT8_T
++#define HAVE_U_INT16_T
++#define HAVE_U_INT32_T
++#define HAVE_U_INT64_T
++#include <pcap.h>
++#include <string.h>
++char pcap_devicename[64];
++
++#if defined(_WIN32)
++/* pcap-stdinc.h wants to define inline itself... */
++#undef inline
++#include <winreg.h>
++#endif
++
++#include <pthread.h>
++
++static VLANClientState *pcap_vc;
++pcap_t* pcaphandle;
++static void pcap_receive(void *opaque, const uint8_t *buf, int size);
++void eth_callback(u_char *user, const struct pcap_pkthdr *phdr, const u_char *pdata);
++void *pcap_send(void *threadid);
++int eth_open(char* name);
++
++#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
++#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
++#define DEVICE_PREFIX "\\Device\\TORNPF_"
++#define NETGUIDLEN 38
++
++static int get_net_device_guid(
++    char *name,
++    int name_size,
++    char *actual_name,
++    int actual_name_size)
++{
++    LONG status;
++    HKEY control_net_key;
++    DWORD len;
++    int i = 0;
++    int stop = 0;
++
++    status = RegOpenKeyEx(
++        HKEY_LOCAL_MACHINE,
++        NETWORK_CONNECTIONS_KEY,
++        0,
++        KEY_READ,
++        &control_net_key);
++
++    if (status != ERROR_SUCCESS) {
++        return -1;
++    }
++
++    while (!stop)
++    {
++        char enum_name[256];
++        char connection_string[256];
++        HKEY connection_key;
++        char name_data[256];
++        DWORD name_type;
++        const char name_string[] = "Name";
++
++        len = sizeof (enum_name);
++        status = RegEnumKeyEx(
++            control_net_key,
++            i,
++            enum_name,
++            &len,
++            NULL,
++            NULL,
++            NULL,
++            NULL);
++
++        if (status == ERROR_NO_MORE_ITEMS)
++            break;
++        else if (status != ERROR_SUCCESS) {
++            return -1;
++        }
++
++        snprintf(connection_string,
++             sizeof(connection_string),
++             "%s\\%s\\Connection",
++             NETWORK_CONNECTIONS_KEY, enum_name);
++
++        status = RegOpenKeyEx(
++            HKEY_LOCAL_MACHINE,
++            connection_string,
++            0,
++            KEY_READ,
++            &connection_key);
++
++        if (status == ERROR_SUCCESS) {
++            len = sizeof (name_data);
++            status = RegQueryValueEx(
++                connection_key,
++                name_string,
++                NULL,
++                &name_type,
++                name_data,
++                &len);
++
++            if (status != ERROR_SUCCESS || name_type != REG_SZ) {
++                    return -1;
++            }
++            else {
++                if (actual_name) {
++                    if (strcmp(name, name_data) != 0) {
++                        fprintf(stderr, "pcap: %s does not match requested %s (guid: %s)\n", name, name_data, enum_name);
++                        RegCloseKey (connection_key);
++                        ++i;
++                        continue;
++                    }
++                    else {
++                        snprintf(actual_name, actual_name_size, "%s%s", DEVICE_PREFIX, enum_name);
++                        fprintf(stderr, "pcap: matched requested %s to guid: %s\n\tpcap open devname: %s", name_data, enum_name, actual_name);
++                    }
++                }
++                stop = 1;
++            }
++
++            RegCloseKey (connection_key);
++        }
++        ++i;
++    }
++
++    RegCloseKey (control_net_key);
++
++    if (stop == 0)
++        return -1;
++
++    return 0;
++}
++
++static int net_pcap_init(VLANState *vlan)
++{
++    pcap_vc = qemu_new_vlan_client(vlan, "pcap redirector", "pcap", pcap_receive, NULL, NULL, NULL);
++    snprintf(pcap_vc->info_str,sizeof(pcap_vc->info_str),"pcap redirector");
++    char dev_guid[256];
++    *dev_guid = 0;
++
++    /* we don't have strnlen??? */
++    pcap_devicename[sizeof(pcap_devicename)-1] = 0;
++
++    /* accept passing a GUID instead of name, which is more precise.  there is a known
++     * issue with disabled adapters sharing names of active ones leading to open failure.
++     */
++    if ( (strlen(pcap_devicename) == NETGUIDLEN) && (*pcap_devicename == '{') ) {
++        snprintf(dev_guid, sizeof(dev_guid), "%s%s", DEVICE_PREFIX, pcap_devicename);
++        /* fprintf(stderr, "qemu: pcap bridge using explicit device guid: %s\n", dev_guid); */
++    }
++    else {
++        if (get_net_device_guid (pcap_devicename, sizeof(pcap_devicename), dev_guid, sizeof(dev_guid))) {
++            fprintf(stderr, "qemu: could not set up pcap bridge to alias: %s\n", pcap_devicename);
++            exit(1);
++        }
++    }
++    /* either this works or we exit. don't bother with retval */
++    eth_open(dev_guid);
++
++    pthread_attr_t attr;
++    pthread_t threads;
++    int rc;
++    rc=pthread_create (&threads,NULL,pcap_send,NULL);
++    pthread_attr_destroy(&attr);
++    return 0;
++}
++
++static void pcap_receive(void *opaque, const uint8_t *buf, int size)
++{
++    pcap_sendpacket((pcap_t*)pcaphandle, (u_char*)buf, size);
++}
++
++void *pcap_send(void *threadid)
++{
++    struct timeval timeout;
++    timeout.tv_sec = 0;
++    timeout.tv_usec = 200*1000;
++    int status;
++
++    while(pcaphandle)
++    {
++        fd_set setl;
++        FD_ZERO(&setl);
++        status = pcap_dispatch((pcap_t*)pcaphandle, 1, &eth_callback, NULL);
++    }
++    return NULL;
++}
++
++void eth_callback(u_char *user, const struct pcap_pkthdr *phdr, const u_char *pdata)
++{
++    if(phdr->len<1501)
++    {
++        qemu_send_packet(pcap_vc, pdata, phdr->len);
++    }
++}
++
++/* bad winpcap api only sets these when remote-pcap is enabled. */
++#define PCAP_OPENFLAG_PROMISCUOUS 1
++#define PCAP_OPENFLAG_NOCAPTURE_LOCAL 8
++#define PCAP_READ_TIMEOUT 15
++
++int eth_open(char* name)
++{
++    const int bufsz = 1520;
++    char errbuf[PCAP_ERRBUF_SIZE];
++    char* msg;
++
++    /* attempt to connect device */
++    memset(errbuf, 0, sizeof(errbuf));
++    pcaphandle = (void*) pcap_open_live(name,
++                                        bufsz,
++                                        PCAP_OPENFLAG_PROMISCUOUS | PCAP_OPENFLAG_NOCAPTURE_LOCAL,
++                                        PCAP_READ_TIMEOUT,
++                                        errbuf);
++    if (!pcaphandle) { /* try non-promisc open device */
++        pcaphandle = (void*) pcap_open_live(name,
++                                            bufsz,
++                                            PCAP_OPENFLAG_NOCAPTURE_LOCAL,
++                                            PCAP_READ_TIMEOUT,
++                                            errbuf);
++        if (!pcaphandle) { /* cannot open device */
++            msg = "Eth: pcap_open_live error for device %s - %s\r\n";
++            fprintf (stderr, msg, name, errbuf);
++            exit (1);
++        }
++        msg = "Eth: opened non-promisc %s\r\n";
++        /* fprintf (stderr, msg, name); */
++    } else {
++        msg = "Eth: opened promisc %s\r\n";
++        /* fprintf (stderr, msg, name); */
++    }
++
++#if defined (USE_READER_THREAD)
++    {
++        pthread_attr_t attr;
++
++        ethq_init (&dev->read_queue, 200); /* initialize FIFO queue */
++        pthread_mutex_init (&dev->lock, NULL);
++        pthread_attr_init(&attr);
++        pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
++        pthread_create (&dev->reader_thread, &attr, _pcap_send, (void *)dev);
++        pthread_attr_destroy(&attr);
++    }
++#else /* !defined (USE_READER_THREAD */
++#ifdef USE_SETNONBLOCK
++    /* set ethernet device non-blocking so pcap_dispatch() doesn't hang */
++    if (pcap_setnonblock (dev->pcaphandle, 1, errbuf) == -1) {
++        msg = "Eth: Failed to set non-blocking: %s\r\n";
++        printf (msg, errbuf);
++    }
++#endif
++#endif /* !defined (USE_READER_THREAD */
++    return 0;
++}
++#endif //CONFIG_PCAP
++
+ #if defined(CONFIG_VDE)
+ typedef struct VDEState {
+     VLANClientState *vc;
+@@ -1752,6 +2007,14 @@
+         }
+     } else
+ #endif
++#ifdef CONFIG_PCAP
++    if (!strcmp(device, "pcap")) {
++       if (get_param_value(buf, sizeof(buf), "devicename", p) > 0) {
++           pstrcpy(pcap_devicename,sizeof(pcap_devicename),buf);
++       }
++       ret = net_pcap_init(vlan);
++    } else
++#endif
+     if (!strcmp(device, "socket")) {
+         if (get_param_value(buf, sizeof(buf), "fd", p) > 0) {
+             int fd;
+@@ -1828,6 +2091,9 @@
+ #ifdef CONFIG_VDE
+                                        ,"vde"
+ #endif
++#ifdef CONFIG_PCAP
++                                       ,"pcap"
++#endif
+     };
+     for (i = 0; i < sizeof(valid_param_list) / sizeof(char *); i++) {
+         if (!strncmp(valid_param_list[i], device,
+diff -Naur a/vl.c b/vl.c
+--- a/vl.c	2009-05-20 20:47:01.000000000 +0000
++++ b/vl.c	2009-08-19 10:38:17.093454551 +0000
+@@ -3995,6 +3995,9 @@
+            "                use '[down]script=no' to disable script execution;\n"
+            "                use 'fd=h' to connect to an already opened TAP interface\n"
+ #endif
++#ifdef CONFIG_PCAP
++           "-net pcap[,vlan=n],devicename=name\n"
++#endif
+            "-net socket[,vlan=n][,name=str][,fd=h][,listen=[host]:port][,connect=host:port]\n"
+            "                connect the vlan 'n' to another VLAN using a socket connection\n"
+            "-net socket[,vlan=n][,name=str][,fd=h][,mcast=maddr:port]\n"


Property changes on: torvm/trunk/build/win32/patches/qemu-winpcap.patch
___________________________________________________________________
Added: svn:mergeinfo
   + 

Modified: torvm/trunk/build/win32/src/torvm-w32/torvm.c
===================================================================
--- torvm/trunk/build/win32/src/torvm-w32/torvm.c	2009-08-20 04:16:47 UTC (rev 20342)
+++ torvm/trunk/build/win32/src/torvm-w32/torvm.c	2009-08-20 09:05:44 UTC (rev 20343)
@@ -1588,7 +1588,7 @@
   TCHAR *cmd = malloc(CMDMAX);
   /* TODO: clean this up once the msys path munging works.  kernel and hdd need to be unixy paths */
   snprintf (cmd, CMDMAX -1,
-            "\"%s\" -L . -no-reboot -kernel ../lib/vmlinuz -append \"loglevel=9 NOINIT\" -hda ../state/hdd.img -m %d -std-vga", qemubin, QEMU_DEF_MEM);
+            "\"%s\" -L . -no-reboot -kernel ../lib/vmlinuz -append \"loglevel=9 NOINIT\" -hda ../state/hdd.img -m %d -sdl -vga std", qemubin, QEMU_DEF_MEM);
   ldebug ("Launching Qemu with cmd: %s", cmd);
   if( !CreateProcess(NULL,
                      cmd,
@@ -1850,7 +1850,7 @@
   cmd = malloc(CMDMAX);
   if (tapname) {
     snprintf (cmd, CMDMAX -1,
-              "\"%s\" -name \"Tor VM \" -L . -no-reboot -kernel ../lib/vmlinuz -append \"%s\" -hda ../state/hdd.img -m %d -std-vga -net nic,model=pcnet,macaddr=%s -net pcap,devicename=\"%s\" -net nic,vlan=0,model=pcnet -net tap,vlan=0,ifname=\"%s\"",
+              "\"%s\" -name \"Tor VM \" -L . -no-reboot -kernel ../lib/vmlinuz -append \"%s\" -hda ../state/hdd.img -hdc fat:../state/rofs -m %d -sdl -vga std -net nic,model=pcnet,macaddr=%s -net pcap,devicename=\"%s\" -net nic,vlan=0,model=pcnet -net tap,vlan=0,ifname=\"%s\"",
 	      qemubin,
               cmdline,
               QEMU_DEF_MEM,
@@ -1860,7 +1860,7 @@
   }
   else {
     snprintf (cmd, CMDMAX -1,
-              "\"%s\" -name \"Tor VM \" -L . -no-reboot -kernel ../lib/vmlinuz -append \"%s\" -hda ../state/hdd.img -m %d -std-vga -net nic,model=pcnet,macaddr=%s -net pcap,devicename=\"%s\"",
+              "\"%s\" -name \"Tor VM \" -L . -no-reboot -kernel ../lib/vmlinuz -append \"%s\" -hda ../state/hdd.img -hdc fat:../state/rofs -m %d -sdl -vga std -net nic,model=pcnet,macaddr=%s -net pcap,devicename=\"%s\"",
 	      qemubin,
               cmdline,
               QEMU_DEF_MEM,