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

Torben Hohn torben.hohn at linutronix.de
Tue Sep 10 14:15:10 CEST 2019


On Tue, Sep 10, 2019 at 11:01:40AM +0200, bage at linutronix.de wrote:
> 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.

cant we terminate with an error here ?
because silently ignoring the forward, will lead to hard to debug
problems.

> 
> 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
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner



More information about the elbe-devel mailing list