From patchwork Fri Sep 6 15:33:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 273228 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8DC252C0110 for ; Sat, 7 Sep 2013 01:34:52 +1000 (EST) Received: from localhost ([::1]:38367 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHy3e-0006Pi-L4 for incoming@patchwork.ozlabs.org; Fri, 06 Sep 2013 11:34:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39053) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHy31-0006GU-4R for qemu-devel@nongnu.org; Fri, 06 Sep 2013 11:34:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VHy2w-0003fJ-6j for qemu-devel@nongnu.org; Fri, 06 Sep 2013 11:34:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20850) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHy2v-0003fC-VM for qemu-devel@nongnu.org; Fri, 06 Sep 2013 11:34:06 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r86FXpTv001420 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 6 Sep 2013 11:33:51 -0400 Received: from localhost (ovpn-112-53.ams2.redhat.com [10.36.112.53]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r86FXnN1020164; Fri, 6 Sep 2013 11:33:50 -0400 From: Stefan Hajnoczi To: Date: Fri, 6 Sep 2013 17:33:40 +0200 Message-Id: <1378481624-20964-2-git-send-email-stefanha@redhat.com> In-Reply-To: <1378481624-20964-1-git-send-email-stefanha@redhat.com> References: <1378481624-20964-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Stefan Hajnoczi , Anthony Liguori , Brad Smith Subject: [Qemu-devel] [PULL v2 1/5] tap: Use numbered tap/tun devices on all *BSD OS's X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Brad Smith 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 Signed-off-by: Stefan Hajnoczi --- net/tap-bsd.c | 11 ----------- 1 file changed, 11 deletions(-) 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) {