Skip to content

Commit

Permalink
tap: Use numbered tap/tun devices on all *BSD OS's
Browse files Browse the repository at this point in the history
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 <brad@comstyle.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
  • Loading branch information
brad0 authored and stefanhaRH committed Sep 6, 2013
1 parent df71316 commit aa4f082
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions net/tap-bsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit aa4f082

Please sign in to comment.