#define MAX_TAP_QUEUES 1024
-static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
+static bool net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
const char *model, const char *name,
const char *ifname, const char *script,
const char *downscript, const char *vhostfdname,
}
}
- return;
+ return true;
failed:
qemu_del_net_client(&s->nc);
+ return false;
}
static int get_fds(char *str, char *fds[], int max)
const NetdevTapOptions *tap;
int fd, vnet_hdr = 0, i = 0, queues;
/* for the no-fd, no-helper case */
- Error *err = NULL;
const char *vhostfdname;
char ifname[128];
int ret = 0;
return -1;
}
- net_init_tap_one(tap, peer, "tap", name, NULL,
- NULL, NULL,
- vhostfdname, vnet_hdr, fd, &err);
- if (err) {
- error_propagate(errp, err);
+ if (!net_init_tap_one(tap, peer, "tap", name, NULL,
+ NULL, NULL,
+ vhostfdname, vnet_hdr, fd, errp)) {
close(fd);
return -1;
}
goto free_fail;
}
- net_init_tap_one(tap, peer, "tap", name, ifname,
- NULL, NULL,
- tap->vhostfds ? vhost_fds[i] : NULL,
- vnet_hdr, fd, &err);
- if (err) {
- error_propagate(errp, err);
+ if (!net_init_tap_one(tap, peer, "tap", name, ifname,
+ NULL, NULL,
+ tap->vhostfds ? vhost_fds[i] : NULL,
+ vnet_hdr, fd, errp)) {
ret = -1;
goto free_fail;
}
return -1;
}
- net_init_tap_one(tap, peer, "bridge", name, ifname,
- NULL, NULL, vhostfdname,
- vnet_hdr, fd, &err);
- if (err) {
- error_propagate(errp, err);
+ if (!net_init_tap_one(tap, peer, "bridge", name, ifname,
+ NULL, NULL, vhostfdname,
+ vnet_hdr, fd, errp)) {
close(fd);
return -1;
}
}
}
- net_init_tap_one(tap, peer, "tap", name, ifname,
- i >= 1 ? NULL : script,
- i >= 1 ? NULL : downscript,
- vhostfdname, vnet_hdr, fd, &err);
- if (err) {
- error_propagate(errp, err);
+ if (!net_init_tap_one(tap, peer, "tap", name, ifname,
+ i >= 1 ? NULL : script,
+ i >= 1 ? NULL : downscript,
+ vhostfdname, vnet_hdr, fd, errp)) {
close(fd);
return -1;
}