qemu-devel
[Top][All Lists]
Advanced

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

Re: [RFC PATCH v1 03/26] char-socket: fix the client mode when created t


From: Markus Armbruster
Subject: Re: [RFC PATCH v1 03/26] char-socket: fix the client mode when created through QMP
Date: Wed, 15 Apr 2020 16:11:14 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Adalbert Lazãr <address@hidden> writes:

> On Wed, 15 Apr 2020 12:37:34 +0200, Marc-André Lureau <address@hidden> wrote:
>> Hi
>> 
>> On Wed, Apr 15, 2020 at 3:00 AM Adalbert Lazăr <address@hidden> wrote:
>> >
>> > qmp_chardev_open_socket() ignores the absence of the 'server' argument
>> > and always switches to listen/server mode.
>> >
>> > CC: "Marc-André Lureau" <address@hidden>
>> > CC: Paolo Bonzini <address@hidden>
>> > Signed-off-by: Adalbert Lazăr <address@hidden>
>> > ---
>> >  chardev/char-socket.c | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/chardev/char-socket.c b/chardev/char-socket.c
>> > index 9b2deb0125..fd0106ab85 100644
>> > --- a/chardev/char-socket.c
>> > +++ b/chardev/char-socket.c
>> > @@ -1310,7 +1310,7 @@ static void qmp_chardev_open_socket(Chardev *chr,
>> >      SocketChardev *s = SOCKET_CHARDEV(chr);
>> >      ChardevSocket *sock = backend->u.socket.data;
>> >      bool do_nodelay     = sock->has_nodelay ? sock->nodelay : false;
>> > -    bool is_listen      = sock->has_server  ? sock->server  : true;
>> > +    bool is_listen      = sock->has_server  ? sock->server  : false;
>> 
>> I don't understand what you mean. It defaults to server mode. We can't
>> change that.
>
> First of all, thanks for your comments.
>
> I understand that a chardev socket is either in client mode or in server
> mode.  If the 'server' parameter is not used, the socket is put in client
> mode. At least this is the behavior when the socket is created by parsing
> the command line. But, when created through QMP, without the 'server' 
> parameter,
> the socket is put in server mode.
>
> Until this moment, I did not think that we can use "server=no" through QMP :))

Start here:

    $ socat "READLINE,history=$HOME/.qmp_history,prompt=QMP>" 
UNIX-CONNECT:$HOME/work/images/test-qmp 
    {"QMP": {"version": {"qemu": {"micro": 92, "minor": 2, "major": 4}, 
"package": "v5.0.0-rc2-30-g25b0509e28"}, "capabilities": ["oob"]}}
    QMP>{"execute": "qmp_capabilities"}
    {"return": {}}
    QMP>{"execute":"chardev-add", "arguments": {"id":"foo", "backend": {"type": 
"socket", "data": {"addr": {"type": "inet", "data": {"host": "0.0.0.0", "port": 
"2445"}}, "server": false}}}}
    {"error": {"class": "GenericError", "desc": "Failed to connect socket: 
Connection refused"}}

> So, yes. We may create the socket in client mode through QMP without this 
> patch.
>
>> 
>> >      bool is_telnet      = sock->has_telnet  ? sock->telnet  : false;
>> >      bool is_tn3270      = sock->has_tn3270  ? sock->tn3270  : false;
>> >      bool is_waitconnect = sock->has_wait    ? sock->wait    : false;
>> >
>> 
>> 
>> -- 
>> Marc-André Lureau
>> 




reply via email to

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