Project

General

Profile

Bug #6224

Firewall NAT Edit forgets dst type selection after reporting input errors

Added by Phillip Davis 11 months ago. Updated about 2 months ago.

Status:
Resolved
Priority:
Low
Category:
Web Interface
Target version:
Start date:
04/21/2016
Due date:
% Done:

100%

Affected version:
2.3.x
Affected Architecture:

Description

Example:
1) Start with a NAT port forward that has some special source type and destination type - e.g. just for fun source type LAN net, destination type This Firewall.
2) Edit the NAT port forward - change source type to Network, change destination type to Network. Do not actually input an network address.
3) Press Save
4) Input error messages are displayed (good):
The field Source address is required.
The field Destination address is required.
5) The source type remains as Network, awaiting entry of a network and mask - good.
6) The destination type becomes WAN address - problem!
If the user is not watching, they might end up leaving WAN address there because they do not realize what just happened.

I was expecting that it would either:
a) Redisplay the form with destination type Network, awaiting entry of the network and mask; or
b) Redisplay the original setting (e.g. This Firewall)

It will be something in the JavaScript which is doing different stuff for the dsttype field than for the srctype field.

Associated revisions

Revision f7405cd2
Added by Phillip Davis 4 months ago

Fix #6224 NAT edit - preserve user selections when input errors

1) Edit a NAT Port Forward rule, change the destination type to "Network", but do not input any network address/mask.
2) Press Save, an input error is reported telling that the network destination address/mask is required - good.
However, the destination type is no longer "Network" - it goes to "xxx address" where "xxx" is the selected interface.

The problem is that JS dst_change() is being called on every page load. That is good when starting a new entry (the Destination gets set to WAN address to match the default interface of WAN), or when starting to edit an existing entry (the code runs without messing anything up). But when data has been $_POSTed and there are input errors, we just want to redisplay whatever the user had selected, not go trying to fix up correlations between fields.

Revision 823b7a1a
Added by Phillip Davis 4 months ago

Fix #6224 NAT edit - preserve user selections when input errors

1) Edit a NAT Port Forward rule, change the destination type to "Network", but do not input any network address/mask.
2) Press Save, an input error is reported telling that the network destination address/mask is required - good.
However, the destination type is no longer "Network" - it goes to "xxx address" where "xxx" is the selected interface.

The problem is that JS dst_change() is being called on every page load. That is good when starting a new entry (the Destination gets set to WAN address to match the default interface of WAN), or when starting to edit an existing entry (the code runs without messing anything up). But when data has been $_POSTed and there are input errors, we just want to redisplay whatever the user had selected, not go trying to fix up correlations between fields.
(cherry picked from commit f7405cd2f750e20735aa7b584c0f322e9e0f6cc6)

History

#1 Updated by Phillip Davis 11 months ago

Note: This behavior is seen with the 2.3-RELEASE code, and with subsequent changes related to https://redmine.pfsense.org/issues/6173 - so this is not directly related to the issues for 6173, it just happens that I noticed it while testing stuff related to 6173.

#2 Updated by Chris Buechler 10 months ago

  • Status changed from New to Confirmed
  • Affected version changed from 2.3 to 2.3.x

#4 Updated by Renato Botelho 4 months ago

  • Status changed from Confirmed to Feedback
  • Assignee set to Renato Botelho
  • Target version set to 2.4.0
  • % Done changed from 0 to 100

Merged, thanks!

#5 Updated by Jim Pingle 3 months ago

  • Status changed from Feedback to Resolved

Works as expected now

#6 Updated by Jim Pingle about 2 months ago

  • Target version changed from 2.4.0 to 2.3.3

Also available in: Atom PDF