[elbe-devel] [PATCH] init: prevent host forwarding conflicts

bage at linutronix.de bage at linutronix.de
Tue Sep 10 11:01:40 CEST 2019


From: Bastian Germann <bage at linutronix.de>

Override the host side port of a user defined host forwarding rule if it matches
the ssh or soap port.  This will prevent a libvirt/qemu error.

Signed-off-by: Bastian Germann <bage at linutronix.de>
---
 elbepack/init/libvirt.xml.mako | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/elbepack/init/libvirt.xml.mako b/elbepack/init/libvirt.xml.mako
index a0e1f2ef..8adfdc18 100644
--- a/elbepack/init/libvirt.xml.mako
+++ b/elbepack/init/libvirt.xml.mako
@@ -30,8 +30,10 @@ emulator = prj.text('interpreter', default=defs, key='interpreter')
 nicmac = prj.text('buildimage/NIC/MAC', default=defs, key='nicmac')
 forward = ''
 for f in prj.node("portforwarding"):
-    forward += ',hostfwd=%s::%s-:%s' % (
-        f.text("proto"), f.text("host"), f.text("buildenv"))
+    if f.text("proto") != "tcp" or (f.text("host") != cfg['soapport']
+            and f.text("host") != cfg['sshport']):
+        forward += ',hostfwd=%s::%s-:%s' % (
+            f.text("proto"), f.text("host"), f.text("buildenv"))
 
 forward += ',hostfwd=%s::%s-:%s' % ("tcp", cfg['soapport'], "7588")
 if cfg['sshport'] != '-1':
-- 
2.20.1




More information about the elbe-devel mailing list