]> git.proxmox.com Git - qemu.git/commit
net: add the support for -netdev socket, listen
authorZhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Fri, 20 Jul 2012 13:25:53 +0000 (14:25 +0100)
committerStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Wed, 1 Aug 2012 12:32:11 +0000 (13:32 +0100)
commit011de2b512a83aa5e9f8899ed5bbf2f31995b90e
tree08fce8a9e95c37e5701ebab75614baf80f17a401
parente34cde35e7c69efcf0bd53d2ff7c90f89a5fc6d0
net: add the support for -netdev socket, listen

The -net socket,listen option does not work with the newer -netdev
syntax:
 http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg01508.html

This patch makes it work now.

For the case where one vlan has multiple listenning sockets,
the patch will also provide the support.

Supported syntax:
 1.) -net socket,listen=127.0.0.1:1234,vlan=0
 2.) -net socket,listen=127.0.0.1:1234,vlan=0 -net socket,listen=127.0.0.1:1235,vlan=0
 3.) -netdev socket,listen=127.0.0.1:1234,id=socket0

 Drop the NetSocketListenState struct and add a listen_fd field
to NetSocketState.  When a -netdev socket,listen= instance is created
there will be a NetSocketState with fd=-1 and a valid listen_fd.  The
net_socket_accept() handler waits for listen_fd to become readable and
then accepts the connection.  When this state transition happens, we no
longer monitor listen_fd for incoming connections...until the client
disconnects again.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
net/socket.c