[or-cvs] r19429: {torvm} Clean up all the crud getting spewed into the Tor VM window (in torvm/trunk/build/win32: patches src/torvm-w32)

coderman at seul.org coderman at seul.org
Tue May 5 00:27:20 UTC 2009


Author: coderman
Date: 2009-05-04 20:27:19 -0400 (Mon, 04 May 2009)
New Revision: 19429

Modified:
   torvm/trunk/build/win32/patches/qemu-winpcap-0.9.1.patch
   torvm/trunk/build/win32/src/torvm-w32/torvm.c
Log:
Clean up all the crud getting spewed into the Tor VM window that was confusing users. Give them meaningful messages that explain what is going on instead.

Modified: torvm/trunk/build/win32/patches/qemu-winpcap-0.9.1.patch
===================================================================
--- torvm/trunk/build/win32/patches/qemu-winpcap-0.9.1.patch	2009-05-04 23:13:58 UTC (rev 19428)
+++ torvm/trunk/build/win32/patches/qemu-winpcap-0.9.1.patch	2009-05-05 00:27:19 UTC (rev 19429)
@@ -1,6 +1,6 @@
-diff -Naur orig-qemu-0.9.1/Makefile.target mod-qemu-0.9.1/Makefile.target
---- orig-qemu-0.9.1/Makefile.target	2008-01-06 19:38:41.000000000 +0000
-+++ mod-qemu-0.9.1/Makefile.target	2008-11-30 09:35:06.913417440 +0000
+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
@@ -10,9 +10,9 @@
  endif
  ifdef CONFIG_SOLARIS
  LIBS+=-lsocket -lnsl -lresolv
-diff -Naur orig-qemu-0.9.1/configure mod-qemu-0.9.1/configure
---- orig-qemu-0.9.1/configure	2008-01-06 19:38:42.000000000 +0000
-+++ mod-qemu-0.9.1/configure	2008-11-30 09:35:06.914417288 +0000
+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); }
@@ -33,9 +33,9 @@
  fi
  if test "$adlib" = "yes" ; then
    echo "CONFIG_ADLIB=yes" >> $config_mak
-diff -Naur orig-qemu-0.9.1/dyngen-exec.h mod-qemu-0.9.1/dyngen-exec.h
---- orig-qemu-0.9.1/dyngen-exec.h	2008-01-06 19:38:42.000000000 +0000
-+++ mod-qemu-0.9.1/dyngen-exec.h	2008-11-30 09:35:06.915417136 +0000
+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>
@@ -66,9 +66,9 @@
  #ifdef _BSD
  typedef struct __sFILE FILE;
  #else
-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-11-30 10:48:37.382924160 +0000
+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 */
@@ -219,7 +219,7 @@
 +     */
 +    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);
++        /* 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))) {
@@ -297,10 +297,10 @@
 +            exit (1);
 +        }
 +        msg = "Eth: opened non-promisc %s\r\n";
-+        fprintf (stderr, msg, name);
++        /* fprintf (stderr, msg, name); */
 +    } else {
 +        msg = "Eth: opened promisc %s\r\n";
-+        fprintf (stderr, msg, name);
++        /* fprintf (stderr, msg, name); */
 +    }
 +
 +#if defined (USE_READER_THREAD)

Modified: torvm/trunk/build/win32/src/torvm-w32/torvm.c
===================================================================
--- torvm/trunk/build/win32/src/torvm-w32/torvm.c	2009-05-04 23:13:58 UTC (rev 19428)
+++ torvm/trunk/build/win32/src/torvm-w32/torvm.c	2009-05-05 00:27:19 UTC (rev 19429)
@@ -205,6 +205,21 @@
   return;
 }
 
+/* XXX: for now we just print some things to console to indicate what is going on.
+ * At some point a better interface with localized string will be needed.
+ * We always grab a current stdout handle in case it gets redirected at some point.
+ * (For example, as a service these messages would go into events)
+ */
+static void dispmsg(LPTSTR msg)
+{
+  HANDLE  hnd;
+  hnd = GetStdHandle(STD_OUTPUT_HANDLE);
+  WriteFile(hnd, msg, strlen(msg), NULL, NULL);
+  msg = "\r\n";
+  WriteFile(hnd, msg, strlen(msg), NULL, NULL);
+  CloseHandle(hnd);
+}
+
 static BOOL escquote(LPTSTR  path,
                      LPTSTR *epath)
 {
@@ -2137,6 +2152,7 @@
     fatal ("Unable to prepare process environment.");
   }
 
+  dispmsg("Tor VM is starting. Please be patient...");
   if (!vmnop) {
     if (!savenetconfig()) {
       fatal ("Unable to save current network configuration.");
@@ -2178,6 +2194,7 @@
       tapconn = tapconn->next;
     }
 
+    dispmsg("Configuring network settings.");
     if (!installtornpf()) {
       lerror ("Unable to install Tor NPF service driver.");
       goto shutdown;
@@ -2236,6 +2253,7 @@
     ldebug ("Generated kernel command line: %s", cmdline);
   }
 
+  dispmsg("Launching virtual machine.");
   PROCESS_INFORMATION pi;
   if (vmnop) {
     if (! spawnprocess(&pi, "qemu.exe")) {
@@ -2284,6 +2302,7 @@
    * restricted user log off and clean shutdown.
    */
   if (bundle) {
+    dispmsg("Waiting for Tor control port to open...");
     /* try to confirm control port is up before launching vidalia... */
     int i = 10;
     while ( (!tryconnect(TOR_TAP_VMIP, 9051)) && (i > 0) ) {
@@ -2292,6 +2311,7 @@
     }
     if (i > 0) {
       ldebug("Control port connected. Starting controller ...");
+      dispmsg("Launching Vidalia.");
       runvidalia(indebug);
 
       /* XXX: Now we wait for the ALL READY socket to be listening before switching.
@@ -2315,13 +2335,16 @@
     }
   }
 
+  dispmsg("Tor VM is running, waiting for exit...");
+  dispmsg("");
   /* TODO: once the pcap bridge is up we can re-enable the firewall IF we
    * add an exception for the control port on the Tap adapter.
    */
-
   waitforit(&pi);
 
   linfo ("Tor VM closed, restoring host network and services.");
+  dispmsg("Shutting down...");
+  dispmsg("CAUTION: Do NOT close this window while restoring network settings!");
 
   if (bundle) {
     disableuser(TOR_RESTRICTED_USER);



More information about the tor-commits mailing list