Skip to content

luci-app-pbr-1.2.2: preserve resolver_set selection on save - #38

Merged
egc112 merged 1 commit into
mossdef-org:1.2.2from
egc112:egc-luci-rmempty-1.2.2
Aug 12, 2026
Merged

luci-app-pbr-1.2.2: preserve resolver_set selection on save#38
egc112 merged 1 commit into
mossdef-org:1.2.2from
egc112:egc-luci-rmempty-1.2.2

Conversation

@egc112

@egc112 egc112 commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Backport of the resolver_set part of the 1.2.3 fix (#35) to the 1.2.2 branch.

REQUIRES luci-base commit 974b5864e05ef30f38149389f15583c08bdd4eda ("luci-base: form: do not write values equal to the default"), which changed CBIAbstractValue.parse() in
modules/luci-base/htdocs/luci-static/resources/form.js to:

if (fval == null || fval == '' ||
    (fval == this.default && (this.optional || this.rmempty))) {
    ... remove() ...
}
else if (this.forcewrite || !isEqual(cval, fval)) {
    ... write() ...
}

An option whose form value equals its declared o.default is now REMOVED from UCI rather than written, whenever optional or rmempty is true. rmempty defaults to true, so this silently applies to nearly every option that does not explicitly opt out.

resolver_set is affected: pbr's backend treats an absent resolver_set as disabled (files/etc/init.d/pbr unsets it when empty or 'none'), while LuCI declares a default of adguardhome.ipset / dnsmasq.ipset / dnsmasq.nftset depending on detected support. pbr ships resolver_set 'dnsmasq.nftset' in files/etc/config/pbr, so after 974b5864 the first Save of the overview page DELETES that provisioned value and resolver set handling is silently disabled: the UI keeps showing resolver set support enabled while pbr runs with it off and domain policies fall back to one-time resolveip lookups.

Unlike 1.2.3, the 1.2.2 files/etc/uci-defaults/90-pbr does not re-set resolver_set (it only renames the old resolver_ipset option), so nothing restores the value on a later package upgrade -- once deleted it stays deleted.

o.rmempty = false is the fix; cfgvalue() returns null for an absent option, so it forces the write. An explicit o.default = 'none' base is set as well: it is inert while rmempty and optional are both false, but it documents the fallback on devices without any resolver set support.

Not backported from the 1.2.3 change: the uplink_interface and uplink_interface6 adjustments, because those options do not exist in the 1.2.2 overview, and the forcewrite removal, because 1.2.2 does not use forcewrite anywhere.

Safe on older luci-base without 974b5864: resolver_set is a ListValue with no blank choice, so rmempty = false is never reached. No config churn on up- or downgrade.

Thanks to @pesa1234 for spotting this and for the equivalent fix in the openwrt/luci tree, PR #8927 ("luci-app-pbr: preserve resolver_set selection"):
openwrt/luci#8927 (comment)

@egc112
egc112 force-pushed the egc-luci-rmempty-1.2.2 branch from 73e915e to 0822762 Compare August 12, 2026 08:49
Backport of the resolver_set part of the 1.2.3 fix (mossdef-org#35) to the 1.2.2
branch.

REQUIRES luci-base commit 974b5864e05ef30f38149389f15583c08bdd4eda
("luci-base: form: do not write values equal to the default"), which
changed CBIAbstractValue.parse() in
modules/luci-base/htdocs/luci-static/resources/form.js to:

    if (fval == null || fval == '' ||
        (fval == this.default && (this.optional || this.rmempty))) {
        ... remove() ...
    }
    else if (this.forcewrite || !isEqual(cval, fval)) {
        ... write() ...
    }

An option whose form value equals its declared o.default is now REMOVED
from UCI rather than written, whenever optional or rmempty is true.
rmempty defaults to true, so this silently applies to nearly every
option that does not explicitly opt out.

resolver_set is affected: pbr's backend treats an absent resolver_set as
disabled (files/etc/init.d/pbr unsets it when empty or 'none'), while
LuCI declares a default of adguardhome.ipset / dnsmasq.ipset /
dnsmasq.nftset depending on detected support. pbr ships
resolver_set 'dnsmasq.nftset' in files/etc/config/pbr, so after 974b5864
the first Save of the overview page DELETES that provisioned value and
resolver set handling is silently disabled: the UI keeps showing resolver
set support enabled while pbr runs with it off and domain policies fall
back to one-time resolveip lookups.

Unlike 1.2.3, the 1.2.2 files/etc/uci-defaults/90-pbr does not re-set
resolver_set (it only renames the old resolver_ipset option), so nothing
restores the value on a later package upgrade -- once deleted it stays
deleted.

o.rmempty = false is the fix; cfgvalue() returns null for an absent
option, so it forces the write. An explicit o.default = 'none' base is
set as well: it is inert while rmempty and optional are both false, but
it documents the fallback on devices without any resolver set support.

Not backported from the 1.2.3 change: the uplink_interface and
uplink_interface6 adjustments, because those options do not exist in the
1.2.2 overview, and the forcewrite removal, because 1.2.2 does not use
forcewrite anywhere.

Safe on older luci-base without 974b5864: resolver_set is a ListValue
with no blank choice, so rmempty = false is never reached. No config
churn on up- or downgrade.

Thanks to @pesa1234 for spotting this and for the equivalent fix in the
openwrt/luci tree, PR #8927 ("luci-app-pbr: preserve resolver_set
selection"):
openwrt/luci#8927 (comment)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@egc112
egc112 merged commit c66b3a7 into mossdef-org:1.2.2 Aug 12, 2026
@egc112
egc112 deleted the egc-luci-rmempty-1.2.2 branch August 12, 2026 09:02
egc112 added a commit that referenced this pull request Aug 14, 2026
Lockstep release bump with pbr. Covers the resolver_set preservation fix
(#38) plus the release workflow and packaging fixes. Compat is unchanged
at 27 — nothing since release 20 touched the message catalog.

Signed-off-by: Erik Conijn <egc112@msn.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant