diff options
author | Mikko Rapeli <mikko.rapeli@linaro.org> | 2022-11-14 17:50:37 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-11-20 08:29:07 +0000 |
commit | 248180ab2dea6af92c93f6c26e0da6d1a4445ae5 (patch) | |
tree | 7ac5d846d9f4a69cfee80ea1167e8ef833a3f2e6 /meta/lib/oeqa/utils/qemurunner.py | |
parent | 44bb88cc869f3b42440d6f7aad000e706b739a2b (diff) | |
download | poky-248180ab2dea6af92c93f6c26e0da6d1a4445ae5.tar.gz |
qemurunner.py: support setting slirp host IP address
By default host side IP address is not set and qemu listens
on all IP addresses on the host machine which is not a good
idea when images have root login enabled without password.
It make sense to listen only on localhost IP address 127.0.0.1 using
config change like:
QB_SLIRP_OPT = "-netdev user,id=net0,hostfwd=tcp:127.0.0.1:2222-:22"
This config works for qemu itself, but breaks runqemu which tries to
parse the host side port number from qemu process command line arguments.
So change the runqemu side hostfwd parsing for port number to ignore
the host IP address field.
Reviewed-by: Quentin Schulz <foss+yocto@0leil.net>
(From OE-Core rev: bdbd52082eb26f418000eb4e424baae9babc272c)
Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/utils/qemurunner.py')
-rw-r--r-- | meta/lib/oeqa/utils/qemurunner.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index e602399232..f175f8a1de 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py | |||
@@ -401,7 +401,8 @@ class QemuRunner: | |||
401 | cmdline = re_control_char.sub(' ', cmdline) | 401 | cmdline = re_control_char.sub(' ', cmdline) |
402 | try: | 402 | try: |
403 | if self.use_slirp: | 403 | if self.use_slirp: |
404 | tcp_ports = cmdline.split("hostfwd=tcp::")[1] | 404 | tcp_ports = cmdline.split("hostfwd=tcp:")[1] |
405 | tcp_ports = tcp_ports.split(":")[1] | ||
405 | host_port = tcp_ports[:tcp_ports.find('-')] | 406 | host_port = tcp_ports[:tcp_ports.find('-')] |
406 | self.ip = "localhost:%s" % host_port | 407 | self.ip = "localhost:%s" % host_port |
407 | else: | 408 | else: |