mirror of
https://git.proxmox.com/git/qemu
synced 2025-08-08 07:40:34 +00:00
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>
This commit is contained in:
parent
4a1e19ae05
commit
5f668643dc
@ -43,8 +43,8 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required
|
|||||||
char *dev;
|
char *dev;
|
||||||
struct stat s;
|
struct stat s;
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
|
||||||
/* if no ifname is given, always start the search from tap0. */
|
/* if no ifname is given, always start the search from tap0/tun0. */
|
||||||
int i;
|
int i;
|
||||||
char dname[100];
|
char dname[100];
|
||||||
|
|
||||||
@ -52,7 +52,11 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required
|
|||||||
if (*ifname) {
|
if (*ifname) {
|
||||||
snprintf(dname, sizeof dname, "/dev/%s", ifname);
|
snprintf(dname, sizeof dname, "/dev/%s", ifname);
|
||||||
} else {
|
} else {
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
snprintf(dname, sizeof dname, "/dev/tun%d", i);
|
||||||
|
#else
|
||||||
snprintf(dname, sizeof dname, "/dev/tap%d", i);
|
snprintf(dname, sizeof dname, "/dev/tap%d", i);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
TFR(fd = open(dname, O_RDWR));
|
TFR(fd = open(dname, O_RDWR));
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user