opnsense / core

OPNsense GUI, API and systems backend
https://opnsense.org/
BSD 2-Clause "Simplified" License
3.26k stars 725 forks source link

Wizard: LAN IP address is empty after entering invalid address and reloading #6681

Closed subnetspider closed 1 year ago

subnetspider commented 1 year ago

Important notices

Before you add a new report, we ask you kindly to acknowledge the following:

Describe the bug

After entering an invalid LAN IP address in the OPNsense wizard (e.g. an IPv6 address) and reloading at the end of the wizard, the LAN interface is left without an IPv4 interface. This practically breaks all connectivity of the LAN interface, including the GUI.

To Reproduce

Steps to reproduce the behavior:

  1. Go to "System: Wizard"
  2. Click "Next" until "System: Wizard: Configure LAN Interface".
  3. Enter something invalid (e.g. "fd00:10::1") into the field "LAN IP Address:".
  4. Click "OK" on the Pop-up "LAN IP Address field is invalid".
  5. Click "Next" until "System: Wizard: Reload Configuration".
  6. Click "Reload".

Expected behavior

The Wizard should prevent the user from proceeding after entering an invalid IP address, instead of only displaying the "LAN IP Address field is invalid" popup, like by graying out the "Next" button. While it is the user's fault for proceeding after the warning, the LAN interface on OPNsense is rendered completely unusable (no DNS, DHCP, routing, GUI, etc.) until the setting is corrected at the command line.

Describe alternatives you considered

Alternatively, if invalid data is entered in the LAN IP Address: field, the wizard could exit to the dashboard to prevent the user from locking themselves out.

Screenshots

Warning popup:

grafik

After the reload, the "IPv4 Configuration Type" is changed to "None".

grafik

Relevant log files

Configuration diff:

--- /conf/backup/config-1689971662.7157.xml 2023-07-21 22:34:22.716674000 +0200
+++ /conf/backup/config-1689971680.5847.xml 2023-07-21 22:34:40.585632000 +0200
@@ -277,7 +277,7 @@
       <descr/>
       <enable>1</enable>
       <spoofmac/>
-      <ipaddr>192.168.1.1</ipaddr>
+      <ipaddr>fd00:10::1</ipaddr>
       <subnet>24</subnet>
       <ipaddrv6>track6</ipaddrv6>
       <track6-interface>wan</track6-interface>
@@ -399,7 +399,7 @@
   </widgets>
   <revision>
     <username>root@192.168.1.2</username>
-    <time>1689971662.7157</time>
+    <time>1689971680.5847</time>
     <description>/wizard.php made changes</description>
   </revision>
   <OPNsense>

Environment

Software version used and hardware type if relevant, e.g.:

OPNsense 23.1.11-amd64 FreeBSD 13.1-RELEASE-p8 OpenSSL 1.1.1u 30 May 2023 Intel® Core™ i5-6500 3.2Ghz Quad Core Network Intel® I350-T4

subnetspider commented 1 year ago

Update

It seems that there is already a check for invalid IPv4 addresses, but it is not triggered with valid IPv6 addresses:

grafik

fichtner commented 1 year ago

@subnetspider thanks, c9bd89752 should fix this :)