Skip to contentSkip to conversation

QEMU: VNC

Qemu-devel Christopher Olsen 12 participants 40 messages Feb 16, 2007 – Mar 5, 2007 Kbuild

lore
Share & tools
lore
#0 lore raw

Anyone here know if there is a way to append to the VNC display header?

-Christopher

Signature · 4 lines
Christopher Olsen
[email protected]
Tel: 631-676-4877
Fax: 631-249-3036
#1 lore raw
Quoted 2 lines · Christopher Olsen

Anyone here know if there is a way to append to the VNC display header?

I'm not sure I understand what you're asking. What is the VNC display header?

Regards,

Anthony Liguori

Quoted 4 lines

-Christopher

#2 lore raw
In reply to Christopher Olsen

I didn't see a way so here is a patch for it work on 0.9.0

-Christopher

Quoted 3 lines · Christopher Olsen

Anyone here know if there is a way to append to the VNC display header?

-Christopher

Signature · 4 lines
Christopher Olsen
[email protected]
Tel: 631-676-4877
Fax: 631-249-3036

*** vl.c Fri Feb 16 13:27:06 2007
--- /home/reddawg/qemu/work/qemu-0.9.0/vl.c Fri Feb 16 13:30:09 2007
***************
*** 1,9 ****
--- 1,10 ----
/*
* QEMU System Emulator
*
* Copyright (c) 2003-2007 Fabrice Bellard
+ * Copyright (C) 2007 Christopher Olsen <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
***************
*** 45,54 ****
--- 46,60 ----
#ifdef _BSD
#include <sys/stat.h>
#ifndef __APPLE__
#include <libutil.h>
#endif
+ #ifdef __FreeBSD__
+ #include <sys/module.h>
+ #include <dev/ppbus/ppi.h>
+ #include <dev/ppbus/ppbconf.h>
+ #endif
#else
#ifndef __sun__
#include <linux/if.h>
#include <linux/if_tun.h>
#include <pty.h>
***************
*** 87,101 ****
--- 93,109 ----
#include "disas.h"

  #include "exec-all.h"

#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
+ #ifndef SMBD_COMMAND
#ifdef __sun__
#define SMBD_COMMAND "/usr/sfw/sbin/smbd"
#else
#define SMBD_COMMAND "/usr/sbin/smbd"
#endif
+ #endif

//#define DEBUG_UNUSED_IOPORT
//#define DEBUG_IOPORT

#define PHYS_RAM_MAX_SIZE (2047 * 1024 * 1024)
***************
*** 156,165 ****
--- 164,174 ----
#endif
int usb_enabled = 0;
static VLANState *first_vlan;
int smp_cpus = 1;
const char *vnc_display;
+ const char *vnc_name;
#if defined(TARGET_SPARC)
#define MAX_CPUS 16
#elif defined(TARGET_I386)
#define MAX_CPUS 255
#else
***************
*** 626,636 ****
static int use_rt_clock;

static void init_get_clock(void)

  {
      use_rt_clock = 0;
! #if defined(__linux__)
      {
          struct timespec ts;
          if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
              use_rt_clock = 1;
          }

--- 635,645 ----
static int use_rt_clock;

static void init_get_clock(void)

  {
      use_rt_clock = 0;
! #if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000)
      {
          struct timespec ts;
          if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
              use_rt_clock = 1;
          }

***************
*** 638,648 ****
#endif
}

static int64_t get_clock(void)
{
! #if defined(__linux__)

      if (use_rt_clock) {
          struct timespec ts;
          clock_gettime(CLOCK_MONOTONIC, &ts);
          return ts.tv_sec * 1000000000LL + ts.tv_nsec;
      } else 

--- 647,657 ----
#endif
}

static int64_t get_clock(void)
{
! #if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000)

      if (use_rt_clock) {
          struct timespec ts;
          clock_gettime(CLOCK_MONOTONIC, &ts);
          return ts.tv_sec * 1000000000LL + ts.tv_nsec;
      } else 
***************
*** 1639,1649 ****
          term_init();
      }
      return chr;

}

! #if defined(__linux__)
static CharDriverState *qemu_chr_open_pty(void)

  {
      struct termios tty;
      char slave_name[1024];
      int master_fd, slave_fd;
--- 1648,1658 ----
          term_init();
      }
      return chr;

}

! #if defined(__linux__) || defined(__FreeBSD__)
static CharDriverState *qemu_chr_open_pty(void)

  {
      struct termios tty;
      char slave_name[1024];
      int master_fd, slave_fd;

***************
*** 1718,1731 ****

      cfsetispeed(&tty, spd);
      cfsetospeed(&tty, spd);
  
      tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
!                           |INLCR|IGNCR|ICRNL|IXON);
!     tty.c_oflag |= OPOST;
      tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN|ISIG);
      tty.c_cflag &= ~(CSIZE|PARENB|PARODD|CRTSCTS|CSTOPB);
      switch(data_bits) {
      default:
      case 8:
          tty.c_cflag |= CS8;
          break;

--- 1727,1743 ----

      cfsetispeed(&tty, spd);
      cfsetospeed(&tty, spd);
  
      tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
!                           |INLCR|IGNCR|ICRNL|IXON|IMAXBEL);
!     tty.c_oflag &= ~OPOST; /* Don't do any output processing! */
      tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN|ISIG);
      tty.c_cflag &= ~(CSIZE|PARENB|PARODD|CRTSCTS|CSTOPB);
+ #ifdef __FreeBSD__
+     cfmakeraw(&tty);
+ #endif
      switch(data_bits) {
      default:
      case 8:
          tty.c_cflag |= CS8;
          break;
***************
*** 1797,1806 ****
--- 1809,1819 ----
      chr->chr_ioctl = tty_serial_ioctl;
      qemu_chr_reset(chr);
      return chr;

}

+ #if defined(__linux__)
static int pp_ioctl(CharDriverState *chr, int cmd, void *arg)

  {
      int fd = (int)chr->opaque;
      uint8_t b;

***************
*** 1861,1870 ****
--- 1874,1941 ----

      qemu_chr_reset(chr);
  
      return chr;

}
+ #elif defined(__FreeBSD__)
+ static int pp_ioctl(CharDriverState *chr, int cmd, void *arg)
+ {
+ int fd = (int)chr->opaque;
+ uint8_t b;
+
+ switch(cmd) {
+ case CHR_IOCTL_PP_READ_DATA:
+ if (ioctl(fd, PPIGDATA, &b) < 0)
+ return -ENOTSUP;
+ *(uint8_t *)arg = b;
+ break;
+ case CHR_IOCTL_PP_WRITE_DATA:
+ b = *(uint8_t *)arg;
+ if (ioctl(fd, PPISDATA, &b) < 0)
+ return -ENOTSUP;
+ break;
+ case CHR_IOCTL_PP_READ_CONTROL:
+ if (ioctl(fd, PPIGCTRL, &b) < 0)
+ return -ENOTSUP;
+ *(uint8_t *)arg = b;
+ break;
+ case CHR_IOCTL_PP_WRITE_CONTROL:
+ b = *(uint8_t *)arg;
+ if (ioctl(fd, PPISCTRL, &b) < 0)
+ return -ENOTSUP;
+ break;
+ case CHR_IOCTL_PP_READ_STATUS:
+ if (ioctl(fd, PPIGSTATUS, &b) < 0)
+ return -ENOTSUP;
+ *(uint8_t *)arg = b;
+ break;
+ default:
+ return -ENOTSUP;
+ }
+ return 0;
+ }
+
+ CharDriverState *qemu_chr_open_pp(const char *filename)
+ {
+ CharDriverState *chr;
+ int fd;
+
+ fd = open(filename, O_RDWR);
+ if (fd < 0)
+ return NULL;
+
+ chr = qemu_mallocz(sizeof(CharDriverState));
+ if (!chr) {
+ close(fd);
+ return NULL;

+     }
+     chr->opaque = (void *)fd;
+     chr->chr_write = null_chr_write;
+     chr->chr_ioctl = pp_ioctl;
+     return chr;

+ }
+ #endif

#else
static CharDriverState *qemu_chr_open_pty(void)

  {
      return NULL;
***************
*** 2737,2746 ****
--- 2808,2824 ----
          return qemu_chr_open_pp(filename);
      } else 
      if (strstart(filename, "/dev/", NULL)) {
          return qemu_chr_open_tty(filename);
      } else 

+ #elif defined(__FreeBSD__)
+ if (strstart(filename, "/dev/ppi", NULL)) {
+ return qemu_chr_open_pp(filename);
+ } else
+ if (strstart(filename, "/dev/", NULL)) {
+ return qemu_chr_open_tty(filename);
+ } else
#endif

  #ifdef _WIN32
      if (strstart(filename, "COM", NULL)) {
          return qemu_chr_open_win(filename);
      } else

***************
*** 3169,3178 ****
--- 3247,3284 ----

  #endif /* !defined(_WIN32) */
  
  #endif /* CONFIG_SLIRP */

+ #ifdef __FreeBSD__
+ #define LOAD_QUIETLY 1
+ #define LOAD_VERBOSLY 2
+
+ int
+ loadmodules(int how, const char *module, ...)
+ {
+ int loaded = 0;
+ va_list ap;
+
+ va_start(ap, module);
+ #ifndef NO_MODULES
+ while (module != NULL) {
+ if (modfind(module) == -1) {
+ if (kldload(module) == -1) {
+ if (how == LOAD_VERBOSLY)
+ fprintf(stderr, "%s: Cannot load module\n", module);
+ } else
+ loaded++;
+ }
+ module = va_arg(ap, const char *);
+ }
+ va_end(ap);
+ #endif
+ return loaded;
+ }
+ #endif
+
#if !defined(_WIN32)

  typedef struct TAPState {
      VLANClientState *vc;
      int fd;
***************
*** 3224,3238 ****
  {
      int fd;
      char *dev;
      struct stat s;
  
      fd = open("/dev/tap", O_RDWR);
      if (fd < 0) {
!         fprintf(stderr, "warning: could not open /dev/tap: no virtual network emulation\n");
          return -1;
      }
  
      fstat(fd, &s);
      dev = devname(s.st_rdev, S_IFCHR);
      pstrcpy(ifname, ifname_size, dev);

--- 3330,3388 ----

  {
      int fd;
      char *dev;
      struct stat s;

+ #ifdef __FreeBSD__
+ int i, kldtried = 0, enoentcount = 0, err = 0;
+ char dname[100];
+ #ifdef USE_DEVTAP
+ /*

+      * 5.x has /dev/tap, but that seems to just blindly increase its
+      * couter on every open() for some people(??), i.e. on every qemu run.
+      */

+ i = -1;
+ #else
+ i = 0;
+ #endif
+ for (; i < 10; i++) {
+ if (i == -1)
+ strcpy(dname, "/dev/tap");
+ else
+ snprintf(dname, sizeof dname, "%s%d",
+ "/dev/tap", i);
+ fd = open(dname, O_RDWR);
+ if (fd >= 0)
+ break;
+ else if (errno == ENXIO || errno == ENOENT) {
+ if (i == 0 && !kldtried++) {
+ /*

+                  * Attempt to load the tunnel interface KLD if it isn't loaded
+                  * already.
+                  */

+ if (loadmodules(LOAD_VERBOSLY, "if_tap", NULL))
+ i = -1;
+ continue;
+ }
+ if (errno != ENOENT || ++enoentcount > 3) {
+ err = errno;
+ break;
+ }
+ } else
+ err = errno;
+ }
+ if (fd < 0) {
+ fprintf(stderr, "warning: could not open %s (%s): no virtual network emulation\n", dname, strerror(err));
+ return -1;
+ }
+ #else

      fd = open("/dev/tap", O_RDWR);
      if (fd < 0) {
!         fprintf(stderr, "warning: could not open /dev/tap (%s): no virtual network emulation\n", strerror(errno));
          return -1;
      }

+ #endif

      fstat(fd, &s);
      dev = devname(s.st_rdev, S_IFCHR);
      pstrcpy(ifname, ifname_size, dev);

***************
*** 6199,6208 ****
--- 6349,6359 ----
QEMU_OPTION_win2k_hack,
QEMU_OPTION_usb,
QEMU_OPTION_usbdevice,
QEMU_OPTION_smp,
QEMU_OPTION_vnc,
+ QEMU_OPTION_vncname,
QEMU_OPTION_no_acpi,
QEMU_OPTION_no_reboot,
QEMU_OPTION_daemonize,
QEMU_OPTION_option_rom,
QEMU_OPTION_semihosting
***************
*** 6279,6288 ****
--- 6430,6440 ----

      { "pidfile", HAS_ARG, QEMU_OPTION_pidfile },
      { "win2k-hack", 0, QEMU_OPTION_win2k_hack },
      { "usbdevice", HAS_ARG, QEMU_OPTION_usbdevice },
      { "smp", HAS_ARG, QEMU_OPTION_smp },
      { "vnc", HAS_ARG, QEMU_OPTION_vnc },

+ { "vncname", HAS_ARG, QEMU_OPTION_vncname },

      /* temporary options */
      { "usb", 0, QEMU_OPTION_usb },
      { "cirrusvga", 0, QEMU_OPTION_cirrusvga },
      { "no-acpi", 0, QEMU_OPTION_no_acpi },
***************
*** 6704,6713 ****
--- 6856,6866 ----
                  }
                  break;
              case QEMU_OPTION_nographic:
                  pstrcpy(monitor_device, sizeof(monitor_device), "stdio");
                  pstrcpy(serial_devices[0], sizeof(serial_devices[0]), "stdio");
+                 pstrcpy(parallel_devices[0], sizeof(parallel_devices[0]), "null");
                  nographic = 1;
                  break;
              case QEMU_OPTION_kernel:
                  kernel_filename = optarg;
                  break;
***************
*** 6936,6945 ****
--- 7089,7101 ----
                  }
                  break;

case QEMU_OPTION_vnc:
vnc_display = optarg;
break;
+ case QEMU_OPTION_vncname:
+ vnc_name = optarg;

+                 break;
              case QEMU_OPTION_no_acpi:
                  acpi_enabled = 0;
                  break;
              case QEMU_OPTION_no_reboot:
                  no_reboot = 1;

*** vl.h Fri Feb 16 13:27:06 2007
--- /home/reddawg/qemu/work/qemu-0.9.0/vl.h Fri Feb 16 13:30:23 2007
***************
*** 1,9 ****
--- 1,10 ----
/*
* QEMU System Emulator header
*
* Copyright (c) 2003 Fabrice Bellard
+ * Copyright (C) 2007 Christopher Olsen <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
***************
*** 28,37 ****
--- 29,44 ----
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <inttypes.h>
+ #ifndef PRId64
+ #define PRId64 "lld" /* int64_t */
+ #define PRIo64 "llo" /* int64_t */
+ #define PRIx64 "llx" /* int64_t */
+ #define PRIu64 "llu" /* int64_t */
+ #endif
#include <limits.h>
#include <time.h>
#include <ctype.h>
#include <errno.h>
#include <unistd.h>
***************
*** 110,119 ****
--- 117,129 ----
uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);

  void hw_error(const char *fmt, ...);

extern const char *bios_dir;
+
+ //UBU
+ extern const char *vnc_name;

extern int vm_running;

typedef struct vm_change_state_entry VMChangeStateEntry;
typedef void VMChangeStateHandler(void *opaque, int running);
*** vnc.c Fri Feb 16 13:27:06 2007
--- /home/reddawg/qemu/work/qemu-0.9.0/vnc.c Fri Feb 16 13:29:13 2007
***************
*** 1,10 ****
--- 1,11 ----
/*
* QEMU VNC display driver
*
* Copyright (C) 2006 Anthony Liguori <[email protected]>
* Copyright (C) 2006 Fabrice Bellard
+ * Copyright (C) 2007 Christopher Olsen <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
***************
*** 1054,1063 ****
--- 1055,1065 ----
}

static int protocol_client_init(VncState *vs, char *data, size_t len)

  {
      char pad[3] = { 0, 0, 0 };

+ char name[64];

      vs->width = vs->ds->width;
      vs->height = vs->ds->height;
      vnc_write_u16(vs, vs->ds->width);
      vnc_write_u16(vs, vs->ds->height);
***************
*** 1098,1109 ****
      }
      vs->write_pixels = vnc_write_pixels_copy;
  	
      vnc_write(vs, pad, 3);           /* padding */

! vnc_write_u32(vs, 4);

!     vnc_write(vs, "QEMU", 4);
      vnc_flush(vs);
  
      vnc_read_when(vs, protocol_client_msg, 1);
  
      return 0;
--- 1100,1115 ----
      }
      vs->write_pixels = vnc_write_pixels_copy;
  	
      vnc_write(vs, pad, 3);           /* padding */

! if (vnc_name == 0x0)
! sprintf(name, "QEMU: Unknown");
! else
! sprintf(name, "QEMU: %s",vnc_name);
! vnc_write_u32(vs, strlen(name));

!     vnc_write(vs, name, strlen(name));
      vnc_flush(vs);
  
      vnc_read_when(vs, protocol_client_msg, 1);
  
      return 0;
#3 lore raw
Quoted 2 lines · Christopher Olsen

I didn't see a way so here is a patch for it work on 0.9.0

I've got a more generic -name patch I've been sitting on. It adds a title for the VNC session and SDL session. If there's interest, I can push it further ahead in my queue.

Regards,

Anthony Liguori

Quoted 587 lines

-Christopher

Quoted 4 lines · Christopher Olsen

Anyone here know if there is a way to append to the VNC display header?

-Christopher

------------------------------------------------------------------------

*** vl.c Fri Feb 16 13:27:06 2007
--- /home/reddawg/qemu/work/qemu-0.9.0/vl.c Fri Feb 16 13:30:09 2007
***************
*** 1,9 ****
--- 1,10 ----
/*
* QEMU System Emulator
*
* Copyright (c) 2003-2007 Fabrice Bellard
+ * Copyright (C) 2007 Christopher Olsen <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
***************
*** 45,54 ****
--- 46,60 ----
#ifdef _BSD
#include <sys/stat.h>
#ifndef __APPLE__
#include <libutil.h>
#endif
+ #ifdef __FreeBSD__
+ #include <sys/module.h>
+ #include <dev/ppbus/ppi.h>
+ #include <dev/ppbus/ppbconf.h>
+ #endif
#else
#ifndef __sun__
#include <linux/if.h>
#include <linux/if_tun.h>
#include <pty.h>
***************
*** 87,101 ****
--- 93,109 ----
#include "disas.h"

  #include "exec-all.h"

#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
+ #ifndef SMBD_COMMAND
#ifdef __sun__
#define SMBD_COMMAND "/usr/sfw/sbin/smbd"
#else
#define SMBD_COMMAND "/usr/sbin/smbd"
#endif
+ #endif

//#define DEBUG_UNUSED_IOPORT
//#define DEBUG_IOPORT

#define PHYS_RAM_MAX_SIZE (2047 * 1024 * 1024)
***************
*** 156,165 ****
--- 164,174 ----
#endif
int usb_enabled = 0;
static VLANState *first_vlan;
int smp_cpus = 1;
const char *vnc_display;
+ const char *vnc_name;
#if defined(TARGET_SPARC)
#define MAX_CPUS 16
#elif defined(TARGET_I386)
#define MAX_CPUS 255
#else
***************
*** 626,636 ****
static int use_rt_clock;

static void init_get_clock(void)

  {
      use_rt_clock = 0;
! #if defined(__linux__)
      {
          struct timespec ts;
          if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
              use_rt_clock = 1;
          }

--- 635,645 ----
static int use_rt_clock;

static void init_get_clock(void)

  {
      use_rt_clock = 0;
! #if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000)
      {
          struct timespec ts;
          if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
              use_rt_clock = 1;
          }

***************
*** 638,648 ****
#endif
}

static int64_t get_clock(void)
{
! #if defined(__linux__)

      if (use_rt_clock) {
          struct timespec ts;
          clock_gettime(CLOCK_MONOTONIC, &ts);
          return ts.tv_sec * 1000000000LL + ts.tv_nsec;
      } else 

--- 647,657 ----
#endif
}

static int64_t get_clock(void)
{
! #if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000)

      if (use_rt_clock) {
          struct timespec ts;
          clock_gettime(CLOCK_MONOTONIC, &ts);
          return ts.tv_sec * 1000000000LL + ts.tv_nsec;
      } else 
***************
*** 1639,1649 ****
          term_init();
      }
      return chr;

}

! #if defined(__linux__)
static CharDriverState *qemu_chr_open_pty(void)

  {
      struct termios tty;
      char slave_name[1024];
      int master_fd, slave_fd;
--- 1648,1658 ----
          term_init();
      }
      return chr;

}

! #if defined(__linux__) || defined(__FreeBSD__)
static CharDriverState *qemu_chr_open_pty(void)

  {
      struct termios tty;
      char slave_name[1024];
      int master_fd, slave_fd;

***************
*** 1718,1731 ****

      cfsetispeed(&tty, spd);
      cfsetospeed(&tty, spd);
  
      tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
!                           |INLCR|IGNCR|ICRNL|IXON);
!     tty.c_oflag |= OPOST;
      tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN|ISIG);
      tty.c_cflag &= ~(CSIZE|PARENB|PARODD|CRTSCTS|CSTOPB);
      switch(data_bits) {
      default:
      case 8:
          tty.c_cflag |= CS8;
          break;

--- 1727,1743 ----

      cfsetispeed(&tty, spd);
      cfsetospeed(&tty, spd);
  
      tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
!                           |INLCR|IGNCR|ICRNL|IXON|IMAXBEL);
!     tty.c_oflag &= ~OPOST; /* Don't do any output processing! */
      tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN|ISIG);
      tty.c_cflag &= ~(CSIZE|PARENB|PARODD|CRTSCTS|CSTOPB);
+ #ifdef __FreeBSD__
+     cfmakeraw(&tty);
+ #endif
      switch(data_bits) {
      default:
      case 8:
          tty.c_cflag |= CS8;
          break;
***************
*** 1797,1806 ****
--- 1809,1819 ----
      chr->chr_ioctl = tty_serial_ioctl;
      qemu_chr_reset(chr);
      return chr;

}

+ #if defined(__linux__)
static int pp_ioctl(CharDriverState *chr, int cmd, void *arg)

  {
      int fd = (int)chr->opaque;
      uint8_t b;

***************
*** 1861,1870 ****
--- 1874,1941 ----

      qemu_chr_reset(chr);
  
      return chr;

}
+ #elif defined(__FreeBSD__)
+ static int pp_ioctl(CharDriverState *chr, int cmd, void *arg)
+ {

(quoted diff) +55 -0
+     int fd = (int)chr->opaque;
+     uint8_t b;
+ 
+     switch(cmd) {
+     case CHR_IOCTL_PP_READ_DATA:
+         if (ioctl(fd, PPIGDATA, &b) < 0)
+             return -ENOTSUP;
+         *(uint8_t *)arg = b;
+         break;
+     case CHR_IOCTL_PP_WRITE_DATA:
+         b = *(uint8_t *)arg;
+         if (ioctl(fd, PPISDATA, &b) < 0)
+             return -ENOTSUP;
+         break;
+     case CHR_IOCTL_PP_READ_CONTROL:
+         if (ioctl(fd, PPIGCTRL, &b) < 0)
+             return -ENOTSUP;
+         *(uint8_t *)arg = b;
+         break;
+     case CHR_IOCTL_PP_WRITE_CONTROL:
+         b = *(uint8_t *)arg;
+         if (ioctl(fd, PPISCTRL, &b) < 0)
+             return -ENOTSUP;
+         break;
+     case CHR_IOCTL_PP_READ_STATUS:
+         if (ioctl(fd, PPIGSTATUS, &b) < 0)
+             return -ENOTSUP;
+         *(uint8_t *)arg = b;
+         break;
+     default:
+         return -ENOTSUP;
+     }
+     return 0;
+ }
+ 
+ CharDriverState *qemu_chr_open_pp(const char *filename)
+ {
+     CharDriverState *chr;
+     int fd;
+ 
+     fd = open(filename, O_RDWR);
+     if (fd < 0)
+         return NULL;
+ 
+     chr = qemu_mallocz(sizeof(CharDriverState));
+     if (!chr) {
+         close(fd);
+         return NULL;
+     }
+     chr->opaque = (void *)fd;
+     chr->chr_write = null_chr_write;
+     chr->chr_ioctl = pp_ioctl;
+     return chr;
+ }
+ #endif
 
  #else
  static CharDriverState *qemu_chr_open_pty(void)
  {
      return NULL;

***************
*** 2737,2746 ****
--- 2808,2824 ----

          return qemu_chr_open_pp(filename);
      } else 
      if (strstart(filename, "/dev/", NULL)) {
          return qemu_chr_open_tty(filename);
      } else 

+ #elif defined(__FreeBSD__)

(quoted diff) +6 -0
+     if (strstart(filename, "/dev/ppi", NULL)) {
+         return qemu_chr_open_pp(filename);
+     } else 
+     if (strstart(filename, "/dev/", NULL)) {
+         return qemu_chr_open_tty(filename);
+     } else 
  #endif
  #ifdef _WIN32
      if (strstart(filename, "COM", NULL)) {
          return qemu_chr_open_win(filename);
      } else

***************
*** 3169,3178 ****
--- 3247,3284 ----

  #endif /* !defined(_WIN32) */
  
  #endif /* CONFIG_SLIRP */

+ #ifdef __FreeBSD__
+ #define LOAD_QUIETLY 1
+ #define LOAD_VERBOSLY 2
+
+ int
+ loadmodules(int how, const char *module, ...)
+ {

(quoted diff) +21 -0
+   int loaded = 0;
+   va_list ap;
+ 
+   va_start(ap, module);
+ #ifndef NO_MODULES
+   while (module != NULL) {
+     if (modfind(module) == -1) {
+       if (kldload(module) == -1) {
+         if (how == LOAD_VERBOSLY)
+           fprintf(stderr, "%s: Cannot load module\n", module);
+       } else
+         loaded++;
+     }
+     module = va_arg(ap, const char *);
+   }
+   va_end(ap);
+ #endif
+   return loaded;
+ }
+ #endif
+ 
  #if !defined(_WIN32)
 
  typedef struct TAPState {
      VLANClientState *vc;
      int fd;

***************
*** 3224,3238 ****

  {
      int fd;
      char *dev;
      struct stat s;
  
      fd = open("/dev/tap", O_RDWR);
      if (fd < 0) {
!         fprintf(stderr, "warning: could not open /dev/tap: no virtual network emulation\n");
          return -1;
      }
  
      fstat(fd, &s);
      dev = devname(s.st_rdev, S_IFCHR);
      pstrcpy(ifname, ifname_size, dev);

--- 3330,3388 ----

  {
      int fd;
      char *dev;
      struct stat s;

+ #ifdef __FreeBSD__

(quoted diff) +42 -0
+     int i, kldtried = 0, enoentcount = 0, err = 0;
+     char dname[100];
+ #ifdef USE_DEVTAP
+     /*
+      * 5.x has /dev/tap, but that seems to just blindly increase its
+      * couter on every open() for some people(??), i.e. on every qemu run.
+      */
+     i = -1;
+ #else
+     i = 0;
+ #endif
+     for (; i < 10; i++) {
+         if (i == -1)
+ 	    strcpy(dname, "/dev/tap");
+         else
+ 	    snprintf(dname, sizeof dname, "%s%d",
+ 		     "/dev/tap", i);
+         fd = open(dname, O_RDWR);
+         if (fd >= 0)
+             break;
+         else if (errno == ENXIO || errno == ENOENT) {
+             if (i == 0 && !kldtried++) {
+                 /*
+                  * Attempt to load the tunnel interface KLD if it isn't loaded
+                  * already.
+                  */
+                 if (loadmodules(LOAD_VERBOSLY, "if_tap", NULL))
+                     i = -1;
+                 continue;
+             }
+             if (errno != ENOENT || ++enoentcount > 3) {
+                 err = errno;
+ 	        break;
+             }
+         } else
+             err = errno;
+     }
+     if (fd < 0) {
+         fprintf(stderr, "warning: could not open %s (%s): no virtual network emulation\n", dname, strerror(err));
+         return -1;
+     }
+ #else
      fd = open("/dev/tap", O_RDWR);
      if (fd < 0) {
!         fprintf(stderr, "warning: could not open /dev/tap (%s): no virtual network emulation\n", strerror(errno));
          return -1;
      }

+ #endif

      fstat(fd, &s);
      dev = devname(s.st_rdev, S_IFCHR);
      pstrcpy(ifname, ifname_size, dev);

***************
*** 6199,6208 ****
--- 6349,6359 ----
QEMU_OPTION_win2k_hack,
QEMU_OPTION_usb,
QEMU_OPTION_usbdevice,
QEMU_OPTION_smp,
QEMU_OPTION_vnc,
+ QEMU_OPTION_vncname,
QEMU_OPTION_no_acpi,
QEMU_OPTION_no_reboot,
QEMU_OPTION_daemonize,
QEMU_OPTION_option_rom,
QEMU_OPTION_semihosting
***************
*** 6279,6288 ****
--- 6430,6440 ----

      { "pidfile", HAS_ARG, QEMU_OPTION_pidfile },
      { "win2k-hack", 0, QEMU_OPTION_win2k_hack },
      { "usbdevice", HAS_ARG, QEMU_OPTION_usbdevice },
      { "smp", HAS_ARG, QEMU_OPTION_smp },
      { "vnc", HAS_ARG, QEMU_OPTION_vnc },

+ { "vncname", HAS_ARG, QEMU_OPTION_vncname },

      /* temporary options */
      { "usb", 0, QEMU_OPTION_usb },
      { "cirrusvga", 0, QEMU_OPTION_cirrusvga },
      { "no-acpi", 0, QEMU_OPTION_no_acpi },
***************
*** 6704,6713 ****
--- 6856,6866 ----
                  }
                  break;
              case QEMU_OPTION_nographic:
                  pstrcpy(monitor_device, sizeof(monitor_device), "stdio");
                  pstrcpy(serial_devices[0], sizeof(serial_devices[0]), "stdio");
+                 pstrcpy(parallel_devices[0], sizeof(parallel_devices[0]), "null");
                  nographic = 1;
                  break;
              case QEMU_OPTION_kernel:
                  kernel_filename = optarg;
                  break;
***************
*** 6936,6945 ****
--- 7089,7101 ----
                  }
                  break;

case QEMU_OPTION_vnc:
vnc_display = optarg;
break;

(quoted diff) +3 -0
+             case QEMU_OPTION_vncname:
+                 vnc_name = optarg;
+                 break;
              case QEMU_OPTION_no_acpi:
                  acpi_enabled = 0;
                  break;
              case QEMU_OPTION_no_reboot:
                  no_reboot = 1;

*** vl.h Fri Feb 16 13:27:06 2007
--- /home/reddawg/qemu/work/qemu-0.9.0/vl.h Fri Feb 16 13:30:23 2007
***************
*** 1,9 ****
--- 1,10 ----
/*
* QEMU System Emulator header
*
* Copyright (c) 2003 Fabrice Bellard
+ * Copyright (C) 2007 Christopher Olsen <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
***************
*** 28,37 ****
--- 29,44 ----
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <inttypes.h>
+ #ifndef PRId64
+ #define PRId64 "lld" /* int64_t */
+ #define PRIo64 "llo" /* int64_t */
+ #define PRIx64 "llx" /* int64_t */
+ #define PRIu64 "llu" /* int64_t */
+ #endif
#include <limits.h>
#include <time.h>
#include <ctype.h>
#include <errno.h>
#include <unistd.h>
***************
*** 110,119 ****
--- 117,129 ----
uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);

  void hw_error(const char *fmt, ...);

extern const char *bios_dir;
+
+ //UBU
+ extern const char *vnc_name;

extern int vm_running;

typedef struct vm_change_state_entry VMChangeStateEntry;
typedef void VMChangeStateHandler(void *opaque, int running);
*** vnc.c Fri Feb 16 13:27:06 2007
--- /home/reddawg/qemu/work/qemu-0.9.0/vnc.c Fri Feb 16 13:29:13 2007
***************
*** 1,10 ****
--- 1,11 ----
/*
* QEMU VNC display driver
*
* Copyright (C) 2006 Anthony Liguori <[email protected]>
* Copyright (C) 2006 Fabrice Bellard
+ * Copyright (C) 2007 Christopher Olsen <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
***************
*** 1054,1063 ****
--- 1055,1065 ----
}

static int protocol_client_init(VncState *vs, char *data, size_t len)

  {
      char pad[3] = { 0, 0, 0 };

+ char name[64];

      vs->width = vs->ds->width;
      vs->height = vs->ds->height;
      vnc_write_u16(vs, vs->ds->width);
      vnc_write_u16(vs, vs->ds->height);
***************
*** 1098,1109 ****
      }
      vs->write_pixels = vnc_write_pixels_copy;
  	
      vnc_write(vs, pad, 3);           /* padding */
!     vnc_write_u32(vs, 4);        !     vnc_write(vs, "QEMU", 4);
      vnc_flush(vs);
  
      vnc_read_when(vs, protocol_client_msg, 1);
  
      return 0;
--- 1100,1115 ----
      }
      vs->write_pixels = vnc_write_pixels_copy;
  	
      vnc_write(vs, pad, 3);           /* padding */

! if (vnc_name == 0x0)
! sprintf(name, "QEMU: Unknown");
! else
! sprintf(name, "QEMU: %s",vnc_name);
! vnc_write_u32(vs, strlen(name));

!     vnc_write(vs, name, strlen(name));
      vnc_flush(vs);
  
      vnc_read_when(vs, protocol_client_msg, 1);
  
      return 0;

------------------------------------------------------------------------

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

#4 lore raw

Anthony,

Actually I have a version 2 to my patch which I will forward in by tomorrow which allows for vnc authentication..

-Christopher

Quoted 600 lines · Anthony Liguori
Quoted 1 line · Christopher Olsen

I didn't see a way so here is a patch for it work on 0.9.0

I've got a more generic -name patch I've been sitting on. It adds a title for the VNC session and SDL session. If there's interest, I can push it further ahead in my queue.

Regards,

Anthony Liguori

Quoted 578 lines

-Christopher

Quoted 3 lines · Christopher Olsen

Anyone here know if there is a way to append to the VNC display header?

-Christopher

------------------------------------------------------------------------

*** vl.c Fri Feb 16 13:27:06 2007
--- /home/reddawg/qemu/work/qemu-0.9.0/vl.c Fri Feb 16 13:30:09 2007
***************
*** 1,9 ****
--- 1,10 ----
/*
* QEMU System Emulator
*
* Copyright (c) 2003-2007 Fabrice Bellard
+ * Copyright (C) 2007 Christopher Olsen <[email protected]> *
* Permission is hereby granted, free of charge, to any person
obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *************** *** 45,54 ****
--- 46,60 ----
#ifdef _BSD
#include <sys/stat.h>
#ifndef __APPLE__
#include <libutil.h>
#endif
+ #ifdef __FreeBSD__
+ #include <sys/module.h>
+ #include <dev/ppbus/ppi.h>
+ #include <dev/ppbus/ppbconf.h>
+ #endif
#else
#ifndef __sun__
#include <linux/if.h>
#include <linux/if_tun.h>
#include <pty.h>
***************
*** 87,101 ****
--- 93,109 ----
#include "disas.h"

  #include "exec-all.h"

#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
+ #ifndef SMBD_COMMAND
#ifdef __sun__
#define SMBD_COMMAND "/usr/sfw/sbin/smbd"
#else
#define SMBD_COMMAND "/usr/sbin/smbd"
#endif
+ #endif

//#define DEBUG_UNUSED_IOPORT
//#define DEBUG_IOPORT

#define PHYS_RAM_MAX_SIZE (2047 * 1024 * 1024)
***************
*** 156,165 ****
--- 164,174 ----
#endif
int usb_enabled = 0;
static VLANState *first_vlan;
int smp_cpus = 1;
const char *vnc_display;
+ const char *vnc_name;
#if defined(TARGET_SPARC)
#define MAX_CPUS 16
#elif defined(TARGET_I386)
#define MAX_CPUS 255
#else
***************
*** 626,636 ****
static int use_rt_clock;

static void init_get_clock(void)

  {
      use_rt_clock = 0;
! #if defined(__linux__)
      {
          struct timespec ts;
          if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
              use_rt_clock = 1;
          }

--- 635,645 ----
static int use_rt_clock;

static void init_get_clock(void)

  {
      use_rt_clock = 0;
! #if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >=
500000) {
          struct timespec ts;
          if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
              use_rt_clock = 1;
          }

***************
*** 638,648 ****
#endif
}

static int64_t get_clock(void)
{
! #if defined(__linux__)

      if (use_rt_clock) {
          struct timespec ts;
          clock_gettime(CLOCK_MONOTONIC, &ts);
          return ts.tv_sec * 1000000000LL + ts.tv_nsec;
      } else

--- 647,657 ----
#endif
}

static int64_t get_clock(void)
{
! #if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >=

500000) if (use_rt_clock) {
          struct timespec ts;
          clock_gettime(CLOCK_MONOTONIC, &ts);
          return ts.tv_sec * 1000000000LL + ts.tv_nsec;
      } else
***************
*** 1639,1649 ****
          term_init();
      }
      return chr;

}

! #if defined(__linux__)
static CharDriverState *qemu_chr_open_pty(void)

  {
      struct termios tty;
      char slave_name[1024];
      int master_fd, slave_fd;
--- 1648,1658 ----
          term_init();
      }
      return chr;

}

! #if defined(__linux__) || defined(__FreeBSD__)
static CharDriverState *qemu_chr_open_pty(void)

  {
      struct termios tty;
      char slave_name[1024];
      int master_fd, slave_fd;

***************
*** 1718,1731 ****

      cfsetispeed(&tty, spd);
      cfsetospeed(&tty, spd);

      tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
!                           |INLCR|IGNCR|ICRNL|IXON);
!     tty.c_oflag |= OPOST;
      tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN|ISIG);
      tty.c_cflag &= ~(CSIZE|PARENB|PARODD|CRTSCTS|CSTOPB);
      switch(data_bits) {
      default:
      case 8:
          tty.c_cflag |= CS8;
          break;

--- 1727,1743 ----

      cfsetispeed(&tty, spd);
      cfsetospeed(&tty, spd);

      tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
!                           |INLCR|IGNCR|ICRNL|IXON|IMAXBEL);
!     tty.c_oflag &= ~OPOST; /* Don't do any output processing! */
      tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN|ISIG);
      tty.c_cflag &= ~(CSIZE|PARENB|PARODD|CRTSCTS|CSTOPB);
+ #ifdef __FreeBSD__
+     cfmakeraw(&tty);
+ #endif
      switch(data_bits) {
      default:
      case 8:
          tty.c_cflag |= CS8;
          break;
***************
*** 1797,1806 ****
--- 1809,1819 ----
      chr->chr_ioctl = tty_serial_ioctl;
      qemu_chr_reset(chr);
      return chr;

}

+ #if defined(__linux__)
static int pp_ioctl(CharDriverState *chr, int cmd, void *arg)

  {
      int fd = (int)chr->opaque;
      uint8_t b;

***************
*** 1861,1870 ****
--- 1874,1941 ----

      qemu_chr_reset(chr);

      return chr;

}
+ #elif defined(__FreeBSD__)
+ static int pp_ioctl(CharDriverState *chr, int cmd, void *arg)
+ {

(quoted diff) +55 -0
+     int fd = (int)chr->opaque;
+     uint8_t b;
+
+     switch(cmd) {
+     case CHR_IOCTL_PP_READ_DATA:
+         if (ioctl(fd, PPIGDATA, &b) < 0)
+             return -ENOTSUP;
+         *(uint8_t *)arg = b;
+         break;
+     case CHR_IOCTL_PP_WRITE_DATA:
+         b = *(uint8_t *)arg;
+         if (ioctl(fd, PPISDATA, &b) < 0)
+             return -ENOTSUP;
+         break;
+     case CHR_IOCTL_PP_READ_CONTROL:
+         if (ioctl(fd, PPIGCTRL, &b) < 0)
+             return -ENOTSUP;
+         *(uint8_t *)arg = b;
+         break;
+     case CHR_IOCTL_PP_WRITE_CONTROL:
+         b = *(uint8_t *)arg;
+         if (ioctl(fd, PPISCTRL, &b) < 0)
+             return -ENOTSUP;
+         break;
+     case CHR_IOCTL_PP_READ_STATUS:
+         if (ioctl(fd, PPIGSTATUS, &b) < 0)
+             return -ENOTSUP;
+         *(uint8_t *)arg = b;
+         break;
+     default:
+         return -ENOTSUP;
+     }
+     return 0;
+ }
+
+ CharDriverState *qemu_chr_open_pp(const char *filename)
+ {
+     CharDriverState *chr;
+     int fd;
+
+     fd = open(filename, O_RDWR);
+     if (fd < 0)
+         return NULL;
+
+     chr = qemu_mallocz(sizeof(CharDriverState));
+     if (!chr) {
+         close(fd);
+         return NULL;
+     }
+     chr->opaque = (void *)fd;
+     chr->chr_write = null_chr_write;
+     chr->chr_ioctl = pp_ioctl;
+     return chr;
+ }
+ #endif
 
  #else
  static CharDriverState *qemu_chr_open_pty(void)
  {
      return NULL;

***************
*** 2737,2746 ****
--- 2808,2824 ----

          return qemu_chr_open_pp(filename);
      } else
      if (strstart(filename, "/dev/", NULL)) {
          return qemu_chr_open_tty(filename);
      } else

+ #elif defined(__FreeBSD__)

(quoted diff) +6 -0
+     if (strstart(filename, "/dev/ppi", NULL)) {
+         return qemu_chr_open_pp(filename);
+     } else
+     if (strstart(filename, "/dev/", NULL)) {
+         return qemu_chr_open_tty(filename);
+     } else
  #endif
  #ifdef _WIN32
      if (strstart(filename, "COM", NULL)) {
          return qemu_chr_open_win(filename);
      } else

***************
*** 3169,3178 ****
--- 3247,3284 ----

  #endif /* !defined(_WIN32) */

  #endif /* CONFIG_SLIRP */

+ #ifdef __FreeBSD__
+ #define LOAD_QUIETLY 1
+ #define LOAD_VERBOSLY 2

(quoted diff) +25 -0
+
+ int
+ loadmodules(int how, const char *module, ...)
+ {
+   int loaded = 0;
+   va_list ap;
+
+   va_start(ap, module);
+ #ifndef NO_MODULES
+   while (module != NULL) {
+     if (modfind(module) == -1) {
+       if (kldload(module) == -1) {
+         if (how == LOAD_VERBOSLY)
+           fprintf(stderr, "%s: Cannot load module\n", module);
+       } else
+         loaded++;
+     }
+     module = va_arg(ap, const char *);
+   }
+   va_end(ap);
+ #endif
+   return loaded;
+ }
+ #endif
+
  #if !defined(_WIN32)
 
  typedef struct TAPState {
      VLANClientState *vc;
      int fd;

***************
*** 3224,3238 ****

  {
      int fd;
      char *dev;
      struct stat s;

      fd = open("/dev/tap", O_RDWR);
      if (fd < 0) {
!         fprintf(stderr, "warning: could not open /dev/tap: no virtual
network emulation\n"); return -1;
      }

      fstat(fd, &s);
      dev = devname(s.st_rdev, S_IFCHR);
      pstrcpy(ifname, ifname_size, dev);

--- 3330,3388 ----

  {
      int fd;
      char *dev;
      struct stat s;

+ #ifdef __FreeBSD__

(quoted diff) +6 -0
+     int i, kldtried = 0, enoentcount = 0, err = 0;
+     char dname[100];
+ #ifdef USE_DEVTAP
+     /*
+      * 5.x has /dev/tap, but that seems to just blindly increase its
+      * couter on every open() for some people(??), i.e. on every qemu

run. + */

(quoted diff) +17 -0
+     i = -1;
+ #else
+     i = 0;
+ #endif
+     for (; i < 10; i++) {
+         if (i == -1)
+ 	    strcpy(dname, "/dev/tap");
+         else
+ 	    snprintf(dname, sizeof dname, "%s%d",
+ 		     "/dev/tap", i);
+         fd = open(dname, O_RDWR);
+         if (fd >= 0)
+             break;
+         else if (errno == ENXIO || errno == ENOENT) {
+             if (i == 0 && !kldtried++) {
+                 /*
+                  * Attempt to load the tunnel interface KLD if it isn't

loaded + * already.

(quoted diff) +14 -0
+                  */
+                 if (loadmodules(LOAD_VERBOSLY, "if_tap", NULL))
+                     i = -1;
+                 continue;
+             }
+             if (errno != ENOENT || ++enoentcount > 3) {
+                 err = errno;
+ 	        break;
+             }
+         } else
+             err = errno;
+     }
+     if (fd < 0) {
+         fprintf(stderr, "warning: could not open %s (%s): no virtual

network emulation\n", dname, strerror(err)); + return -1;
+ }
+ #else

      fd = open("/dev/tap", O_RDWR);
      if (fd < 0) {
!         fprintf(stderr, "warning: could not open /dev/tap (%s): no
virtual network emulation\n", strerror(errno)); return -1;
      }

+ #endif

      fstat(fd, &s);
      dev = devname(s.st_rdev, S_IFCHR);
      pstrcpy(ifname, ifname_size, dev);

***************
*** 6199,6208 ****
--- 6349,6359 ----
QEMU_OPTION_win2k_hack,
QEMU_OPTION_usb,
QEMU_OPTION_usbdevice,
QEMU_OPTION_smp,
QEMU_OPTION_vnc,
+ QEMU_OPTION_vncname,
QEMU_OPTION_no_acpi,
QEMU_OPTION_no_reboot,
QEMU_OPTION_daemonize,
QEMU_OPTION_option_rom,
QEMU_OPTION_semihosting
***************
*** 6279,6288 ****
--- 6430,6440 ----

      { "pidfile", HAS_ARG, QEMU_OPTION_pidfile },
      { "win2k-hack", 0, QEMU_OPTION_win2k_hack },
      { "usbdevice", HAS_ARG, QEMU_OPTION_usbdevice },
      { "smp", HAS_ARG, QEMU_OPTION_smp },
      { "vnc", HAS_ARG, QEMU_OPTION_vnc },

+ { "vncname", HAS_ARG, QEMU_OPTION_vncname },

      /* temporary options */
      { "usb", 0, QEMU_OPTION_usb },
      { "cirrusvga", 0, QEMU_OPTION_cirrusvga },
      { "no-acpi", 0, QEMU_OPTION_no_acpi },
***************
*** 6704,6713 ****
--- 6856,6866 ----
                  }
                  break;
              case QEMU_OPTION_nographic:
                  pstrcpy(monitor_device, sizeof(monitor_device),
"stdio"); pstrcpy(serial_devices[0], sizeof(serial_devices[0]), "stdio");
+                 pstrcpy(parallel_devices[0],
sizeof(parallel_devices[0]), "null"); nographic = 1;
                  break;
              case QEMU_OPTION_kernel:
                  kernel_filename = optarg;
                  break;
***************
*** 6936,6945 ****
--- 7089,7101 ----
                  }
                  break;

case QEMU_OPTION_vnc:
vnc_display = optarg;
break;

(quoted diff) +3 -0
+             case QEMU_OPTION_vncname:
+                 vnc_name = optarg;
+                 break;
              case QEMU_OPTION_no_acpi:
                  acpi_enabled = 0;
                  break;
              case QEMU_OPTION_no_reboot:
                  no_reboot = 1;

*** vl.h Fri Feb 16 13:27:06 2007
--- /home/reddawg/qemu/work/qemu-0.9.0/vl.h Fri Feb 16 13:30:23 2007
***************
*** 1,9 ****
--- 1,10 ----
/*
* QEMU System Emulator header
*
* Copyright (c) 2003 Fabrice Bellard
+ * Copyright (C) 2007 Christopher Olsen <[email protected]> *
* Permission is hereby granted, free of charge, to any person
obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *************** *** 28,37 ****
--- 29,44 ----
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <inttypes.h>
+ #ifndef PRId64
+ #define PRId64 "lld" /* int64_t */
+ #define PRIo64 "llo" /* int64_t */
+ #define PRIx64 "llx" /* int64_t */
+ #define PRIu64 "llu" /* int64_t */
+ #endif
#include <limits.h>
#include <time.h>
#include <ctype.h>
#include <errno.h>
#include <unistd.h>
***************
*** 110,119 ****
--- 117,129 ----
uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);

  void hw_error(const char *fmt, ...);

extern const char *bios_dir;
+
+ //UBU
+ extern const char *vnc_name;

extern int vm_running;

typedef struct vm_change_state_entry VMChangeStateEntry; typedef void VMChangeStateHandler(void *opaque, int running);
*** vnc.c Fri Feb 16 13:27:06 2007
--- /home/reddawg/qemu/work/qemu-0.9.0/vnc.c Fri Feb 16 13:29:13 2007
***************
*** 1,10 ****
--- 1,11 ----
/*
* QEMU VNC display driver
*
* Copyright (C) 2006 Anthony Liguori <[email protected]>
* Copyright (C) 2006 Fabrice Bellard
+ * Copyright (C) 2007 Christopher Olsen <[email protected]> *
* Permission is hereby granted, free of charge, to any person
obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *************** *** 1054,1063 ****
--- 1055,1065 ----
}

static int protocol_client_init(VncState *vs, char *data, size_t len)

  {
      char pad[3] = { 0, 0, 0 };

+ char name[64];

      vs->width = vs->ds->width;
      vs->height = vs->ds->height;
      vnc_write_u16(vs, vs->ds->width);
      vnc_write_u16(vs, vs->ds->height);
***************
*** 1098,1109 ****
      }
      vs->write_pixels = vnc_write_pixels_copy;

      vnc_write(vs, pad, 3);           /* padding */

! vnc_write_u32(vs, 4);

!     vnc_write(vs, "QEMU", 4);
      vnc_flush(vs);

      vnc_read_when(vs, protocol_client_msg, 1);

      return 0;
--- 1100,1115 ----
      }
      vs->write_pixels = vnc_write_pixels_copy;

      vnc_write(vs, pad, 3);           /* padding */

! if (vnc_name == 0x0)
! sprintf(name, "QEMU: Unknown");
! else
! sprintf(name, "QEMU: %s",vnc_name);
! vnc_write_u32(vs, strlen(name));

!     vnc_write(vs, name, strlen(name));
      vnc_flush(vs);

      vnc_read_when(vs, protocol_client_msg, 1);

      return 0;
Quoted 6 lines

------------------------------------------------------------------------

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Signature · 4 lines
Christopher Olsen
[email protected]
Tel: 631-676-4877
Fax: 631-249-3036
#5 lore raw

Hi,

Quoted 2 lines · Christopher Olsen

Actually I have a version 2 to my patch which I will forward in by tomorrow which allows for vnc authentication..

Which one? AFAICT there are three authentication methods, one of which is not secure at all. Another one is no vnc authentication at all, but rather an ssh authentication. The third method does not encrypt the rest of the protocol, so is not secure. (And yes, there exists a fourth method, which appears to be purely VNC, but which is not open source.)

Ciao,
Dscho

P.S.: I forgot to mention that your patch is not in unified format, which seems to be the preferred patch format on this list.

#6 lore raw

Sorry I'll attempt to use the preferred patching method in the future..

Secure vnc auth method the default built in method from

Quoted 24 lines · Johannes Schindelin

Hi,

Quoted 2 lines · Christopher Olsen

Actually I have a version 2 to my patch which I will forward in by tomorrow which allows for vnc authentication..

Which one? AFAICT there are three authentication methods, one of which is not secure at all. Another one is no vnc authentication at all, but rather an ssh authentication. The third method does not encrypt the rest of the protocol, so is not secure. (And yes, there exists a fourth method, which appears to be purely VNC, but which is not open source.)

Ciao,
Dscho

P.S.: I forgot to mention that your patch is not in unified format, which seems to be the preferred patch format on this list.

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Signature · 4 lines
Christopher Olsen
[email protected]
Tel: 631-676-4877
Fax: 631-249-3036
#7 lore raw

Hi,

Quoted 1 line · Christopher Olsen

Secure vnc auth method the default built in method from

... yes?

Ciao,
Dscho

#8 lore raw
In reply to Christopher Olsen
Quoted 4 lines · Christopher Olsen

Sorry I'll attempt to use the preferred patching method in the future..

Secure vnc auth method the default built in method from

We can't take a password from a command line. Supporting VNC auth is super easy otherwise. I really think we need to have a config file before we can do VNC passwords.

Regards,

Anthony Liguori

Quoted 30 lines · Johannes Schindelin
Quoted 27 lines

Hi,

Quoted 3 lines · Christopher Olsen

Actually I have a version 2 to my patch which I will forward in by tomorrow which allows for vnc authentication..

Which one? AFAICT there are three authentication methods, one of which is not secure at all. Another one is no vnc authentication at all, but rather an ssh authentication. The third method does not encrypt the rest of the protocol, so is not secure. (And yes, there exists a fourth method, which appears to be purely VNC, but which is not open source.)

Ciao,
Dscho

P.S.: I forgot to mention that your patch is not in unified format, which seems to be the preferred patch format on this list.

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

#9 lore raw

Hi,

Quoted 9 lines · Anthony Liguori
Quoted 4 lines · Christopher Olsen

Sorry I'll attempt to use the preferred patching method in the future..

Secure vnc auth method the default built in method from

We can't take a password from a command line. Supporting VNC auth is super easy otherwise. I really think we need to have a config file before we can do VNC passwords.

No, you should not do VNC passwords. The default VNC password exchange is insecure and you should not lure users into believing in that false security.

Ciao,
Dscho

#10 lore raw
Quoted 9 lines · Johannes Schindelin

Hi,

Quoted 4 lines · Anthony Liguori
Quoted 2 lines · Christopher Olsen

Sorry I'll attempt to use the preferred patching method in the future..

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Secure vnc auth method the default built in method from

We can't take a password from a command line. Supporting VNC auth is super easy otherwise. I really think we need to have a config file before we can do VNC passwords.

No, you should not do VNC passwords. The default VNC password exchange is insecure and you should not lure users into believing in that false security.

I actually agree with you.

Regards,

Anthony Liguori

Quoted 5 lines

Ciao,
Dscho

#11 lore raw

In regards to all this

Johannes... You're correct the challenge response method for authentication inside of VNC isn't secure at all it's like locking your screen door at home will keep most people out just not the ones who really want to get in...

I've done some further thought and investigation and as far as using QEMU inside a Unix environment, I see no reason as to why the authentication couldn't be tied into PAM...

Any thoughts?

-Christopher

Quoted 30 lines · Anthony Liguori
Quoted 8 lines · Johannes Schindelin

Hi,

Quoted 5 lines · Anthony Liguori
Quoted 3 lines · Christopher Olsen

Sorry I'll attempt to use the preferred patching method in the future..

Secure vnc auth method the default built in method from

Quoted 7 lines
Quoted 3 lines

We can't take a password from a command line. Supporting VNC auth is super easy otherwise. I really think we need to have a config file before we can do VNC passwords.

No, you should not do VNC passwords. The default VNC password exchange is insecure and you should not lure users into believing in that false security.

I actually agree with you.

Regards,

Anthony Liguori

Quoted 2 lines

Ciao,
Dscho

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Signature · 4 lines
Christopher Olsen
[email protected]
Tel: 631-676-4877
Fax: 631-249-3036
#12 lore raw

Hi,

Quoted 3 lines · Christopher Olsen

I've done some further thought and investigation and as far as using QEMU inside a Unix environment, I see no reason as to why the authentication couldn't be tied into PAM...

Because this is supposed to be a standard protocol, meant for widespread use, not just on Unix.

I see many developments in the VNC protocol lately, which only target one special use case. Which is quite sad, because I think that with just a little more thought the results would be so much more useful for others, too.

See for example the inbuilt VNC server in QEmu. It does not exchange any code with any other VNC implementation. So, every improvement in this or that implementation is lost on all the others. Like I said, sad.

Ciao,
Dscho

#13 lore raw

Understandable...

However I'm not sure about others and how they intend to use QEMU.. But I for one know that I do have a use for authentication within the VNC session..

You're right that it's supposed to be a standard protocol but it doesn't appread to be from the many different flavors of VNC i've seen and how they license it.

-Christopher

Quoted 28 lines · Johannes Schindelin

Hi,

Quoted 3 lines · Christopher Olsen

I've done some further thought and investigation and as far as using QEMU inside a Unix environment, I see no reason as to why the authentication couldn't be tied into PAM...

Because this is supposed to be a standard protocol, meant for widespread use, not just on Unix.

I see many developments in the VNC protocol lately, which only target one special use case. Which is quite sad, because I think that with just a little more thought the results would be so much more useful for others, too.

See for example the inbuilt VNC server in QEmu. It does not exchange any code with any other VNC implementation. So, every improvement in this or that implementation is lost on all the others. Like I said, sad.

Ciao,
Dscho

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Signature · 4 lines
Christopher Olsen
[email protected]
Tel: 631-676-4877
Fax: 631-249-3036
#14 lore raw
In reply to Johannes Schindelin
Quoted 10 lines · Johannes Schindelin

Hi,

Quoted 6 lines · Anthony Liguori
Quoted 4 lines · Christopher Olsen

Sorry I'll attempt to use the preferred patching method in the future..

Secure vnc auth method the default built in method from

Quoted 7 lines
Quoted 3 lines

We can't take a password from a command line. Supporting VNC auth is super easy otherwise. I really think we need to have a config file before we can do VNC passwords.

No, you should not do VNC passwords. The default VNC password exchange is insecure and you should not lure users into believing in that false security.

Sure it is insecure over an unencrypted network channel, but if you are tunnelling the VNC connection over SSH, or have restricted it to only bind to 127.0.0.1 then AFAIK it is just fine. So supporting VNC password auth would allow users on a shared machine to secure the console from other unprivileged users on the same box. Definitely useful over the current situation where there's no way to secure even the local-only case. For a serious general purpose authentication I'd like to see the TLS protocol extension for VNC (as implemented in VeNCrypt) supported allowing both secure auth & wire encryption.

Dan.

Signature · 4 lines
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
#15 lore raw
Quoted 28 lines · Daniel P. Berrange
Quoted 9 lines · Johannes Schindelin

Hi,

Quoted 6 lines · Anthony Liguori
Quoted 4 lines · Christopher Olsen

Sorry I'll attempt to use the preferred patching method in the future..

Secure vnc auth method the default built in method from

Quoted 7 lines
Quoted 3 lines

We can't take a password from a command line. Supporting VNC auth is super easy otherwise. I really think we need to have a config file before we can do VNC passwords.

No, you should not do VNC passwords. The default VNC password exchange is insecure and you should not lure users into believing in that false security.

Sure it is insecure over an unencrypted network channel, but if you are tunnelling the VNC connection over SSH, or have restricted it to only bind to 127.0.0.1 then AFAIK it is just fine. So supporting VNC password auth would allow users on a shared machine to secure the console from other unprivileged users on the same box. Definitely useful over the current situation where there's no way to secure even the local-only case. For a serious general purpose authentication I'd like to see the TLS protocol extension for VNC (as implemented in VeNCrypt) supported allowing both secure auth & wire encryption.

Quoted 1 line

Dan.

I've Checked out the VeNCrypt.. Looks a little win32 oriented...

I'm gathering the problem here is that VNC is spinning off in many directions... So any implementation on the QEMU side will of course marry it to a particular VNC branch or I had an alternative idea..

That being the authentication can take place inside the VNC before the VM's frame buffer is attached.. This way whichever VNC client the enduser is using they can auth in.

-Christopher

Signature · 4 lines
Christopher Olsen
[email protected]
Tel: 631-676-4877
Fax: 631-249-3036
#16 lore raw
Quoted 30 lines · Christopher Olsen
Quoted 28 lines · Daniel P. Berrange
Quoted 9 lines · Johannes Schindelin

Hi,

Quoted 6 lines · Anthony Liguori
Quoted 4 lines · Christopher Olsen

Sorry I'll attempt to use the preferred patching method in the future..

Secure vnc auth method the default built in method from

Quoted 7 lines
Quoted 3 lines

We can't take a password from a command line. Supporting VNC auth is super easy otherwise. I really think we need to have a config file before we can do VNC passwords.

No, you should not do VNC passwords. The default VNC password exchange is insecure and you should not lure users into believing in that false security.

Sure it is insecure over an unencrypted network channel, but if you are tunnelling the VNC connection over SSH, or have restricted it to only bind to 127.0.0.1 then AFAIK it is just fine. So supporting VNC password auth would allow users on a shared machine to secure the console from other unprivileged users on the same box. Definitely useful over the current situation where there's no way to secure even the local-only case. For a serious general purpose authentication I'd like to see the TLS protocol extension for VNC (as implemented in VeNCrypt) supported allowing both secure auth & wire encryption.

Quoted 3 lines
Quoted 1 line

Dan.

I've Checked out the VeNCrypt.. Looks a little win32 oriented...

Guess you missed the 'unix' directory - I have compiled both server & client of VeNCrypt on Linux no trouble.

Quoted 3 lines

I'm gathering the problem here is that VNC is spinning off in many directions... So any implementation on the QEMU side will of course marry it to a particular VNC branch or I had an alternative idea..

I think the crux of the matter is that RealVNC sell a commercial version of VNC which offers real encryption. So I'm guessing that's why they've never merged any of the patches to do TLS encryption in the open source codebase. All the patches for VNC + TLS i've seen posted are iterations of each other - VeNCrypt is the most complete implenentation of any of them, so the one I'd go for out of the all the choices.

Regards,
Dan.

Signature · 4 lines
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
#17 lore raw
Quoted 14 lines · Daniel P. Berrange

Guess you missed the 'unix' directory - I have compiled both server & client of VeNCrypt on Linux no trouble.

Quoted 3 lines

I'm gathering the problem here is that VNC is spinning off in many directions... So any implementation on the QEMU side will of course marry it to a particular VNC branch or I had an alternative idea..

I think the crux of the matter is that RealVNC sell a commercial version of VNC which offers real encryption. So I'm guessing that's why they've never merged any of the patches to do TLS encryption in the open source codebase. All the patches for VNC + TLS i've seen posted are iterations of each other - VeNCrypt is the most complete implenentation of any of them, so the one I'd go for out of the all the choices.

Quoted 2 lines

Regards,
Dan.

I will take some further investigation into VeNCrypt.. I may have looked over it too quickly.

If it seams feasible then I will move forward with it later today provide that no wheels are in motion to this and/or there are no real objections to it.

-Christopher

Signature · 4 lines
Christopher Olsen
[email protected]
Tel: 631-676-4877
Fax: 631-249-3036
#18 lore raw
In reply to Daniel P. Berrange
Quoted 33 lines · Daniel P. Berrange
Quoted 26 lines · Christopher Olsen
Quoted 25 lines · Daniel P. Berrange
Quoted 7 lines · Johannes Schindelin

Hi,

Quoted 4 lines · Anthony Liguori
Quoted 3 lines · Christopher Olsen

Sorry I'll attempt to use the preferred patching method in the future..

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Secure vnc auth method the default built in method from

We can't take a password from a command line. Supporting VNC auth is super easy otherwise. I really think we need to have a config file before we can do VNC passwords.

No, you should not do VNC passwords. The default VNC password exchange is insecure and you should not lure users into believing in that false security.

Sure it is insecure over an unencrypted network channel, but if you are tunnelling the VNC connection over SSH, or have restricted it to only bind to 127.0.0.1 then AFAIK it is just fine. So supporting VNC password auth would allow users on a shared machine to secure the console from other unprivileged users on the same box. Definitely useful over the current situation where there's no way to secure even the local-only case. For a serious general purpose authentication I'd like to see the TLS protocol extension for VNC (as implemented in VeNCrypt) supported allowing both secure auth & wire encryption.

Quoted 2 lines
Quoted 1 line

Dan.

I've Checked out the VeNCrypt.. Looks a little win32 oriented...

Guess you missed the 'unix' directory - I have compiled both server & client of VeNCrypt on Linux no trouble.

Quoted 8 lines
Quoted 1 line

I'm gathering the problem here is that VNC is spinning off in many directions... So any implementation on the QEMU side will of course marry it to a particular VNC branch or I had an alternative idea..

I think the crux of the matter is that RealVNC sell a commercial version of VNC which offers real encryption. So I'm guessing that's why they've never merged any of the patches to do TLS encryption in the open source codebase. All the patches for VNC + TLS i've seen posted are iterations of each other - VeNCrypt is the most complete implenentation of any of them, so the one I'd go for out of the all the choices.

On the technical side, adding OpenSSL support in the current VNC implementation is QEMU seems easy (OpenSSL has a non blocking API which can be used with the current callback API).

Fabrice.

#19 lore raw
Quoted 7 lines · Fabrice Bellard

On the technical side, adding OpenSSL support in the current VNC implementation is QEMU seems easy (OpenSSL has a non blocking API which can be used with the current callback API).

Fabrice.

Good call... Let me look into that.

-Christopher

Signature · 4 lines
Christopher Olsen
[email protected]
Tel: 631-676-4877
Fax: 631-249-3036
#20 lore raw
Quoted 10 lines · Christopher Olsen
Quoted 7 lines · Fabrice Bellard

On the technical side, adding OpenSSL support in the current VNC implementation is QEMU seems easy (OpenSSL has a non blocking API which can be used with the current callback API).

Fabrice.

Good call... Let me look into that.

Actually OpenSSL has some potential licensing issues when combined with GPL code so I'd avoid it. The GNU TLS library, however, is just as easy to integrate into existing programs - I've modified a number of apps to use it very successfully. Or if you want support for all manner of crypto key management hardware devices, there's also Mozilla NSS libraries. All support non-blocking APIs, so aside from the extra code to do the TLS handshake and key verification, there's little modification needed to the main codebase - eg for GNU TLS once handshake is complete you can simply replace read()/write() calls with gnutls_read() / gnutls_write()

Regards,
Dan.

[1] http://lists.debian.org/debian-legal/2004/05/msg00595.html
http://www.gnome.org/~markmc/openssl-and-the-gpl.html

Signature · 4 lines
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
#21 lore raw
Quoted 14 lines · Daniel P. Berrange
Quoted 11 lines · Christopher Olsen
Quoted 7 lines · Fabrice Bellard

On the technical side, adding OpenSSL support in the current VNC implementation is QEMU seems easy (OpenSSL has a non blocking API which can be used with the current callback API).

Fabrice.

Good call... Let me look into that.

Quoted 10 lines

Actually OpenSSL has some potential licensing issues when combined with GPL code so I'd avoid it. The GNU TLS library, however, is just as easy to integrate into existing programs - I've modified a number of apps to use it very successfully. Or if you want support for all manner of crypto key management hardware devices, there's also Mozilla NSS libraries. All support non-blocking APIs, so aside from the extra code to do the TLS handshake and key verification, there's little modification needed to the main codebase - eg for GNU TLS once handshake is complete you can simply replace read()/write() calls with gnutls_read() / gnutls_write()

While this is all well and good, there is still the fundamental problem of how does one associate credentials with a VM. The actual security mechanism is, IMHO, just an implementation detail.

Regards,

Anthony Liguori

Quoted 6 lines

Regards,
Dan.

[1] http://lists.debian.org/debian-legal/2004/05/msg00595.html
http://www.gnome.org/~markmc/openssl-and-the-gpl.html

#22 lore raw
Quoted 8 lines · Anthony Liguori

While this is all well and good, there is still the fundamental problem of how does one associate credentials with a VM. The actual security mechanism is, IMHO, just an implementation detail.

Regards,

Anthony Liguori

Very true... So why not have QEMU contain it's own list of credentials? independent from the host system.. After all it is designed to produce VM's

Though my anticipated direction of QEMU and everyone else could be completely different. I for one know I'm on the hunt for an opensource product similar to VMware's ESX server which for simpler terms is a scaled up version of VMware Workstation running on a modified Linux kernel.

But for all intended purposes authentication into a VM could be beneficial to everyone collectively.

-Christopher

Signature · 4 lines
Christopher Olsen
[email protected]
Tel: 631-676-4877
Fax: 631-249-3036
#23 lore raw
In reply to Anthony Liguori
Quoted 26 lines · Anthony Liguori
Quoted 14 lines · Daniel P. Berrange
Quoted 11 lines · Christopher Olsen
Quoted 7 lines · Fabrice Bellard

On the technical side, adding OpenSSL support in the current VNC implementation is QEMU seems easy (OpenSSL has a non blocking API which can be used with the current callback API).

Fabrice.

Good call... Let me look into that.

Quoted 10 lines

Actually OpenSSL has some potential licensing issues when combined with GPL code so I'd avoid it. The GNU TLS library, however, is just as easy to integrate into existing programs - I've modified a number of apps to use it very successfully. Or if you want support for all manner of crypto key management hardware devices, there's also Mozilla NSS libraries. All support non-blocking APIs, so aside from the extra code to do the TLS handshake and key verification, there's little modification needed to the main codebase - eg for GNU TLS once handshake is complete you can simply replace read()/write() calls with gnutls_read() / gnutls_write()

Quoted 3 lines

While this is all well and good, there is still the fundamental problem of how does one associate credentials with a VM. The actual security mechanism is, IMHO, just an implementation detail.

Well there's a number of plausible options

- Password, but using challenge/resonse (either plain or TLS channel)
- Simple password (assuming a TLS encypted channel)
- Whitelist based on client TLS certificate (common name/fingerprint)
- Auth against PAM using same username of qemu process owner (asume TLS)

While in general I don't think it makes much sense to tie it into the host system auth scheme (because VM administrators don't map onto UNIX accounts in the general case), the latter would be useful for developers not wishing to setup dedicated auth. There's probably more suggestions, but I reckon those would cover a pretty wide base of deployment scenarios from individual developers to large corporate deployment.

I wouldn't really want to translate all these schemes into a 1000 command line flags though, so the earlier point in the thread about a QEMU config file becomes very relevant

Regards,
Dan.

Signature · 4 lines
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
#24 lore raw

Hi,

Quoted 6 lines · Daniel P. Berrange

Well there's a number of plausible options

- Password, but using challenge/resonse (either plain or TLS channel)
- Simple password (assuming a TLS encypted channel)
- Whitelist based on client TLS certificate (common name/fingerprint)
- Auth against PAM using same username of qemu process owner (asume TLS)

or just

- create a pipe(), fork() and be unbothered by any authentication.

Of course, QEmu's VNC server would have to be taught to communicate via stdio.

Ciao,
Dscho

#25 lore raw
Quoted 22 lines · Johannes Schindelin

Hi,

Quoted 6 lines · Daniel P. Berrange

Well there's a number of plausible options

- Password, but using challenge/resonse (either plain or TLS channel)
- Simple password (assuming a TLS encypted channel)
- Whitelist based on client TLS certificate (common name/fingerprint)
- Auth against PAM using same username of qemu process owner (asume TLS)

or just

- create a pipe(), fork() and be unbothered by any authentication.

Of course, QEmu's VNC server would have to be taught to communicate via stdio.

Ciao,
Dscho

Quoted 4 lines

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

That's well and good but as pointed out by Anthony how does one verify credentials with the VM over VNC or what ever future protocol there is..

This could be something designed more native into it as I could see in the future the possability of remote configuration of VM's over some interface yet to come.

-Christopher

Signature · 4 lines
Christopher Olsen
[email protected]
Tel: 631-676-4877
Fax: 631-249-3036
#26 lore raw
In reply to Johannes Schindelin

Amen!

I was beginning to wonder when we would be integrating the email reader.

It would be nice if vncviewer didn't require a "host:port", but instead would also accept a pair of pipes.

pipes are local and can even be anonymous. host:port is at least machine wide and can be net wide.

Joe

Quoted 30 lines · Johannes Schindelin

Hi,

Quoted 9 lines · Daniel P. Berrange

Well there's a number of plausible options

- Password, but using challenge/resonse (either plain or TLS
channel)
- Simple password (assuming a TLS encypted channel)
- Whitelist based on client TLS certificate (common name/
fingerprint)
- Auth against PAM using same username of qemu process owner
(asume TLS)

or just

- create a pipe(), fork() and be unbothered by any authentication.

Of course, QEmu's VNC server would have to be taught to communicate via stdio.

Ciao,
Dscho

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

#27 lore raw

[Qemu-devel] FreeBSD Support

In reply to Daniel P. Berrange

This is a sidetrack here... But is it at all possible to make future releases of the source more FreeBSD friendly?

I am willing to work off a specified codebase to bring it up to FreeBSD speed so it can be easily maintained from there...

Because unfortunately out of the box it doesn't build.

-Christopher

Signature · 4 lines
Christopher Olsen
[email protected]
Tel: 631-676-4877
Fax: 631-249-3036
#28 lore raw

Re: [Qemu-devel] FreeBSD Support

Quoted 2 lines

This is a sidetrack here... But is it at all possible to make future releases of the source more FreeBSD friendly?

If someone puts in the effort to make it so, yes.

Note that dumping the current patches from FreeBSD ports on the list is generally not sufficient. Blindly posting patches without explanation is a good way to get them ignored.

All patches should include a description of what they are fixing (ie. what qemu currently does wrong), how the patch fixes it, and why this is the right way to fix it. For OS specific hacks there needs to be a good reason why that OS is special.
If you can't answer all the above questions then you shouldn't be submitting the patch. In some cases you may need to rewriting the patches to meet these criteria. Individual OS/Distros tend to be less picky because they only care whether the result works on that one system.

Paul

#29 lore raw

Re: [Qemu-devel] FreeBSD Support

Quoted 18 lines · Paul Brook
Quoted 2 lines

This is a sidetrack here... But is it at all possible to make future releases of the source more FreeBSD friendly?

If someone puts in the effort to make it so, yes.

Note that dumping the current patches from FreeBSD ports on the list is generally not sufficient. Blindly posting patches without explanation is a good way to get them ignored.

All patches should include a description of what they are fixing (ie. what qemu currently does wrong), how the patch fixes it, and why this is the right way to fix it. For OS specific hacks there needs to be a good reason why that OS is special.
If you can't answer all the above questions then you shouldn't be submitting the patch. In some cases you may need to rewriting the patches to meet these criteria. Individual OS/Distros tend to be less picky because they only care whether the result works on that one system.

Quoted 7 lines

Paul

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Paul,

So should I make a separate patch for each modified file?

-Christopher

Signature · 4 lines
Christopher Olsen
[email protected]
Tel: 631-676-4877
Fax: 631-249-3036
#30 lore raw

Re: [Qemu-devel] FreeBSD Support

Quoted 1 line

So should I make a separate patch for each modified file?

No. You should break changes into logically independent patches. It is ok for a single patch to touch multiple files, but it should only fix one thing.

Paul

#31 lore raw

[Qemu-devel] FreeBSD Support

Ok FreeBSD Support round one..

Be gentle this is my first attempt at working with the rest of this community..

Files it modifies and the reasons are as follows

configure - Adds HOST_FREEBSD type to alter included libraries FreeBSD does not need -ltr
Makefile.target - Once again uses HOST_FREEBSD to avoid including -ltr

osdeps.c - FreeBSD does not have /dev/shm so it uses /tmp for kqemu_valloc also sys/vfs.h is not part of freebsd stat information is part of mount.h/param.h

vl.c - FreeBSD needs module if_tap for tap not default in kernel and fopen the tap device with a workaround for FreeBSD related issues for incrementing the tap device

-Christopher

Signature · 4 lines
Christopher Olsen
[email protected]
Tel: 631-676-4877
Fax: 631-249-3036
home/reddawg/qemu-0.9.0/configure renamed from configure +5 -0
@@ -111,6 +111,7 @@
 ;;
 FreeBSD)
 bsd="yes"
+freebsd="yes"
 oss="yes"
 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
     kqemu="yes"
@@ -719,6 +720,10 @@
 if test "$solaris" = "yes" ; then
   echo "CONFIG_SOLARIS=yes" >> $config_mak
   echo "#define HOST_SOLARIS $solarisrev" >> $config_h
+fi
+if test "$freebsd" = "yes" ; then
+  echo "CONFIG_FREEBSD=yes" >> $config_mak
+  echo "#define HOST_FREEBSD 1" >> $config_h
 fi
 if test "$gdbstub" = "yes" ; then
   echo "CONFIG_GDBSTUB=yes" >> $config_mak
home/reddawg/qemu-0.9.0/Makefile.target renamed from Makefile.target +4 -0
@@ -440,7 +440,11 @@
 ifndef CONFIG_DARWIN
 ifndef CONFIG_WIN32
 ifndef CONFIG_SOLARIS
+ifndef CONFIG_FREEBSD
 VL_LIBS=-lutil -lrt
+else
+VL_LIBS=-lutil
+endif
 endif
 endif
 endif
home/reddawg/qemu-0.9.0/osdep.c renamed from osdep.c +8 -0
@@ -79,7 +79,12 @@
 
 #if defined(USE_KQEMU)
 
+#ifdef HOST_FREEBSD
+#include <sys/param.h>
+#include <sys/mount.h>
+#else
 #include <sys/vfs.h>
+#endif
 #include <sys/mman.h>
 #include <fcntl.h>
 
@@ -102,6 +107,9 @@
 #ifdef HOST_SOLARIS
             tmpdir = "/tmp";
         if (statvfs(tmpdir, &stfs) == 0) {
+#elif HOST_FREEBSD
+            tmpdir = "/tmp";
+        if (statfs(tmpdir, &stfs) == 0) {
 #else
             tmpdir = "/dev/shm";
         if (statfs(tmpdir, &stfs) == 0) {
home/reddawg/qemu-0.9.0/vl.c renamed from vl.c +75 -0

98 lines not on this page · raw message

#32 lore raw

Re: [Qemu-devel] FreeBSD Support

In article <[email protected]> you write:

Quoted 9 lines

-=-=-=-=-=-

Ok FreeBSD Support round one..

Be gentle this is my first attempt at working with the rest of this community..

Files it modifies and the reasons are as follows

Quoted 8 lines

configure - Adds HOST_FREEBSD type to alter included libraries FreeBSD does not need -ltr
Makefile.target - Once again uses HOST_FREEBSD to avoid including -ltr

osdeps.c - FreeBSD does not have /dev/shm so it uses /tmp for kqemu_valloc also sys/vfs.h is not part of freebsd stat information is part of mount.h/param.h
...

Actually the port simply uses mmap MAP_PRIVATE|MAP_ANON, so no tempfile is used at all (this is files/patch-osdep.c in the port):

Index: qemu/osdep.c
@@ -79,7 +79,9 @@

#if defined(USE_KQEMU)

+#ifndef __FreeBSD__
#include <sys/vfs.h>
+#endif
#include <sys/mman.h>
#include <fcntl.h>

@@ -90,6 +92,7 @@

     const char *tmpdir;
     char phys_ram_file[1024];
     void *ptr;
+#ifndef __FreeBSD__
 #ifdef HOST_SOLARIS
     struct statvfs stfs;
 #else
@@ -151,12 +154,20 @@
         }
         unlink(phys_ram_file);
     }
+#endif
     size = (size + 4095) & ~4095;

+#ifndef __FreeBSD__
ftruncate(phys_ram_fd, phys_ram_size + size); ptr = mmap(NULL,
size,
PROT_WRITE | PROT_READ, MAP_SHARED, phys_ram_fd, phys_ram_size);
+#else
+ ptr = mmap(NULL,

+               size, 
+               PROT_WRITE | PROT_READ, MAP_PRIVATE|MAP_ANON, 
+               -1, 0);
+#endif
     if (ptr == MAP_FAILED) {
         fprintf(stderr, "Could not map physical memory\n");
         exit(1);
#33 lore raw

Re: [Qemu-devel] FreeBSD Support

MAP_PRIVATE|MAP_ANON also works on Solaris. In fact, Linux is the only platform where it doesn't work due to a bug in the Linux kernel as Fabrice mentions:

http://www.qemu.org/kqemu-tech.html#SEC7

Technically on Solaris, /tmp is probably the same thing as MAP_PRIVATE|MAP_ANON since the filesystem is actually mapped to virtual memory... however, it's much cleaner to not use a file if not necessary. I can post a reworked patch that makes the file mapping for the Linux case only if anyone's interested, but it's a pretty simple change.

- Leo Reiter

Quoted 69 lines · Juergen Lock

In article <[email protected]> you write:

Quoted 9 lines

-=-=-=-=-=-

Ok FreeBSD Support round one..

Be gentle this is my first attempt at working with the rest of this community..

Files it modifies and the reasons are as follows

Quoted 8 lines

configure - Adds HOST_FREEBSD type to alter included libraries FreeBSD does not need -ltr
Makefile.target - Once again uses HOST_FREEBSD to avoid including -ltr

osdeps.c - FreeBSD does not have /dev/shm so it uses /tmp for kqemu_valloc also sys/vfs.h is not part of freebsd stat information is part of mount.h/param.h
...

Actually the port simply uses mmap MAP_PRIVATE|MAP_ANON, so no tempfile is used at all (this is files/patch-osdep.c in the port):

Index: qemu/osdep.c

home/reddawg/qemu-0.9.0/osdep.c renamed from osdep.c +11 -0
@@ -79,7 +79,9 @@
 
 #if defined(USE_KQEMU)
 
+#ifndef __FreeBSD__
 #include <sys/vfs.h>
+#endif
 #include <sys/mman.h>
 #include <fcntl.h>
 
@@ -90,6 +92,7 @@
     const char *tmpdir;
     char phys_ram_file[1024];
     void *ptr;
+#ifndef __FreeBSD__
 #ifdef HOST_SOLARIS
     struct statvfs stfs;
 #else
@@ -151,12 +154,20 @@
         }
         unlink(phys_ram_file);
     }
+#endif
     size = (size + 4095) & ~4095;
+#ifndef __FreeBSD__
     ftruncate(phys_ram_fd, phys_ram_size + size);
     ptr = mmap(NULL,
                size,
                PROT_WRITE | PROT_READ, MAP_SHARED,
                phys_ram_fd, phys_ram_size);
+#else
+    ptr = mmap(NULL,
+               size,
+               PROT_WRITE | PROT_READ, MAP_PRIVATE|MAP_ANON,
+               -1, 0);
+#endif
     if (ptr == MAP_FAILED) {
         fprintf(stderr, "Could not map physical memory\n");
         exit(1);

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

#34 lore raw

Re: [Qemu-devel] FreeBSD Support

In reply to Christopher Olsen

Hi,

Quoted 10 lines · Christopher Olsen

Ok FreeBSD Support round one..

Be gentle this is my first attempt at working with the rest of this community..

Files it modifies and the reasons are as follows

configure - Adds HOST_FREEBSD type to alter included libraries FreeBSD does not need -ltr
Makefile.target - Once again uses HOST_FREEBSD to avoid including -ltr

See http://lists.gnu.org/archive/html/qemu-devel/2006-11/msg00166.html
- I believe this is a more appropriate way to select -lrt.

Regards,
Andrew

#35 lore raw

Re: [Qemu-devel] FreeBSD Support

Quoted 8 lines · andrzej zaborowski

Hi,

Quoted 5 lines · Christopher Olsen

Ok FreeBSD Support round one..

Be gentle this is my first attempt at working with the rest of this community..

Quoted 8 lines
Quoted 5 lines

Files it modifies and the reasons are as follows

configure - Adds HOST_FREEBSD type to alter included libraries FreeBSD does not need -ltr
Makefile.target - Once again uses HOST_FREEBSD to avoid including -ltr

See http://lists.gnu.org/archive/html/qemu-devel/2006-11/msg00166.html
- I believe this is a more appropriate way to select -lrt.

The solaris part there looked a bit inconsistent, is the appended version ok?

Thiemo

Makefile +1 -5
Index: qemu-work/Makefile
===================================================================
@@ -24,11 +24,7 @@
 DOCS=
 endif
 
-ifndef CONFIG_DARWIN
-ifndef CONFIG_WIN32
-LIBS+=-lrt
-endif
-endif
+LIBS+=$(AIOLIBS)
 
 all: $(TOOLS) $(DOCS) recurse-all
 
Makefile.target +2 -1
Index: qemu-work/Makefile.target
===================================================================
@@ -436,6 +436,7 @@
 endif
 
 VL_LDFLAGS=
+VL_LIBS=$(AIOLIBS)
 # specific flags are needed for non soft mmu emulator
 ifdef CONFIG_STATIC
 VL_LDFLAGS+=-static
@@ -446,7 +447,7 @@
 ifndef CONFIG_DARWIN
 ifndef CONFIG_WIN32
 ifndef CONFIG_SOLARIS
-VL_LIBS=-lutil -lrt
+VL_LIBS+=-lutil
 endif
 endif
 endif
configure +7 -0
Index: qemu-work/configure
===================================================================
@@ -159,6 +159,12 @@
   fi
 fi
 
+if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
+    AIOLIBS=
+else
+    AIOLIBS="-lrt"
+fi
+
 # find source path
 source_path=`dirname "$0"`
 if [ -z "$source_path" ]; then
@@ -653,6 +659,7 @@
 echo "CFLAGS=$CFLAGS" >> $config_mak
 echo "LDFLAGS=$LDFLAGS" >> $config_mak
 echo "EXESUF=$EXESUF" >> $config_mak
+echo "AIOLIBS=$AIOLIBS" >> $config_mak
 if test "$cpu" = "i386" ; then
   echo "ARCH=i386" >> $config_mak
   echo "#define HOST_I386 1" >> $config_h
#36 lore raw

Re: [Qemu-devel] FreeBSD Support

Hi,

Quoted 15 lines · Thiemo Seufer
Quoted 14 lines · andrzej zaborowski

Hi,

Quoted 10 lines · Christopher Olsen

Ok FreeBSD Support round one..

Be gentle this is my first attempt at working with the rest of this community..

Files it modifies and the reasons are as follows

configure - Adds HOST_FREEBSD type to alter included libraries FreeBSD does not need -ltr
Makefile.target - Once again uses HOST_FREEBSD to avoid including -ltr

Quoted 5 lines
Quoted 2 lines

See http://lists.gnu.org/archive/html/qemu-devel/2006-11/msg00166.html
- I believe this is a more appropriate way to select -lrt.

The solaris part there looked a bit inconsistent, is the appended version ok?

It works for FreeBSD, I think it's Ok.

Regards,
Andrew

#37 lore raw
In reply to Fabrice Bellard

Hi,

Quoted 3 lines · Fabrice Bellard

On the technical side, adding OpenSSL support in the current VNC implementation is QEMU seems easy (OpenSSL has a non blocking API which can be used with the current callback API).

Goodbye compatibility.

I mean, you _can_ just ask for breakage of a standard.

Ciao,
Dscho

#38 lore raw
In reply to Christopher Olsen

Hi,

Quoted 1 line · Christopher Olsen

I didn't see a way so here is a patch for it work on 0.9.0

This is a sneaky way to introduce a whole shotload of things, among others a copyright to your name, FreeBSD stuff, some #define's which may or may not break things.

Judging by the lines occupied by the vncname stuff, your patch is misnamed.

Ciao,
Dscho

#39 lore raw

Oops.. I really did mean to trim that patch down to just the code portions....

Quoted 21 lines · Johannes Schindelin

Hi,

Quoted 1 line · Christopher Olsen

I didn't see a way so here is a patch for it work on 0.9.0

This is a sneaky way to introduce a whole shotload of things, among others a copyright to your name, FreeBSD stuff, some #define's which may or may not break things.

Judging by the lines occupied by the vncname stuff, your patch is misnamed.

Ciao,
Dscho

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Signature · 4 lines
Christopher Olsen
[email protected]
Tel: 631-676-4877
Fax: 631-249-3036