On Sat, Feb 18, 2012 at 9:19 AM, <zwu.ker...@gmail.com> wrote: > From: Zhi Yong Wu <wu...@linux.vnet.ibm.com> > > 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. > > Signed-off-by: Zhi Yong Wu <wu...@linux.vnet.ibm.com> > --- > net.c | 26 +++++++++++++++++++++ > net.h | 2 + > net/socket.c | 72 > +++++++++++++++++++++++++++++++++++++++++++++------------- > 3 files changed, 84 insertions(+), 16 deletions(-)
I wanted to understand the problem better so I tried out -net socket,listen=. Here is its behavior: 1. A client can connect to QEMU, this creates a new socket VLANClientState on the VLAN. 2. If another client connects to QEMU, another VLANClientState is created. That means many socket clients can be added to the same "VLAN". 3. When a simple TCP client like netcat connects and then disconnects, the VLANClientState remains forever. There seems to be no cleanup. This patch does not handle the -net socket,listen= case where multiple clients connect. Also, the -netdev socket,listen= semantics cannot match -net socket-listen= semantics because there is only one peer at any time. Some options: 1. Do not accept new connections while a client is connected. Once the client disconnects we can accept a new connection. This maintains the 1-1 peer behavior. 2. Integrate with vlan-hub so that multiple clients can connect even with -netdev. Connections will create new NetClientStates and auto-attach to the hub. This mimics -net socket,listen= but requires a hub to be used. 3. Forbid -netdev socket,listen=, only allow -net socket,listen=. I think #1 would be okay, although it no longer allows multiple connections, but I don't have a strong opinion either way. Stefan