Hi Mikko,

On 11/14/22 11:19, Mikko Rapeli wrote:
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:

QB_SLIRP_OPT = "-netdev user,id=net0,hostfwd=tcp:127.0.0.1:2222-:22"

Support detecting port number from this too.

Signed-off-by: Mikko Rapeli <[email protected]>
---
  meta/lib/oeqa/utils/qemurunner.py | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

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:
                  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

But localhost is enforced here?

This patch basically allows to pass
hostfwd=tcp:127.0.0.1:2222-:22
instead of
hostfwd=tcp::2222-:22
but with the exact same result (which is, localhost:2222 will be used?)

Also, this could be migrated to using re instead of doing manual lookups.

I'm not sure the commit log matches what the commit is actually doing?

Cheers,
Quentin
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#173235): 
https://lists.openembedded.org/g/openembedded-core/message/173235
Mute This Topic: https://lists.openembedded.org/mt/95016024/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to