From patchwork Fri Mar 19 17:32:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Marx X-Patchwork-Id: 3952 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4F29vT0Dwgz40Qq for ; Fri, 19 Mar 2021 17:32:37 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4F29vS03Hsz1nN; Fri, 19 Mar 2021 17:32:35 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4F29vR5vzbz2xd7; Fri, 19 Mar 2021 17:32:35 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4F29vR0TBpz2xF1 for ; Fri, 19 Mar 2021 17:32:35 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4F29vP6s1Czj5; Fri, 19 Mar 2021 17:32:33 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1616175154; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=VBsgD8E6/9RT5yPOzSSqNfGqcxY88GmmcIh6A45qkQ8=; b=sgTPEwIV7YDcYDsQyQWTfylmk8pVzfJvTD99D+8HpPWJZDY9ZQvvKvxtpoWMfvSGUPeo3F gwtbCoQk6NsAjMCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1616175154; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=VBsgD8E6/9RT5yPOzSSqNfGqcxY88GmmcIh6A45qkQ8=; b=ZkkGAcSz9GQUXc0D1zB6YS1Ls3os/+jR00TeUkRYW+cW3SaSaxU3lP2OoU8zGNcYGlvNUD P+BpdqxUSekkG8YyH+Q6AvyDt0c5n6VAf9EdDicE/QaKZXAUYo7ArNhD3BcW9XXZISrh2F cfaCTIZGfnoaLF4z62qmJjijuLG+ytDyccnUuzZbTGm/kHkTNDykRYWk4dlqsU1R64ySD/ WGcPyxg94wfFhr3uL6vfar+pNCeYMGBVd+qmWTdip9j7m5OzBBM3H3NCJkvXzNk7bloiJi FzbsTmK+EiEwBNd5F62KO7PqsQBGtr/CoR73cAODFc6ChM0QKdNLL76BuEzUaw== From: Alexander Marx To: development@lists.ipfire.org Subject: [PATCH] BUG12479: Copied NAT rule in Firewall displays incorrect source Port Date: Fri, 19 Mar 2021 18:32:19 +0100 Message-Id: <20210319173219.13692-1-alexander.marx@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Fixes: #12479 When copying a NAT rule in the firewall the existing sourceport is copied, too. This Fix deletes the sourceport from a copied NAT rule. After Saving, the correct port is used. Signed-off-by: Alexander Marx --- html/cgi-bin/firewall.cgi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/html/cgi-bin/firewall.cgi b/html/cgi-bin/firewall.cgi index 1483e779f..532f99f91 100644 --- a/html/cgi-bin/firewall.cgi +++ b/html/cgi-bin/firewall.cgi @@ -1552,6 +1552,11 @@ sub newrule $fwdfwsettings{'USE_NAT'} = $hash{$key}[28]; $fwdfwsettings{'nat'} = $hash{$key}[31]; #changed order $fwdfwsettings{$fwdfwsettings{'nat'}} = $hash{$key}[29]; + #Fix BUG 12479 + #When copying a DNAT Rule, the sourceport has to be empty at this point. + if($hash{$key}[14] eq 'cust_srv' and $hash{$key}[31] eq 'dnat'){ + $hash{$key}[30] = ''; + } $fwdfwsettings{'dnatport'} = $hash{$key}[30]; $fwdfwsettings{'LIMIT_CON_CON'} = $hash{$key}[32]; $fwdfwsettings{'concon'} = $hash{$key}[33];