OPNSense/core 2a586c4src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api SourceNatController.php FilterController.php

Firewall: NAT: Source NAT - simplify /api/firewall/source_nat/search_rule for https://github.com/opnsense/core/pull/10373

While reviewing this code, I noticed the FilterController could by simplified a bit as well when it comes to extracting model records, so make sure we use the same strategy in both.
All rules follow the same logic now and we only have to parse the record set once to filter and update it.
DeltaFile
+22-36src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/SourceNatController.php
+2-12src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterController.php
+24-482 files

OPNSense/core 5fe316bsrc/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api AssignmentController.php, src/opnsense/mvc/app/models/OPNsense/Interfaces NetInterface.php

Interfaces: Assignments - refactor to MVC for https://github.com/opnsense/core/issues/9945

In order to migrate the interface assignments, we need to think of a way to use the differently named xml nodes for interfaces (wan, lan, ..) into something that closely resembles a standard model implementation.
Since we can't match these nodes in our statically defined model xmls, the main idea is to flush all via an in-memory model with a separate load [construct] and save hook [serializeToConfig].

The next challenge is to "stash" updates and wait for "apply" in certain cases, for this we add a temporary database holding the changes  which are synced after the actual system change has happend (pending_action, pending_if). When succesfully applied, the apply function cleans up the final stage of the configuration to make everything consistent again.

This database is a simple single json encoded file named /tmp/.interfaces.todo
DeltaFile
+0-498src/www/interfaces_assign.php
+172-0src/opnsense/mvc/app/models/OPNsense/Interfaces/NetInterface.php
+170-0src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/AssignmentController.php
+90-0src/opnsense/scripts/interfaces/list_assign_options.php
+73-0src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/DeviceField.php
+64-0src/opnsense/scripts/interfaces/apply_pending_if_changes.php
+569-49810 files not shown
+751-50316 files

OPNSense/core d927ef2src/opnsense/mvc/app/models/OPNsense/Firewall/Menu Menu.php

Migration assistant menu item on second level in the menu tree can use cssClass for icon render
DeltaFile
+4-3src/opnsense/mvc/app/models/OPNsense/Firewall/Menu/Menu.php
+4-31 files

OPNSense/core a134f5dsrc/opnsense/mvc/app/views/OPNsense/Firewall filter_rule.volt

Firewall: Rules: header checkbox for multi-row selection now works properly
DeltaFile
+0-6src/opnsense/mvc/app/views/OPNsense/Firewall/filter_rule.volt
+0-61 files

OPNSense/core 52c3948src/opnsense/mvc/app/views/OPNsense/Firewall nat_rule.volt

Remove orphaned variable
DeltaFile
+0-2src/opnsense/mvc/app/views/OPNsense/Firewall/nat_rule.volt
+0-21 files

OPNSense/core aa13cf6src/opnsense/mvc/app/views/OPNsense/Firewall filter_rule.volt

Firewall Rules: fix group ordering, change ruleTypeMap to array, fix row selection
DeltaFile
+67-59src/opnsense/mvc/app/views/OPNsense/Firewall/filter_rule.volt
+67-591 files

OPNSense/core 281a033src/opnsense/mvc/app/views/OPNsense/Firewall nat_rule.volt

Bind settings-changed event in mapDataToFormUI callback
DeltaFile
+4-8src/opnsense/mvc/app/views/OPNsense/Firewall/nat_rule.volt
+4-81 files

OPNSense/core 2acdd48src/opnsense/mvc/app/models/OPNsense/Core/Menu Menu.xml, src/opnsense/mvc/app/models/OPNsense/Firewall/Menu Menu.php

Hide the Outbound NAT menu item if mode is either automatic or disabled, or no rules node exists anymore in it. Move migration assistant out of Rules [legacy] so it doesn't disappear if no legacy rules exist anymore, now that it is also used for NAT migration.
DeltaFile
+16-2src/opnsense/mvc/app/models/OPNsense/Firewall/Menu/Menu.php
+1-5src/opnsense/mvc/app/models/OPNsense/Core/Menu/Menu.xml
+17-72 files

OPNSense/core 91f67efsrc/opnsense/mvc/app/views/OPNsense/Firewall nat_rule.volt

Missing ;
DeltaFile
+1-1src/opnsense/mvc/app/views/OPNsense/Firewall/nat_rule.volt
+1-11 files

OPNSense/core 3e237d8src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api SourceNatController.php

Add nosync and tag keys to automatic rules as well
DeltaFile
+4-0src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/SourceNatController.php
+4-01 files

OPNSense/core f145bdfsrc/opnsense/mvc/app/controllers/OPNsense/Firewall/Api MigrationController.php, src/opnsense/mvc/app/library/OPNsense/Core ConfigMaintenance.php

Add a flush action for outbound NAT rules, it still requires some work in ConfigMaintenance
DeltaFile
+28-1src/opnsense/mvc/app/views/OPNsense/Firewall/firewall_migration.volt
+13-1src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/MigrationController.php
+2-0src/opnsense/mvc/app/library/OPNsense/Core/ConfigMaintenance.php
+43-23 files

OPNSense/core 9392a44src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api MigrationController.php

Forgot hooking up the MigrationController
DeltaFile
+10-0src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/MigrationController.php
+10-01 files

OPNSense/core 7ac99cfsrc/opnsense/mvc/app/controllers/OPNsense/Firewall/forms dialogSNatRule.xml, src/opnsense/mvc/app/models/OPNsense/Firewall Filter.xml

Add missing tag and nosync fields to SNAT model and to the exporter script
DeltaFile
+23-0src/opnsense/mvc/app/controllers/OPNsense/Firewall/forms/dialogSNatRule.xml
+8-1src/opnsense/mvc/app/models/OPNsense/Firewall/Filter.xml
+2-0src/opnsense/scripts/filter/list_legacy_outbound_nat.php
+33-13 files

OPNSense/core 8b5441bsrc/opnsense/scripts/filter list_legacy_outbound_nat.php

Empty uuid on export, the import should create it
DeltaFile
+1-1src/opnsense/scripts/filter/list_legacy_outbound_nat.php
+1-11 files

OPNSense/core c0cf70bsrc/opnsense/scripts/filter list_legacy_outbound_nat.php

make sweep
DeltaFile
+1-1src/opnsense/scripts/filter/list_legacy_outbound_nat.php
+1-11 files

OPNSense/core 11dd17c. plist, src/opnsense/mvc/app/views/OPNsense/Firewall firewall_migration.volt

Firewall: NAT: Add migration workflow to existing migration assistant and add export script
DeltaFile
+132-0src/opnsense/scripts/filter/list_legacy_outbound_nat.php
+83-25src/opnsense/mvc/app/views/OPNsense/Firewall/firewall_migration.volt
+7-0src/www/firewall_nat_out.php
+6-0src/opnsense/service/conf/actions.d/actions_filter.conf
+1-0plist
+229-255 files

OPNSense/core 9cee4fbsrc/opnsense/mvc/app/views/OPNsense/Firewall filter_rule.volt

Firewall: Rules: always collapse auto rules, add early bailouts
DeltaFile
+13-1src/opnsense/mvc/app/views/OPNsense/Firewall/filter_rule.volt
+13-11 files

OPNSense/core 74acf86src/opnsense/mvc/app/views/OPNsense/Firewall filter_rule.volt

Firewall: Rules: adjust type map accordingly to previous
DeltaFile
+2-3src/opnsense/mvc/app/views/OPNsense/Firewall/filter_rule.volt
+2-31 files

OPNSense/core 977c2f3src/etc/inc filter.lib.inc

Firewall: Rules: set outbound gateway rules to prio 10000
DeltaFile
+1-1src/etc/inc/filter.lib.inc
+1-11 files

OPNSense/core 1b043eesrc/opnsense/mvc/app/views/OPNsense/Firewall nat_rule.volt

Fire a settings-changed when the snat_mode is changed after the page has been loaded
DeltaFile
+9-0src/opnsense/mvc/app/views/OPNsense/Firewall/nat_rule.volt
+9-01 files

OPNSense/core d660549src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api AssignmentController.php, src/opnsense/mvc/app/models/OPNsense/Interfaces NetInterface.php

Interfaces: Assignments - refactor to MVC for https://github.com/opnsense/core/issues/9945

In order to migrate the interface assignments, we need to think of a way to use the differently named xml nodes for interfaces (wan, lan, ..) into something that closely resembles a standard model implementation.
Since we can't match these nodes in our statically defined model xmls, the main idea is to flush all via an in-memory model with a separate load [construct] and save hook [serializeToConfig].

The next challenge is to "stash" updates and wait for "apply" in certain cases, for this we add a temporary database holding the changes  which are synced after the actual system change has happend (pending_action, pending_if). When succesfully applied, the apply function cleans up the final stage of the configuration to make everything consistent again.

This database is a simple single json encoded file named /tmp/.interfaces.todo
DeltaFile
+0-498src/www/interfaces_assign.php
+172-0src/opnsense/mvc/app/models/OPNsense/Interfaces/NetInterface.php
+170-0src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/AssignmentController.php
+90-0src/opnsense/scripts/interfaces/list_assign_options.php
+73-0src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/DeviceField.php
+64-0src/opnsense/scripts/interfaces/apply_pending_if_changes.php
+569-49810 files not shown
+753-50316 files

OPNSense/core 9e4f5a6src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api AssignmentController.php, src/opnsense/mvc/app/models/OPNsense/Interfaces NetInterface.php

Interfaces: Assignments - refactor to MVC for https://github.com/opnsense/core/issues/9945

In order to migrate the interface assignments, we need to think of a way to use the differently named xml nodes for interfaces (wan, lan, ..) into something that closely resembles a standard model implementation.
Since we can't match these nodes in our statically defined model xmls, the main idea is to flush all via an in-memory model with a separate load [construct] and save hook [serializeToConfig].

The next challenge is to "stash" updates and wait for "apply" in certain cases, for this we add a temporary database holding the changes  which are synced after the actual system change has happend (pending_action, pending_if). When succesfully applied, the apply function cleans up the final stage of the configuration to make everything consistent again.

This database is a simple single json encoded file named /tmp/.interfaces.todo
DeltaFile
+0-498src/www/interfaces_assign.php
+172-0src/opnsense/mvc/app/models/OPNsense/Interfaces/NetInterface.php
+170-0src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/AssignmentController.php
+90-0src/opnsense/scripts/interfaces/list_assign_options.php
+73-0src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/NetInterfaceField.php
+64-0src/opnsense/scripts/interfaces/apply_pending_if_changes.php
+569-49810 files not shown
+753-50316 files

OPNSense/core d10b62fsrc/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api AssignmentController.php, src/opnsense/mvc/app/models/OPNsense/Interfaces NetInterface.php

Interfaces: Assignments - refactor to MVC for https://github.com/opnsense/core/issues/9945

In order to migrate the interface assignments, we need to think of a way to use the differently named xml nodes for interfaces (wan, lan, ..) into something that closely resembles a standard model implementation.
Since we can't match these nodes in our statically defined model xmls, the main idea is to flush all via an in-memory model with a separate load [construct] and save hook [serializeToConfig].

The next challenge is to "stash" updates and wait for "apply" in certain cases, for this we add a temporary database holding the changes  which are synced after the actual system change has happend (pending_action, pending_if). When succesfully applied, the apply function cleans up the final stage of the configuration to make everything consistent again.

This database is a simple single json encoded file named /tmp/.interfaces.todo
DeltaFile
+0-498src/www/interfaces_assign.php
+172-0src/opnsense/mvc/app/models/OPNsense/Interfaces/NetInterface.php
+170-0src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/AssignmentController.php
+90-0src/opnsense/scripts/interfaces/list_assign_options.php
+73-0src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/NetInterfaceField.php
+64-0src/opnsense/scripts/interfaces/apply_pending_if_changes.php
+569-49810 files not shown
+753-50316 files

OPNSense/core 9e8bf1fsrc/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api AssignmentController.php, src/opnsense/mvc/app/models/OPNsense/Interfaces Assignment.php

Interfaces: Assignments - work in progress for https://github.com/opnsense/core/issues/9945

In order to migrate the interface assignments, we need to think of a way to use the differently named xml nodes for interfaces (wan, lan, ..) into something that closely resembles a standard model implementation.
Since we can't match these nodes in our statically defined model xmls, the main idea is to flush all via an in-memory model with a separate load [construct] and save hook [serializeToConfig].

The next challenge is to "stash" updates and wait for "apply" in certain cases, for this we add a temporary database holding the changes  which are synced after the actual system change has happend (pending_action, pending_if). When succesfully applied, the apply function cleans up the final stage of the configuration to make everything consistent again.

This database is a simple single json encoded file named /tmp/.interfaces.todo
DeltaFile
+0-498src/www/interfaces_assign.php
+172-0src/opnsense/mvc/app/models/OPNsense/Interfaces/Assignment.php
+170-0src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/AssignmentController.php
+90-0src/opnsense/scripts/interfaces/list_assign_options.php
+73-0src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/AssignmentInterfaceField.php
+64-0src/opnsense/scripts/interfaces/apply_pending_if_changes.php
+569-49810 files not shown
+754-50316 files

OPNSense/core 67d6f60src/opnsense/mvc/app/views/OPNsense/Firewall filter_rule.volt

Firewall Rules: clean this up as well
DeltaFile
+29-32src/opnsense/mvc/app/views/OPNsense/Firewall/filter_rule.volt
+29-321 files

OPNSense/core bfa5a52src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api AssignmentController.php, src/opnsense/mvc/app/models/OPNsense/Interfaces Assignment.php

Interfaces: Assignments - work in progress for https://github.com/opnsense/core/issues/9945

In order to migrate the interface assignments, we need to think of a way to use the differently named xml nodes for interfaces (wan, lan, ..) into something that closely resembles a standard model implementation.
Since we can't match these nodes in our statically defined model xmls, the main idea is to flush all via an in-memory model with a separate load [construct] and save hook [serializeToConfig].

The next challenge is to "stash" updates and wait for "apply" in certain cases, for this we add a temporary database holding the changes  which are synced after the actual system change has happend (pending_action, pending_if). When succesfully applied, the apply function cleans up the final stage of the configuration to make everything consistent again.

This database is a simple single json encoded file named /tmp/.interfaces.todo
DeltaFile
+170-0src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/AssignmentController.php
+162-0src/opnsense/mvc/app/models/OPNsense/Interfaces/Assignment.php
+90-0src/opnsense/scripts/interfaces/list_assign_options.php
+73-0src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/AssignmentInterfaceField.php
+64-0src/opnsense/scripts/interfaces/apply_pending_if_changes.php
+54-0src/opnsense/mvc/app/views/OPNsense/Interface/assignment.volt
+613-05 files not shown
+739-011 files

OPNSense/core ee3fe9esrc/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api AssignmentController.php, src/opnsense/mvc/app/models/OPNsense/Interfaces Assignment.php

Interfaces: Assignments - work in progress for https://github.com/opnsense/core/issues/9945

In order to migrate the interface assignments, we need to think of a way to use the differently named xml nodes for interfaces (wan, lan, ..) into something that closely resembles a standard model implementation.
Since we can't match these nodes in our statically defined model xmls, the main idea is to flush all via an in-memory model with a separate load [construct] and save hook [serializeToConfig].

The next challenge is to "stash" updates and wait for "apply" in certain cases, for this we add a temporary database holding the changes  which are synced after the actual system change has happend (pending_action, pending_if). When succesfully applied, the apply function cleans up the final stage of the configuration to make everything consistent again.

This database is a simple single json encoded file named /tmp/.interfaces.todo
DeltaFile
+159-0src/opnsense/mvc/app/models/OPNsense/Interfaces/Assignment.php
+121-0src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/AssignmentController.php
+90-0src/opnsense/scripts/interfaces/list_assign_options.php
+64-0src/opnsense/scripts/interfaces/apply_pending_if_changes.php
+54-0src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/AssignmentInterfaceField.php
+45-0src/opnsense/mvc/app/views/OPNsense/Interface/assignment.volt
+533-05 files not shown
+639-011 files

OPNSense/core e83a209src/opnsense/mvc/app/views/OPNsense/Firewall filter_rule.volt, src/opnsense/www/js opnsense_bootgrid.js

Firewall: Rules: semi-persistence for top-level categories
DeltaFile
+149-99src/opnsense/mvc/app/views/OPNsense/Firewall/filter_rule.volt
+2-1src/opnsense/www/js/opnsense_bootgrid.js
+151-1002 files

OPNSense/core 591830asrc/opnsense/mvc/app/views/OPNsense/Firewall filter_rule.volt, src/opnsense/www/js opnsense_bootgrid.js

Firewall: Rules: improved tree grouping logic
DeltaFile
+54-28src/opnsense/mvc/app/views/OPNsense/Firewall/filter_rule.volt
+4-2src/opnsense/www/js/opnsense_bootgrid.js
+58-302 files

OPNSense/core c5b84a6src/opnsense/mvc/app/views/OPNsense/Firewall filter_rule.volt

Firewall: Rules: clean up
DeltaFile
+17-23src/opnsense/mvc/app/views/OPNsense/Firewall/filter_rule.volt
+17-231 files