Revision 91ca60e0
b/net/tap-linux.c | ||
---|---|---|
33 | 33 |
#include "qemu-common.h" |
34 | 34 |
#include "qemu-error.h" |
35 | 35 |
|
36 |
#define PATH_NET_TUN "/dev/net/tun" |
|
37 |
|
|
36 | 38 |
int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required) |
37 | 39 |
{ |
38 | 40 |
struct ifreq ifr; |
39 | 41 |
int fd, ret; |
40 | 42 |
|
41 |
TFR(fd = open("/dev/net/tun", O_RDWR));
|
|
43 |
TFR(fd = open(PATH_NET_TUN, O_RDWR));
|
|
42 | 44 |
if (fd < 0) { |
43 |
fprintf(stderr, "warning: could not open /dev/net/tun: no virtual network emulation\n");
|
|
45 |
error_report("could not open %s: %m", PATH_NET_TUN);
|
|
44 | 46 |
return -1; |
45 | 47 |
} |
46 | 48 |
memset(&ifr, 0, sizeof(ifr)); |
... | ... | |
71 | 73 |
pstrcpy(ifr.ifr_name, IFNAMSIZ, "tap%d"); |
72 | 74 |
ret = ioctl(fd, TUNSETIFF, (void *) &ifr); |
73 | 75 |
if (ret != 0) { |
74 |
fprintf(stderr, "warning: could not configure /dev/net/tun: no virtual network emulation\n");
|
|
76 |
error_report("could not configure %s (%s): %m", PATH_NET_TUN, ifr.ifr_name);
|
|
75 | 77 |
close(fd); |
76 | 78 |
return -1; |
77 | 79 |
} |
Also available in: Unified diff