[SOLVED]Can't Move Multiple Selected Rules at Once

Started by (MARLOO), Today at 12:30:29 AM

Previous topic - Next topic
Today at 12:30:29 AM Last Edit: Today at 10:16:38 AM by (MARLOO)
Hey everyone,

I've spotted a limitation in OPNsense's "New Rules" feature (latest stable version): when creating multiple firewall rules in batch from the new Rules section, you can't select them all and use the rule's buttons (Move Up/Down) to reposition them together. It only works one at a time, which gets annoying with a bunch of rules.

Is this a bug ? Anyone found a workaround?

Thanks for the feedback!
Hardware: N5105 Intel Celeron  "N100"
                       OPNsense | Home Lab | Linux & Home Automation
                               "Secure the network, automate the rest."

Today at 07:41:00 AM #1 Last Edit: Today at 07:42:33 AM by Monviech (Cedrik)
It's not a bug, right now its intentional. The function that decides this can only process a single source and target rule.

https://github.com/opnsense/core/blob/b60581625e7bcf5692a3851478a5691bb53f7edb/src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterBaseController.php#L366

The logic there is rather complex since sequence is recalculated.

In the old rules the rules just moved inside the config.xml and did not have a real sequence number.

In the new rules everything is decided by the sequence. You could also manually set it when creating a rule to add it to the correct spot right away.

Just saying if you want to frame this as feature request, its going to be complicated.

Hardware:
DEC740

Thanks for the detailed explanation, Cedrik! That GitHub link clears it up perfectly—makes sense why multi-select move isn't there yet with the sequence recalc logic.

A quick workaround I've used: when batch-creating rules in the new interface, set the Sequence field manually on each one right away (e.g., 100, 101, 102) to drop them in the exact order/position you want. No repositioning needed afterward.

Feature request for multi-move would still be nice, though—maybe with a "Move selected block" option that shifts the whole range?
Hardware: N5105 Intel Celeron  "N100"
                       OPNsense | Home Lab | Linux & Home Automation
                               "Secure the network, automate the rest."

You can always open a feature request on github and see how it turns out over time.

Right now it will probably not be a priority right away though, but having it on github gives other users the opportunity to +1 the request to see how widespread this demand is.
Hardware:
DEC740