Skip to contentSkip to conversation

tap: properly initialize vhostfds

PATCH Applied Jason Wang 3 participants 3 messages Apr 19, 2013 – Apr 22, 2013 Networking

lore
Share & tools
lore

Jason Wang

author
#0 lore raw

PATCH 1/1 tap: properly initialize vhostfds

Only tap->vhostfd were checked net_init_tap_one(), but tap->vhostfds were forgot, this will lead qemu to ignore all fds passed by management through vhostfds, and tries to create vhost_net device itself. Fix by adding this check also.

---
 net/tap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/tap.c +1 -1
index 17bdf01..e0b7a2a 100644
@@ -623,7 +623,7 @@ static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
         vhostfdname || (tap->has_vhostforce && tap->vhostforce)) {
         int vhostfd;
 
-        if (tap->has_vhostfd) {
+        if (tap->has_vhostfd || tap->has_vhostfds) {
             vhostfd = monitor_handle_fd_param(cur_mon, vhostfdname);
             if (vhostfd == -1) {
                 return -1;
Signature · 1 line
1.7.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Jason Wang

Only tap->vhostfd were checked net_init_tap_one(), but tap->vhostfds were forgot, this will lead qemu to ignore all fds passed by management through vhostfds, and tries to create vhost_net device itself. Fix by adding this check also.

Typo

Quoted 13 lines
---
 net/tap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/tap.c +0 -0
index 17bdf01..e0b7a2a 100644

net/tap.c static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer, · line 629

Quoted 8 lines
net/tap.c +1 -1
@@ -623,7 +623,7 @@ static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
         vhostfdname || (tap->has_vhostforce && tap->vhostforce)) {
         int vhostfd;
 
-        if (tap->has_vhostfd) {
+        if (tap->has_vhostfd || tap->has_vhostfds) {
             vhostfd = monitor_handle_fd_param(cur_mon, vhostfdname);
             if (vhostfd == -1) {
                 return -1;

Yup. I can confirm this fixes the problem for me.

Michal

#2 lore raw
In reply to Jason Wang
Quoted 5 lines · Jason Wang

Only tap->vhostfd were checked net_init_tap_one(), but tap->vhostfds were forgot, this will lead qemu to ignore all fds passed by management through vhostfds, and tries to create vhost_net device itself. Fix by adding this check also.

Quoted 7 lines
---
 net/tap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Thanks, applied to my net tree:
https://github.com/stefanha/qemu/commits/net

Stefan