diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/tap-aix.c | 4 | ||||
-rw-r--r-- | net/tap-bsd.c | 6 | ||||
-rw-r--r-- | net/tap-haiku.c | 4 | ||||
-rw-r--r-- | net/tap-linux.c | 3 | ||||
-rw-r--r-- | net/tap-solaris.c | 3 | ||||
-rw-r--r-- | net/tap.c | 13 | ||||
-rw-r--r-- | net/tap_int.h | 2 |
7 files changed, 22 insertions, 13 deletions
diff --git a/net/tap-aix.c b/net/tap-aix.c index 0a3d46158f..18fdbf3b21 100644 --- a/net/tap-aix.c +++ b/net/tap-aix.c @@ -26,9 +26,9 @@ #include <stdio.h> int tap_open(char *ifname, int ifname_size, int *vnet_hdr, - int vnet_hdr_required, int mq_required) + int vnet_hdr_required, int mq_required, Error **errp) { - fprintf(stderr, "no tap on AIX\n"); + error_setg(errp, "no tap on AIX"); return -1; } diff --git a/net/tap-bsd.c b/net/tap-bsd.c index 53cdd9f4e1..bbbe446b1b 100644 --- a/net/tap-bsd.c +++ b/net/tap-bsd.c @@ -35,8 +35,9 @@ #ifndef __FreeBSD__ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, - int vnet_hdr_required, int mq_required) + int vnet_hdr_required, int mq_required, Error **errp) { + /* FIXME error_setg(errp, ...) on failure */ int fd; #ifdef TAPGIFNAME struct ifreq ifr; @@ -114,8 +115,9 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, #define PATH_NET_TAP "/dev/tap" int tap_open(char *ifname, int ifname_size, int *vnet_hdr, - int vnet_hdr_required, int mq_required) + int vnet_hdr_required, int mq_required, Error **errp) { + /* FIXME error_setg(errp, ...) on failure */ int fd, s, ret; struct ifreq ifr; diff --git a/net/tap-haiku.c b/net/tap-haiku.c index 0905b2887d..d18590c636 100644 --- a/net/tap-haiku.c +++ b/net/tap-haiku.c @@ -26,9 +26,9 @@ #include <stdio.h> int tap_open(char *ifname, int ifname_size, int *vnet_hdr, - int vnet_hdr_required, int mq_required) + int vnet_hdr_required, int mq_required, Error **errp) { - fprintf(stderr, "no tap on Haiku\n"); + error_setg(errp, "no tap on Haiku"); return -1; } diff --git a/net/tap-linux.c b/net/tap-linux.c index 6fa27442bc..be18382517 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -37,8 +37,9 @@ #define PATH_NET_TUN "/dev/net/tun" int tap_open(char *ifname, int ifname_size, int *vnet_hdr, - int vnet_hdr_required, int mq_required) + int vnet_hdr_required, int mq_required, Error **errp) { + /* FIXME error_setg(errp, ...) on failure */ struct ifreq ifr; int fd, ret; int len = sizeof(struct virtio_net_hdr); diff --git a/net/tap-solaris.c b/net/tap-solaris.c index 7839323e20..079046bab8 100644 --- a/net/tap-solaris.c +++ b/net/tap-solaris.c @@ -174,8 +174,9 @@ static int tap_alloc(char *dev, size_t dev_size) } int tap_open(char *ifname, int ifname_size, int *vnet_hdr, - int vnet_hdr_required, int mq_required) + int vnet_hdr_required, int mq_required, Error **errp) { + /* FIXME error_setg(errp, ...) on failure */ char dev[10]=""; int fd; if( (fd = tap_alloc(dev, sizeof(dev))) < 0 ){ @@ -581,7 +581,7 @@ int net_init_bridge(const NetClientOptions *opts, const char *name, static int net_tap_init(const NetdevTapOptions *tap, int *vnet_hdr, const char *setup_script, char *ifname, - size_t ifname_sz, int mq_required) + size_t ifname_sz, int mq_required, Error **errp) { Error *err = NULL; int fd, vnet_hdr_required; @@ -595,8 +595,12 @@ static int net_tap_init(const NetdevTapOptions *tap, int *vnet_hdr, } TFR(fd = tap_open(ifname, ifname_sz, vnet_hdr, vnet_hdr_required, - mq_required)); + mq_required, errp)); if (fd < 0) { + /* FIXME drop when all tap_open() store an Error */ + if (errp && !*errp) { + error_setg(errp, "can't open tap device"); + } return -1; } @@ -605,7 +609,7 @@ static int net_tap_init(const NetdevTapOptions *tap, int *vnet_hdr, strcmp(setup_script, "no") != 0) { launch_script(setup_script, ifname, fd, &err); if (err) { - error_report_err(err); + error_propagate(errp, err); close(fd); return -1; } @@ -853,8 +857,9 @@ int net_init_tap(const NetClientOptions *opts, const char *name, for (i = 0; i < queues; i++) { fd = net_tap_init(tap, &vnet_hdr, i >= 1 ? "no" : script, - ifname, sizeof ifname, queues > 1); + ifname, sizeof ifname, queues > 1, &err); if (fd == -1) { + error_report_err(err); return -1; } diff --git a/net/tap_int.h b/net/tap_int.h index 6df271f823..d12a409967 100644 --- a/net/tap_int.h +++ b/net/tap_int.h @@ -30,7 +30,7 @@ #include "qapi-types.h" int tap_open(char *ifname, int ifname_size, int *vnet_hdr, - int vnet_hdr_required, int mq_required); + int vnet_hdr_required, int mq_required, Error **errp); ssize_t tap_read_packet(int tapfd, uint8_t *buf, int maxlen); |