Skip to content

luci-app-xfrpc: add comment explaining GridSection type behavior#8704

Open
ximalu wants to merge 2 commits into
openwrt:masterfrom
ximalu:master
Open

luci-app-xfrpc: add comment explaining GridSection type behavior#8704
ximalu wants to merge 2 commits into
openwrt:masterfrom
ximalu:master

Conversation

@ximalu

@ximalu ximalu commented Jun 14, 2026

Copy link
Copy Markdown

Description

This is a documentation-only change to clarify that the GridSection type 'xfrpc' is intentional.

Background

Issue #7972 reported that luci-app-xfrpc generates configs that prevent xfrpc from starting.
Investigation showed the root cause is a section type mismatch:

  • LuCI creates proxy sections with type xfrpc (via GridSection)
  • The init script (xfrpc.init) iterates sections by type (tcp, http, https, socks5)
  • Since no handler iterates type xfrpc, proxy configs were lost in the generated xfrpc.ini

Fix Approach

The functional fix is in openwrt/packages (net/xfrpc/files/xfrpc.init), which now has a fallback handler that reads the type option from xfrpc-typed sections and dispatches correctly. This LuCI-side change adds a comment documenting the contract between LuCI and the init script.

Testing

Verified on ImmortalWrt 24.10.4 (Xiaomi WR30U). TCP proxy sections created via LuCI now generate correct xfrpc.ini files and the xfrpc service starts successfully.

This is a documentation-only change. The GridSection type 'xfrpc' is
intentional — the init script (xfrpc.init) is now fixed to handle
xfrpc-typed proxy sections via a dedicated fallback handler.

The actual functional fix is in openwrt/packages (xfrpc.init update).
See issue openwrt#7972 for details.
ximalu added a commit to ximalu/packages that referenced this pull request Jun 14, 2026
LuCI creates proxy sections with UCI type "xfrpc" (the GridSection type),

but the init script only iterated type-specific sections (tcp, http, https,

socks5). This caused proxy configurations added via the LuCI web interface

to be silently dropped during config generation, producing a broken xfrpc.ini.

Two fixes:

1. handle_xfrpc(): guard with [ "$section" = "common" ] || return

   to prevent leaking server_addr/token into non-common sections.

2. Added handle_xfrpc_proxy(): a fallback for xfrpc-typed sections

   that reads the "type" option and writes the correct proxy config.

Fixes openwrt/luci#7972

Companion PR: openwrt/luci#8704
Fix 1: Remove unnecessary SectionValue+TypedSection wrapper that caused

empty display (with "xfrp") or duplicate display (with "xfrpc").

Bind disabled and loglevel options directly to the common section.

Fix 2: Rename field from "disabled" to "enabled" with label "Enable xfrpc service".

The init script reads "enabled" (default 1), not "disabled", so the checkbox

previously had no effect on service startup.

Fixes openwrt#7972

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Commit checks

  • 3816f22 "luci-app-xfrpc: fix startup settings section and field naming" — The body states "The init script reads 'enabled' (default 1)", but the backend default is 0, not 1: start_service() validates 'enabled:bool:0' and the shipped xfrpc.conf ships option enabled 0. The rename disabledenabled is correct (the daemon does read enabled), but the stated default is wrong and the LuCI o.default = '1' consequently diverges from the daemon default. See the inline note.

Generated by Claude Code

o = s.taboption('init', form.Flag, 'enabled', _('Enable xfrpc service'));
o.datatype = 'bool';
o.optional = true;
o.default = '1';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The frontend defaults enabled to 1, but the backend defaults it to 0. start_service() validates 'enabled:bool:0' and the shipped xfrpc.conf sets option enabled 0. With rmempty = false the value is always written on save, so post-save behavior is fine, but the pre-save UI default disagrees with the daemon default (service off). Note the commit message claims "the init script reads 'enabled' (default 1)" — the init script default is actually 0. Is defaulting the LuCI checkbox to on intended?


Generated by Claude Code

s.dynamic = true;

o = s.option(form.Flag, 'disabled', _('Disabled xfrpc service'));
o = s.taboption('init', form.Flag, 'enabled', _('Enable xfrpc service'));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: The PR title ("add comment explaining GridSection type behavior") and body ("This is a documentation-only change") describe only the first commit (efd9ee5). This commit (3816f22) is a functional change: it removes the SectionValue+TypedSection wrapper, rebinds loglevel onto the common section, and renames the disabled flag to enabled. Please update the PR description so it reflects the section restructuring and the option rename, not just the documentation comment.


Generated by Claude Code

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown

Warning

Some formality checks failed.

Consider (re)reading submissions guidelines.

Failed checks

Issues marked with an ❌ are failing checks.

Commit 3816f22

  • 🔶 Author name must be either a real name 'firstname lastname' or a nickname/alias/handle
    Actual: Ubuntu seems to be a nickname or an alias
    Expected: a real name 'firstname lastname'
  • 🔶 Commit(ter) name must be either a real name 'firstname lastname' or a nickname/alias/handle
    Actual: Ubuntu seems to be a nickname or an alias
    Expected: a real name 'firstname lastname'
  • Signed-off-by must match author
    Actual: missing or doesn't match author
    Expected: Signed-off-by: Ubuntu <ubuntu@localhost.localdomain>
  • 🔶 Commit message lines should be <= 80 characters long
    Actual: line 8 is 83 characters long
    $\textsf{Fix 2: Rename field from "disabled" to "enabled" with label "Enable xfrpc servic\color{red}{e".}}$

Commit efd9ee5

  • 🔶 Author name must be either a real name 'firstname lastname' or a nickname/alias/handle
    Actual: ximalu seems to be a nickname or an alias
    Expected: a real name 'firstname lastname'
  • ❌ Author email must not be a GitHub noreply email
    Expected: a real email address
  • 🔶 Commit(ter) name must be either a real name 'firstname lastname' or a nickname/alias/handle
    Actual: ximalu seems to be a nickname or an alias
    Expected: a real name 'firstname lastname'
  • ❌ Commit(ter) email must not be a GitHub noreply email
    Expected: a real email address
  • Signed-off-by must match author
    Actual: missing or doesn't match author
    Expected: Signed-off-by: ximalu <ximalu@users.noreply.github.com>

For more details, see the full job log.

Something broken? Consider providing feedback.

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.

2 participants