Properties should be copied 1-to-1 before we apply the required
defaults if necessary. In the previous situation this caused
required properties to be set to an empty value after the default
value had already been written to it. In the failure case we
attempt to be a bit more explicit and refer to the crash reporter.
While here, the master branch has dropped the Phalcon Messages class,
so switch to count() since this seems to inherit array type
and is therefore backwards compatible:
$msgs = new \Phalcon\Messages\Messages();
$count = count($msgs);
// $count == 0
See https://github.com/opnsense/core/issues/6389
Add simple Message class and remove "Messages" dependancy in Validation.php, which should be backwards compatible with all existing validations.
By moving \Phalcon\Filter\Validation() into validate() we're making the validation paths more explicit, if an objects implements ValidatorInterface, it uses phalcon, otherwise it's a simple BaseValidator passing messages back to $this->appendMessage().
The original phalcon Message class has additional fields we don't use, we only use fieldname for tracking purposes and the message itself.
After giving this some thought, it looks like a good idea to fix this bug anyway. There is a very small chance people combine legacy and mvc rules which contradict eachother, but in the long run this will lead to more issues. Since getPriority() skipped group priority, we'll add the same calculation as being used in db4b90d218/src/etc/inc/filter.lib.inc (L632-L638) too.
There is a small chance of remnants after the fact, but dropping the interface is more problematic to recover from as it will invalidate filter rulesets as well.
The user is still able to force a stop/start using the reload action, which also reloads the filter after the fact.
proposal for https://github.com/opnsense/core/issues/7148
Since route add with subnet will revert to a strict subnet route
two separate entries 192.168.1.1/24 and 192.168.1.2/24 will both
be added as 192.168.1.0/24 and produce the same error.
Normalize here as well and get rid of the duplicates. It should
also fix IPv6 compression mismatches.
This commit adds a button to switching the items into a textarea and back which eases edits in these cases.
(only aavailable when new items are allowed in the form)
These are automatically created by ifconfig alias command above
and cause the (spurious) route add -q log messages. Functionally
nothing changes because route add declined to add the routes
already.
wg_start() can detect if the interface was removed, which is
ensured during 'restart' and a fresh 'configure'. The device
could have been created from wireguard_prepare() in the plugin
code but that should normally be used by interfaces_configure()
which also configures the interface correctly (same as the
interfaces_restart_by_device() call).
We only reload the routing in such cases now either as in the
other case the routes should have been placed and remain.