Branch: refs/heads/master Home: https://github.com/qemu/qemu Commit: 63bab2b69688dee0ddadff7449143830e59567cd https://github.com/qemu/qemu/commit/63bab2b69688dee0ddadff7449143830e59567cd Author: Daniel P. Berrange <berra...@redhat.com> Date: 2018-03-13 (Tue, 13 Mar 2018)
Changed paths: M chardev/char-socket.c Log Message: ----------- char: don't silently skip tn3270 protocol init when TLS is enabled Even if common tn3270 implementations do not support TLS, it is trivial to have them proxied over a proxy like stunnel which adds TLS at the sockets layer. We should thus not silently skip tn3270 protocol initialization when TLS is enabled. Reviewed-by: Eric Blake <ebl...@redhat.com> Acked-by: Cornelia Huck <coh...@redhat.com> Signed-off-by: Daniel P. Berrange <berra...@redhat.com> Commit: 473a2a331ee382703f7ca0067ba2545350cfa06c https://github.com/qemu/qemu/commit/473a2a331ee382703f7ca0067ba2545350cfa06c Author: Daniel P. Berrange <berra...@redhat.com> Date: 2018-03-13 (Tue, 13 Mar 2018) Changed paths: M include/qemu/cutils.h M tests/test-cutils.c M util/cutils.c Log Message: ----------- cutils: add qemu_strtoi & qemu_strtoui parsers for int/unsigned int types There are qemu_strtoNN functions for various sized integers. This adds two more for plain int & unsigned int types, with suitable range checking. Reviewed-by: Eric Blake <ebl...@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com> Signed-off-by: Daniel P. Berrange <berra...@redhat.com> Commit: 9b589ffb1237ec54f8341d8a80ba77f31d428842 https://github.com/qemu/qemu/commit/9b589ffb1237ec54f8341d8a80ba77f31d428842 Author: Daniel P. Berrange <berra...@redhat.com> Date: 2018-03-13 (Tue, 13 Mar 2018) Changed paths: M tests/Makefile.include A tests/socket-helpers.c A tests/socket-helpers.h M tests/test-io-channel-socket.c Log Message: ----------- sockets: pull code for testing IP availability out of specific test The test-io-channel-socket.c file has some useful helper functions for checking if a specific IP protocol is available. Other tests need to perform similar kinds of checks to avoid running tests that will fail due to missing IP protocols. Reviewed-by: Eric Blake <ebl...@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com> Signed-off-by: Daniel P. Berrange <berra...@redhat.com> Commit: abd983c0e0beb4b15326e51a837e1b5177df0e08 https://github.com/qemu/qemu/commit/abd983c0e0beb4b15326e51a837e1b5177df0e08 Author: Daniel P. Berrange <berra...@redhat.com> Date: 2018-03-13 (Tue, 13 Mar 2018) Changed paths: M tests/socket-helpers.c M tests/socket-helpers.h Log Message: ----------- sockets: strengthen test suite IP protocol availability checks Instead of just checking whether it is possible to bind() on a socket, also check that we can successfully connect() to the socket we bound to. This more closely replicates the level of functionality that tests will actually use. Reviewed-by: Eric Blake <ebl...@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com> Signed-off-by: Daniel P. Berrange <berra...@redhat.com> Commit: 58dc31f1a7dc6cd0f21bd51a34011ba366d36e53 https://github.com/qemu/qemu/commit/58dc31f1a7dc6cd0f21bd51a34011ba366d36e53 Author: Daniel P. Berrange <berra...@redhat.com> Date: 2018-03-13 (Tue, 13 Mar 2018) Changed paths: M include/qemu/sockets.h M io/channel-util.c M tests/.gitignore M tests/Makefile.include A tests/test-util-sockets.c M util/qemu-sockets.c Log Message: ----------- sockets: move fd_is_socket() into common sockets code The fd_is_socket() helper method is useful in a few places, so put it in the common sockets code. Make the code more compact while moving it. Reviewed-by: Eric Blake <ebl...@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com> Signed-off-by: Daniel P. Berrange <berra...@redhat.com> Commit: 30bdb3c56ddd911ab2b1629faa4ce6e883b80e2a https://github.com/qemu/qemu/commit/30bdb3c56ddd911ab2b1629faa4ce6e883b80e2a Author: Daniel P. Berrange <berra...@redhat.com> Date: 2018-03-13 (Tue, 13 Mar 2018) Changed paths: M tests/test-util-sockets.c M util/qemu-sockets.c Log Message: ----------- sockets: check that the named file descriptor is a socket The SocketAddress struct has an "fd" type, which references the name of a file descriptor passed over the monitor using the "getfd" command. We currently blindly assume the FD is a socket, which can lead to hard to diagnose errors later. This adds an explicit check that the FD is actually a socket to improve the error diagnosis. Reviewed-by: Eric Blake <ebl...@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com> Signed-off-by: Daniel P. Berrange <berra...@redhat.com> Commit: 1723d6b1cfe6572881f578bce3aa25185b81b148 https://github.com/qemu/qemu/commit/1723d6b1cfe6572881f578bce3aa25185b81b148 Author: Daniel P. Berrange <berra...@redhat.com> Date: 2018-03-13 (Tue, 13 Mar 2018) Changed paths: M qapi/sockets.json M tests/test-util-sockets.c M util/qemu-sockets.c Log Message: ----------- sockets: allow SocketAddress 'fd' to reference numeric file descriptors The SocketAddress 'fd' kind accepts the name of a file descriptor passed to the monitor with the 'getfd' command. This makes it impossible to use the 'fd' kind in cases where a monitor is not available. This can apply in handling command line argv at startup, or simply if internal code wants to use SocketAddress and pass a numeric FD it has acquired from elsewhere. Fortunately the 'getfd' command mandated that the FD names must not start with a leading digit. We can thus safely extend semantics of the SocketAddress 'fd' kind, to allow a purely numeric name to reference an file descriptor that QEMU already has open. There will be restrictions on when each kind can be used. In codepaths where we are handling a monitor command (ie cur_mon != NULL), we will only support use of named file descriptors as before. Use of FD numbers is still not permitted for monitor commands. In codepaths where we are not handling a monitor command (ie cur_mon == NULL), we will not support named file descriptors. Instead we can reference FD numers explicitly. This allows the app spawning QEMU to intentionally "leak" a pre-opened socket to QEMU and reference that in a SocketAddress definition, or for code inside QEMU to pass pre-opened FDs around. Reviewed-by: Eric Blake <ebl...@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com> Signed-off-by: Daniel P. Berrange <berra...@redhat.com> Commit: 9bb4060c998e56976b36ee628ce7e0ecbd8ffb49 https://github.com/qemu/qemu/commit/9bb4060c998e56976b36ee628ce7e0ecbd8ffb49 Author: Daniel P. Berrange <berra...@redhat.com> Date: 2018-03-13 (Tue, 13 Mar 2018) Changed paths: M chardev/char-socket.c Log Message: ----------- char: refactor parsing of socket address information To prepare for handling more address types, refactor the parsing of socket address information to make it more robust and extensible. Reviewed-by: Eric Blake <ebl...@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com> Signed-off-by: Daniel P. Berrange <berra...@redhat.com> Commit: 0935700f8544033ebbd41e1f13cd528f8a58d24d https://github.com/qemu/qemu/commit/0935700f8544033ebbd41e1f13cd528f8a58d24d Author: Daniel P. Berrange <berra...@redhat.com> Date: 2018-03-13 (Tue, 13 Mar 2018) Changed paths: M chardev/char-socket.c M chardev/char.c M tests/test-char.c Log Message: ----------- char: allow passing pre-opened socket file descriptor at startup When starting QEMU management apps will usually setup a monitor socket, and then open it immediately after startup. If not using QEMU's own -daemonize arg, this process can be troublesome to handle correctly. The mgmt app will need to repeatedly call connect() until it succeeds, because it does not know when QEMU has created the listener socket. If can't retry connect() forever though, because an error might have caused QEMU to exit before it even creates the monitor. The obvious way to fix this kind of problem is to just pass in a pre-opened socket file descriptor for the QEMU monitor to listen on. The management app can now immediately call connect() just once. If connect() fails it knows that QEMU has exited with an error. The SocketAddress(Legacy) structs allow for FD passing via the monitor, and now via inherited file descriptors from the process that spawned QEMU. The final missing piece is adding a 'fd' parameter in the socket chardev options. This allows both HMP usage, pass any FD number with SCM_RIGHTS, then running HMP commands: getfd myfd chardev-add socket,fd=myfd Note that numeric FDs cannot be referenced directly in HMP, only named FDs. And also CLI usage, by leak FD 3 from parent by clearing O_CLOEXEC, then spawning QEMU with -chardev socket,fd=3,id=mon -mon chardev=mon,mode=control Note that named FDs cannot be referenced in CLI args, only numeric FDs. We do not wire this up in the legacy chardev syntax, so you cannot use FD passing with '-qmp', you must use the modern '-mon' + '-chardev' pair. When passing pre-opened FDs there is a restriction on use of TLS encryption. It can be used on a server socket chardev, but cannot be used for a client socket chardev. This is because when validating a server's certificate, the client needs to have a hostname available to match against the certificate identity. An illustrative example of usage is: #!/usr/bin/perl use IO::Socket::UNIX; use Fcntl; unlink "/tmp/qmp"; my $srv = IO::Socket::UNIX->new( Type => SOCK_STREAM(), Local => "/tmp/qmp", Listen => 1, ); my $flags = fcntl $srv, F_GETFD, 0; fcntl $srv, F_SETFD, $flags & ~FD_CLOEXEC; my $fd = $srv->fileno(); exec "qemu-system-x86_64", \ "-chardev", "socket,fd=$fd,server,nowait,id=mon", \ "-mon", "chardev=mon,mode=control"; Reviewed-by: Eric Blake <ebl...@redhat.com> Signed-off-by: Daniel P. Berrange <berra...@redhat.com> Commit: 58888f8cdd198affa454f9bf664a076f5f63a6a6 https://github.com/qemu/qemu/commit/58888f8cdd198affa454f9bf664a076f5f63a6a6 Author: Peter Maydell <peter.mayd...@linaro.org> Date: 2018-03-15 (Thu, 15 Mar 2018) Changed paths: M chardev/char-socket.c M chardev/char.c M include/qemu/cutils.h M include/qemu/sockets.h M io/channel-util.c M qapi/sockets.json M tests/.gitignore M tests/Makefile.include A tests/socket-helpers.c A tests/socket-helpers.h M tests/test-char.c M tests/test-cutils.c M tests/test-io-channel-socket.c A tests/test-util-sockets.c M util/cutils.c M util/qemu-sockets.c Log Message: ----------- Merge remote-tracking branch 'remotes/berrange/tags/socket-next-pull-request' into staging # gpg: Signature made Tue 13 Mar 2018 18:12:14 GMT # gpg: using RSA key BE86EBB415104FDF # gpg: Good signature from "Daniel P. Berrange <d...@berrange.com>" # gpg: aka "Daniel P. Berrange <berra...@redhat.com>" # Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E 8E3F BE86 EBB4 1510 4FDF * remotes/berrange/tags/socket-next-pull-request: char: allow passing pre-opened socket file descriptor at startup char: refactor parsing of socket address information sockets: allow SocketAddress 'fd' to reference numeric file descriptors sockets: check that the named file descriptor is a socket sockets: move fd_is_socket() into common sockets code sockets: strengthen test suite IP protocol availability checks sockets: pull code for testing IP availability out of specific test cutils: add qemu_strtoi & qemu_strtoui parsers for int/unsigned int types char: don't silently skip tn3270 protocol init when TLS is enabled Signed-off-by: Peter Maydell <peter.mayd...@linaro.org> Compare: https://github.com/qemu/qemu/compare/55901900ec69...58888f8cdd19