Skip to content

Commit

Permalink
char-socket: make 'fd' incompatible with 'reconnect'
Browse files Browse the repository at this point in the history
A chardev socket created with the 'fd=' argument is not going to
handle reconnection properly by recycling the same fd (or not in a
supported way). Let's forbid this case.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
  • Loading branch information
elmarco committed Nov 1, 2018
1 parent 3b02375 commit 4591bd4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chardev/char-socket.c
Expand Up @@ -997,6 +997,10 @@ static void qmp_chardev_open_socket(Chardev *chr,

s->addr = addr = socket_address_flatten(sock->addr);

if (sock->has_reconnect && addr->type == SOCKET_ADDRESS_TYPE_FD) {
error_setg(errp, "'reconnect' option is incompatible with 'fd'");
goto error;
}
qemu_chr_set_feature(chr, QEMU_CHAR_FEATURE_RECONNECTABLE);
/* TODO SOCKET_ADDRESS_FD where fd has AF_UNIX */
if (addr->type == SOCKET_ADDRESS_TYPE_UNIX) {
Expand Down

0 comments on commit 4591bd4

Please sign in to comment.