Skip to content

Commit

Permalink
Add support for OpenBSD to QEMU's tap driver.
Browse files Browse the repository at this point in the history
Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
  • Loading branch information
brad0 authored and blueswirl committed Dec 21, 2010
1 parent 4a1e19a commit 5f66864
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions net/tap-bsd.c
Expand Up @@ -43,16 +43,20 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required
char *dev;
struct stat s;

#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
/* if no ifname is given, always start the search from tap0. */
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
/* if no ifname is given, always start the search from tap0/tun0. */
int i;
char dname[100];

for (i = 0; i < 10; i++) {
if (*ifname) {
snprintf(dname, sizeof dname, "/dev/%s", ifname);
} else {
#if defined(__OpenBSD__)
snprintf(dname, sizeof dname, "/dev/tun%d", i);
#else
snprintf(dname, sizeof dname, "/dev/tap%d", i);
#endif
}
TFR(fd = open(dname, O_RDWR));
if (fd >= 0) {
Expand Down

0 comments on commit 5f66864

Please sign in to comment.