From: Mikko Rapeli Date: Mon, 14 Nov 2022 15:50:37 +0000 (+0200) Subject: qemurunner.py: support setting slirp host IP address X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~2467 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bdbd52082eb26f418000eb4e424baae9babc272c;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git 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 Signed-off-by: Mikko Rapeli Signed-off-by: Alexandre Belloni --- diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index e602399232b..f175f8a1ded 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py @@ -401,7 +401,8 @@ class QemuRunner: cmdline = re_control_char.sub(' ', cmdline) try: if self.use_slirp: - tcp_ports = cmdline.split("hostfwd=tcp::")[1] + tcp_ports = cmdline.split("hostfwd=tcp:")[1] + tcp_ports = tcp_ports.split(":")[1] host_port = tcp_ports[:tcp_ports.find('-')] self.ip = "localhost:%s" % host_port else: