Skip to content

frp: add UCI service enable switches - #30489

Open
laipeng668 wants to merge 1 commit into
openwrt:masterfrom
laipeng668:frp
Open

frp: add UCI service enable switches#30489
laipeng668 wants to merge 1 commit into
openwrt:masterfrom
laipeng668:frp

Conversation

@laipeng668

@laipeng668 laipeng668 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

📦 Package Details

Maintainer: N/A

Description:

Add an enabled option to the UCI init sections for frpc and frps,
allowing the two services to be enabled or disabled independently.

New default configurations set enabled to 0, so both services are
disabled by default on new installations. During configuration migration,
if an existing legacy configuration does not contain an enabled option,
initialize it to 1 to preserve the previous startup behavior. Do not
override explicitly configured user values.

When a service is disabled, skip both TOML generation and procd instance
registration.

Also stop configuration generation earlier when include validation
fails, before emitting any remaining TOML sections.

Align whitespace in frps.config with frpc.config by removing
blank separators between options.

Bump PKG_RELEASE to 2.

Depends on: openwrt/luci#9013


🧪 Run Testing Details

  • OpenWrt Version: main/snapshot
  • OpenWrt Target/Subtarget: qualcommax/aarch64
  • OpenWrt Device: ipq6000-360v6

✅ Formalities

  • I have reviewed the CONTRIBUTING.md file for detailed contributing guidelines.

If your PR contains a patch:

  • It can be applied using git am
  • It has been refreshed to avoid offsets, fuzzes, etc., using
    make package/<your-package>/refresh V=s
  • It is structured in a way that it is potentially upstreamable
    (e.g., subject line, commit description, etc.)
    We must try to upstream patches to reduce maintenance burden.

Comment thread net/frp/files/frpc.config Outdated

@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

  • 525eeff "frp: add UCI service enable switches" — "abort startup on include validation errors" reads as new behaviour, but _TOML_ERR raised by _append_conf_file was already caught by the pre-existing [ "$_TOML_ERR" = "0" ] || return 1 after the _emit_conf_section / _emit_http_plugin block, and nothing between the two points has side effects outside $CONF_FILE. The added check only moves the abort a few lines earlier — reword so it does not claim a fix that already existed.

Generated by Claude Code

@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.

Reviewed 1 new commit; no new issues found.


Generated by Claude Code

@kissingers

kissingers commented Sep 9, 2026

Copy link
Copy Markdown

Also I think if can enable and disable anytime, keep defualt no check more good than check, as can turn on anytime, and the defualt setting save resource for these want keep frp feature but not always trun on routers.

This is my first version, default is no check enable, but for the already bulid before version frp router, if change default to uncheck, how keep the before status(before same as now check)? because want keep same default result as before version so I have to change default enable now, but I dont think this is a good way.

If can set defualt disable, but if it is a upgrade router then auto check enable, the new router keep default disable will more good.
immortalwrt/packages@d0d829c

@laipeng668

Copy link
Copy Markdown
Contributor Author

Okay, based on everyone’s suggestions, I’ve changed it so that the feature is disabled by default. This change will not affect the enabled status in existing users’ configuration profiles.

Comment thread net/frp/files/frpc.uci-defaults Outdated
@kissingers

Copy link
Copy Markdown

When I use immortalwrt luci https://github.com/immortalwrt/luci , which pull from here, if reset router seting to default, and first time to frpc or frps set pages, if do nothing else but save config, find have 3 default seting deleted, that meanse the defaut reset para not same as first save para, can fix this problem?

@laipeng668

Copy link
Copy Markdown
Contributor Author

@kissingers

This is perfectly normal—LuCI and the Packages need to match. Once all the code here has been merged, ImmortalWrt will work properly after syncing with these sources.

Until then, you can only handle it manually yourself, or install the files I compiled.

@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.

Reviewed 1 new commit.


Generated by Claude Code

Comment thread net/frp/files/frpc.uci-defaults
@laipeng668
laipeng668 force-pushed the frp branch 4 times, most recently from e1b84b3 to 6dac037 Compare September 10, 2026 11:58

@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.

Reviewed 1 new commit.


Generated by Claude Code

Comment thread net/frp/files/frps.config
@kissingers

kissingers commented Sep 11, 2026

Copy link
Copy Markdown

I tested it, there are 2 problem:
1:
default setting problem, but this is a before problem not this PR problem, first time or reset the router and reboot, just at frpc and frps page save config, will 6 different for frpc and 4 different for frps. also this might luci problem but not packages problem.
frpc
uci del frpc.common.authentication_method
uci del frpc.common.protocol
uci del frpc.common.wire_protocol
uci del frpc.common.log_level
uci set frpc.cfg018539.user='root'
uci set frpc.cfg018539.group='root'

frps
uci del frps.common.authentication_method
uci del frps.common.log_level
uci set frps.cfg018539.user='root'
uci set frps.cfg018539.group='root'

2:
if use defualt windows format CR/LF for frpc.init and frps.init, server can not satart up, and logs:
daemon.notice: procd: /etc/rc.d/S99
frpc: /bin/sh: line 0: can't open /etc/rc.common
: no such file
aemon.notice: procd: /etc/rc.d/S99
frps: /bin/sh: line 0: can't open /etc/rc.common
: no such file

but if do nothing but only change to linux format LF. it work ok. only the frpc.ini and frps.ini need change, others need not change
image

debug:
root@myroute:~# /bin/sh /etc/rc.common
/etc/init.d/frpc status : not foundmon: /etc/init.d/frpc: line 2: : not foundmon: /etc/init.d/frpc: line 5: : not foundmon: /etc/init.d/frpc: line 9: : not foundmon: /etc/init.d/frpc: line 13: } : not foundmon: /etc/init.d/frpc: line 14: : not foundmon: /etc/init.d/frpc: line 17: } : not foundmon: /etc/init.d/frpc: line 18: : not foundmon: /etc/init.d/frpc: line 21: } : not foundmon: /etc/init.d/frpc: line 22: : not foundmon: /etc/init.d/frpc: line 19: { : not foundmmon: /etc/init.d/frpc: line 25: } : not foundmon: /etc/init.d/frpc: line 26: : not foundmon: /etc/init.d/frpc: line 23: { : not foundmon: /etc/init.d/frpc: line 29: } : not foundmon: /etc/init.d/frpc: line 30: /etc/rc.common: local: line 32: not in a function

@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.

Reviewed 1 new commit; no new issues found.


Generated by Claude Code

@kissingers

Copy link
Copy Markdown

After change frpc.init and frps.init to linux format LF, no other problem to switch enable and disable the 2 servers, but if keep default, can chanage the checkbox and can keep the checkbox after reboot, but never can startup

Add an `enabled` option to the UCI init sections for `frpc` and `frps`,
allowing the two services to be enabled or disabled independently.

New default configurations set `enabled` to `0`, so both services are
disabled by default on new installations. During configuration migration,
if an existing legacy configuration does not contain an `enabled` option,
initialize it to `1` to preserve the previous startup behavior. Do not
override explicitly configured user values.

When a service is disabled, skip both TOML generation and procd instance
registration.

Also stop configuration generation earlier when include validation
fails, before emitting any remaining TOML sections.

Align whitespace in frps.config with frpc.config by removing
blank separators between options.

Bump `PKG_RELEASE` to 2.

Co-Authored-by: Kissinger Zhou <kissinger@foxmail.com>
Signed-off-by: Roc Lai <laipeng668@qq.com>
@laipeng668

laipeng668 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

The second issue has been addressed, and the file format has been corrected to use LF line endings.

The first issue may be a fallback behavior intended for migrating configuration files. Since the input value is the same as the default value, it triggers a UCI warning. We can fix this later when there is time; I’m concerned that fixing it now might introduce other issues.
D3BB759F1FE17EBBE4528601745F9995
02822DA9C476B8938F4E8108F69DCBBD

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.

4 participants