@@ -94,10 +94,7 @@ class NetworkInterface extends Model {
9494 required: true ,
9595 unique: true ,
9696 maximum_length: 128 ,
97- validators: [
98- new FilterNameValidator (),
99- new UniqueFromForeignModelValidator (model: 'FirewallAlias ' , field: 'name ' ),
100- ],
97+ validators: [new UniqueFromForeignModelValidator (model: 'FirewallAlias ' , field: 'name ' )],
10198 verbose_name: 'Description ' ,
10299 help_text: 'The descriptive name for this interface. ' ,
103100 );
@@ -445,6 +442,16 @@ class NetworkInterface extends Model {
445442 * @returns string The validated $descr to set.
446443 * @throws ValidationError When the `$descr` value is invalid. */
447444 public function validate_descr (string $ descr ): string {
445+ # Only apply the filter-name validation when the descr CHANGES. pfSense
446+ # revalidates every field on PATCH, so validating an unchanged value
447+ # would lock entire interfaces whose pre-existing descr predates these
448+ # rules (e.g. 'LAN', which matches a reserved pf filter token) — the
449+ # GUI allows such interfaces to be edited without renaming.
450+ $ initial = $ this ->initial_object ;
451+ if ($ initial !== null and $ initial ->descr ->value === $ descr ) {
452+ return $ descr ;
453+ }
454+
448455 # Ensure OpenVPN interfaces are 22 characters or less
449456 if (str_starts_with ($ this ->if ->value , 'ovpn ' ) and strlen ($ descr ) > 22 ) {
450457 throw new ValidationError (
@@ -477,6 +484,11 @@ class NetworkInterface extends Model {
477484 );
478485 }
479486
487+ # Filter-name rules apply to NEW/CHANGED descr values only (moved
488+ # from the field-level validator so unchanged legacy values are
489+ # not re-validated on unrelated PATCHes).
490+ (new FilterNameValidator ())->validate ($ descr , 'descr ' );
491+
480492 return $ descr ;
481493 }
482494
0 commit comments