DistroKit Mailinglist
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: distrokit@pengutronix.de
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Subject: [DistroKit] [PATCH v1 3/4] mipsel: run: make network work on systems with multiple QEMU instances
Date: Wed, 16 Aug 2023 13:43:09 +0200	[thread overview]
Message-ID: <20230816114310.2637671-4-o.rempel@pengutronix.de> (raw)
In-Reply-To: <20230816114310.2637671-1-o.rempel@pengutronix.de>

Other platforms use already PPID based ssh forwarding configuration. So,
make it for MIPSEL too.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 configs/platform-mipsel/run | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/configs/platform-mipsel/run b/configs/platform-mipsel/run
index 36dc6de..6407f0c 100755
--- a/configs/platform-mipsel/run
+++ b/configs/platform-mipsel/run
@@ -36,14 +36,10 @@ if [ ! -e "${QEMU_EXEC}" ]; then
 	exit 1
 fi
 
-# the port a 'telned' would connect to (in the emulated sysem)
-TELNET_INTERNAL_PORT=23
-# port QEMU opens at the host side to give access to the ${TELNET_INTERNAL_PORT}
-TELNET_EXTERNAL_PORT=4444
-
-# dito for ssh
+# the port to which an sshd would connect (in the emulated system)
 SSH_INTERNAL_PORT=22
-SSH_EXTERNAL_PORT=4445
+# the port which QEMU opens at the host side to give access to the ${SSH_INTERNAL_PORT}
+SSH_EXTERNAL_PORT=${QEMU_SSH_PORT:-$((PPID%64000+1025))}
 
 # check if vde is available for networking
 if [ -z "${VDE_SOCKET}" ]; then
@@ -62,7 +58,8 @@ fi
 
 # fall back to user network if necessary
 if [ -z "${QEMU_NET}" ]; then
-	QEMU_NET=(-netdev user,id=net1,hostfwd=tcp:127.0.0.1:${TELNET_EXTERNAL_PORT}-:${TELNET_INTERNAL_PORT},hostfwd=tcp:127.0.0.1:${SSH_EXTERNAL_PORT}-:${SSH_INTERNAL_PORT} )
+	QEMU_NET=(-netdev user,id=net1,hostfwd=tcp:127.0.0.1:${SSH_EXTERNAL_PORT}-:${SSH_INTERNAL_PORT},hostfwd=tcp:127.0.0.1:12345-:12345)
+	echo "Forwarding SSH port 127.0.0.1:${SSH_EXTERNAL_PORT} -> qemu:${SSH_INTERNAL_PORT}"
 fi
 
 BASE_CMDLINE="console=ttyS0,115200"
-- 
2.39.2




  parent reply	other threads:[~2023-08-16 11:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16 11:43 [DistroKit] [PATCH v1 0/4] MIPS maintenance Oleksij Rempel
2023-08-16 11:43 ` [DistroKit] [PATCH v1 1/4] mips: run: make network work on systems with multiple QEMU instances Oleksij Rempel
2023-08-16 11:43 ` [DistroKit] [PATCH v1 2/4] mips: kernel: version bump 6.4.0 -> 6.4.10 Oleksij Rempel
2023-08-16 11:43 ` Oleksij Rempel [this message]
2023-08-16 11:43 ` [DistroKit] [PATCH v1 4/4] mipsel: " Oleksij Rempel
2023-08-17  7:42   ` Jan Lübbe
2023-08-17  7:46     ` Oleksij Rempel
2023-08-17  9:54       ` Jan Lübbe
2023-08-17  7:38 ` [DistroKit] [PATCH v1 0/4] MIPS maintenance Robert Schwebel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230816114310.2637671-4-o.rempel@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=distrokit@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox