Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luci-app-firewall: fix zone log option #7648

Merged
merged 1 commit into from
Feb 25, 2025

Conversation

JFroch
Copy link
Contributor

@JFroch JFroch commented Feb 23, 2025

  • This PR is not from my main or master branch 💩, but a separate branch ✅
  • Each commit has a valid ✒️ Signed-off-by: <[email protected]> row (via git commit --signoff)
  • Each commit and PR title has a valid 📝 <package name>: title first line subject for packages
  • Incremented 🆙 any PKG_VERSION in the Makefile
  • Tested on: BPI R4 running 24.10.0 ✅
  • ( Preferred ) Mention: @ the original code author for feedback
  • ( Preferred ) Screenshot or mp4 of changes:

image

image

  • Description: The luci option to enable zone logging was a simple checkbox while the uci option is a bitfield which led to enabling logging just on the "filter" table when toggled, with no option to enable it for the "mangle" table.
    This PR changes the zone log checkbox to a multivalue selection.
    From the documentation:

image

@stokito
Copy link
Contributor

stokito commented Feb 23, 2025

but how then to disable logging?

@@ -293,11 +293,40 @@ return view.extend({
for (var i = 0; i < ctHelpers.length; i++)
o.value(ctHelpers[i].name, E('<span><span class="hide-close">%s (%s)</span><span class="hide-open">%s</span></span>'.format(ctHelpers[i].description, ctHelpers[i].name.toUpperCase(), ctHelpers[i].name.toUpperCase())));

o = s.taboption('advanced', form.Flag, 'log', _('Enable logging on this zone'));
o = s.taboption('advanced', form.MultiValue, 'log', _('Enable logging for selected tables in this zone:'), _('Log matched packets on the selected tables to syslog.'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just a dropdown? Looks over complicated and difficult to maintain

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean LuCI.ui.Dropdown?
I´d have to take a look at how to implement that, seems that needs something like form.MultiValue.extend right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MultiValue is a Dropdown, I think. (inherit)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe shorten the UI heading to Enable logging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the heading.

@JFroch
Copy link
Contributor Author

JFroch commented Feb 23, 2025

but how then to disable logging?

If you deselect all options the resulting value is 0 and the option is deleted from the config.

image

This is the result of:
Selecting "filter" and "mangle"
Selecting just "filter"
Selecting nothing

Changes the zone log checkbox to a multivalue selection as the underlying uci option is a bitfield.

Signed-off-by: Jan Froch <[email protected]>
@systemcrash systemcrash merged commit e8a2e45 into openwrt:master Feb 25, 2025
4 of 5 checks passed
@systemcrash
Copy link
Contributor

Merged. Thanks @JFroch

@JFroch JFroch deleted the fw_fix_zone_log branch February 25, 2025 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants