diff options
author | Brad <brad@comstyle.com> | 2010-12-20 21:23:15 -0500 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2010-12-21 19:44:33 +0000 |
commit | 5f668643dc6ef3e59d5bc9b86fdf6778c59c98f2 (patch) | |
tree | 9ea242dbbe81db23f2c9ebcb0069c64f51c79b94 | |
parent | 4a1e19ae05a3f03fdd0896e8f26efe94b2ff60a2 (diff) | |
download | qemu-5f668643dc6ef3e59d5bc9b86fdf6778c59c98f2.zip qemu-5f668643dc6ef3e59d5bc9b86fdf6778c59c98f2.tar.gz qemu-5f668643dc6ef3e59d5bc9b86fdf6778c59c98f2.tar.bz2 |
Add support for OpenBSD to QEMU's tap driver.
Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
-rw-r--r-- | net/tap-bsd.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/net/tap-bsd.c b/net/tap-bsd.c index efccfe0..2f3efde 100644 --- a/net/tap-bsd.c +++ b/net/tap-bsd.c @@ -43,8 +43,8 @@ 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]; @@ -52,7 +52,11 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required 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) { |