From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5nwJ-0004a8-0f for qemu-devel@nongnu.org; Sat, 03 Aug 2013 22:20:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V5nwH-0002U4-Qp for qemu-devel@nongnu.org; Sat, 03 Aug 2013 22:20:58 -0400 Received: from speedy.comstyle.com ([2001:470:1d:8c::2]:25742 helo=mail.comstyle.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5nwH-0002TA-N0 for qemu-devel@nongnu.org; Sat, 03 Aug 2013 22:20:57 -0400 Received: from rox.home.comstyle.com (unknown [IPv6:2001:470:b01e:3:94dc:772:1231:b176]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: brad) by mail.comstyle.com (Postfix) with ESMTPSA id B0BB073C73 for ; Sat, 3 Aug 2013 21:58:40 -0400 (EDT) Date: Sat, 3 Aug 2013 22:20:41 -0400 From: Brad Smith Message-ID: <20130804022040.GA15404@rox.home.comstyle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] tap: Use numbered tap/tun devices on all *BSD OS's List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org The following patch simplifies the *BSD tap/tun code and makes use of numbered tap/tun interfaces on all *BSD OS's. NetBSD has a patch in their pkgsrc tree to make use of this feature and DragonFly also supports this as well. Signed-off-by: Brad Smith diff --git a/net/tap-bsd.c b/net/tap-bsd.c index f61d580..90f8a02 100644 --- a/net/tap-bsd.c +++ b/net/tap-bsd.c @@ -44,8 +44,6 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, struct stat s; #endif -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ - defined(__OpenBSD__) || defined(__APPLE__) /* if no ifname is given, always start the search from tap0/tun0. */ int i; char dname[100]; @@ -76,15 +74,6 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, dname, strerror(errno)); return -1; } -#else - TFR(fd = open("/dev/tap", O_RDWR)); - if (fd < 0) { - fprintf(stderr, - "warning: could not open /dev/tap: no virtual network emulation: %s\n", - strerror(errno)); - return -1; - } -#endif #ifdef TAPGIFNAME if (ioctl(fd, TAPGIFNAME, (void *)&ifr) < 0) {