test-filter-mirror: pass UNIX domain socket through fd
commit773c4a6228fd910556cee2d477ee56c591a30000
authorJason Wang <jasowang@redhat.com>
Wed, 30 Jan 2019 03:14:27 +0000 (30 11:14 +0800)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 4 Feb 2019 16:03:20 +0000 (4 16:03 +0000)
tree0b6fff3003469f80306cab0e0a7ba9056669585b
parent335dbb5de1e98c4dc73590349f17bb2a4d72596c
test-filter-mirror: pass UNIX domain socket through fd

The tests tries to let qemu server mode to process the connection
which turns out to be racy after commit 8258292e18c3 ("monitor: Remove
"x-oob", offer capability "oob" unconditionally"). This is because the
filter may try to mirror the packets before UNIX socket object is
ready (connected was set to true) from the view of qemu. In this case
the packet will be dropped silently.

Fixing this by passing pre-connected socket created by socketpair() to
qemu through fd.

Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Li Zhijian <lizhijian@cn.fujitsu.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Cc: Zhang Chen <zhangckid@gmail.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Zhang Chen <zhangckid@gmail.com>
Message-id: 20190130031427.13129-1-jasowang@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
tests/test-filter-mirror.c