All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Cc: Mattias Nissler <mattias.nissler@gmx.de>
Subject: Re: [Qemu-devel] tun/tap patch for OSX
Date: Thu, 08 Jan 2009 14:31:27 -0600	[thread overview]
Message-ID: <4966629F.7020300@codemonkey.ws> (raw)
In-Reply-To: <5416901D-BAF1-48FB-8577-2264BCD678B6@sonous.com>

Lev Lvovsky wrote:
> The following patch provided by Mattias Nissler, and tweaked by myself 
> to be applied to net.c (previously to vl.c) allows qemu to use the 
> tun/tap devices provided at Mattias' site 
> (http://tuntaposx.sourceforge.net).

Needs a valid Signed-off-by along with appropriate documentation 
pointing users to tuntaposx.

Regards,

Anthony Liguori

> Mattias is CC'd.
>
> thanks,
> -lev
>
> ----
> bash-3.2$ svn diff net.c
> Index: net.c
> ===================================================================
> --- net.c       (revision 6082)
> +++ net.c       (working copy)
> @@ -686,8 +686,36 @@
>      snprintf(s->vc->info_str, sizeof(s->vc->info_str), "tap: fd=%d", 
> fd);
>      return s;
>  }
> +#if defined(__APPLE__)
> +static int tap_open(char *ifname, int ifname_size)
> +{
> +    int fd;
> +    int i = 0;
> +    char *dev;
> +    char buf[20];
> +    struct stat s;
>
> -#if defined (_BSD) || defined (__FreeBSD_kernel__)
> +    while (1) {
> +        snprintf(buf, 20, "/dev/tap%d", i);
> +        fd = open(buf, O_RDWR);
> +        if (fd < 0) {
> +            if (errno != EBUSY) {
> +                fprintf(stderr, "warning: could not open %s: no 
> virtual network emulation\n", buf);
> +                return -1;
> +            }
> +            i++;
> +        } else
> +            break;
> +    }
> +
> +    fstat(fd, &s);
> +    dev = devname(s.st_rdev, S_IFCHR);
> +    pstrcpy(ifname, ifname_size, dev);
> +
> +    fcntl(fd, F_SETFL, O_NONBLOCK);
> +    return fd;
> +}
> +#elif defined (_BSD) || defined (__FreeBSD_kernel__)
>  static int tap_open(char *ifname, int ifname_size)
>  {
>      int fd;
>
>
>

      parent reply	other threads:[~2009-01-08 20:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-29  6:11 [Qemu-devel] tun/tap patch for OSX Lev Lvovsky
2009-01-05 18:11 ` Lev Lvovsky
2009-01-05 21:37   ` C.W. Betts
2009-01-05 21:37     ` C.W. Betts
2009-01-08 20:31 ` Anthony Liguori [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4966629F.7020300@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=mattias.nissler@gmx.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.