Commit aa4f082f authored by Brad Smith's avatar Brad Smith Committed by Stefan Hajnoczi
Browse files

tap: Use numbered tap/tun devices on all *BSD OS's

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: default avatarBrad Smith <>
Signed-off-by: default avatarStefan Hajnoczi <>
parent df713162
......@@ -44,8 +44,6 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
struct stat s;
#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;
TFR(fd = open("/dev/tap", O_RDWR));
if (fd < 0) {
"warning: could not open /dev/tap: no virtual network emulation: %s\n",
return -1;
if (ioctl(fd, TAPGIFNAME, (void *)&ifr) < 0) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment