qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] net: add the support for -netdev socket, lis


From: Zhi Yong Wu
Subject: Re: [Qemu-devel] [PATCH v2] net: add the support for -netdev socket, listen
Date: Mon, 28 May 2012 21:13:21 +0800

On Mon, May 28, 2012 at 6:51 PM, Stefan Hajnoczi
<address@hidden> wrote:
> On Mon, May 28, 2012 at 03:49:11PM +0800, Zhi Yong Wu wrote:
>> On Sun, Feb 26, 2012 at 10:48 PM, Stefan Hajnoczi <address@hidden> wrote:
>> > On Sat, Feb 18, 2012 at 9:19 AM,  <address@hidden> wrote:
>> >> From: Zhi Yong Wu <address@hidden>
>> >>
>> >> 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 <address@hidden>
>> >> ---
>> >>  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.
>> Now i prefer to support #2. Do you think of it? Should the usage
>> "-netdev socket,listen" also been supported or forbidden? As you said,
>> -netdev only has one peer, so their usage will be a bit different.
>
> I'm not sure how useful the multiple connections behavior is.  Since
> -netdev socket,listen= has not worked in the past we have the freedom to
> decide how it should work (without breaking existing users' setups).
>
> Several folks have pointed out that vde or other external programs are
> better for virtual hubs/switches.  I would implement #1 because it adds
> useful behavior but doesn't complicate QEMU much.
>
> But if you feel adding #2 would be worthwhile and not a big effort to
> code, then go ahead.  My intuition is that #1 will be easier to get
> merged and can be extended to support #2 in the future, if necessary.
OK. i will try.
>
> Stefan
>



-- 
Regards,

Zhi Yong Wu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]