🔥 Sync 2026-09-20 08:04:58

This commit is contained in:
github-actions[bot] committed 2026-09-20 08:04:58 +08:00
1 parent e4a2d7800e
commit 4b4d482791
39 files changed
+755 -216

No files matched your search

@@ -45,6 +45,7 @@ return view.extend({
o.rmempty = false;
o.value('dhcp', _('DHCP client'));
o.value('pppoe', _('PPPoE'));
o.value('siderouter', _('Siderouter'));
o = s.taboption('netsetup', form.Value, 'wan_pppoe_user', _('PAP/CHAP username'));
o.depends('wan_proto', 'pppoe');
@@ -60,19 +61,15 @@ return view.extend({
o.datatype = 'ip4addr';
o.cast = 'string';
o = s.taboption('netsetup', form.Flag, 'siderouter', _('Siderouter'),
_('Use as downstream router i.e. it will work like a switch'));
o.rmempty = false;
o = s.taboption('netsetup', form.Value, 'lan_gateway', _('IPv4 gateway'));
o.depends('siderouter', '1');
o.depends('wan_proto', 'siderouter');
o.datatype = 'ip4addr';
o.placeholder = _('Enter the main router IP');
o.rmempty = false;
o = s.taboption('netsetup', form.Flag, 'dhcp', _('DHCP Server'),
_('To turn on this DHCP, you need to turn off the DHCP of the main router, and to turn off this DHCP, you need to manually change the gateway and DNS of all Internet devices to the IP of this bypass router'));
o.depends('siderouter', '1');
o.depends('wan_proto', 'siderouter');
o.default = o.enabled;
o = s.taboption('netsetup', form.Flag, 'ipv6', _('Enable IPv6'), _('Enable/Disable IPv6'));
+35 -34
View File
@@ -15,10 +15,26 @@ add_wizard() {
local device ipv6 old_ipv6 wifi_ssid wifi_key old_wifi_ssid old_wifi_key
config_get wan_proto "$cfg" wan_proto
config_get lan_gateway "$cfg" lan_gateway
config_get dhcp "$cfg" dhcp
config_get lan_dns "$cfg" lan_dns
config_get ipv6 "$cfg" ipv6
config_get old_ipv6 "$cfg" old_ipv6
config_get lan_ipaddr "$cfg" lan_ipaddr
config_get autoupgrade_pkg "$cfg" autoupgrade_pkg
device=$(uci get network.wan.device 2>/dev/null)
test -n "${lan_ipaddr}" && {
uci set network.lan.ipaddr="${lan_ipaddr}"
}
device=$(uci -q get network.wan.device || uci -q get wizard.default.old_network_device)
case "${wan_proto}" in
dhcp)
uci -q del_list network.@device[0].ports="$device"
uci -q del network.lan.gateway
uci -q del dhcp.lan.ignore
uci -q del network.lan.dns
uci -q del firewall.@zone[0].masq
uci delete network.wan
uci set network.wan=interface
uci set network.wan.device="$device"
@@ -28,6 +44,11 @@ add_wizard() {
config_get wan_pppoe_user "$cfg" wan_pppoe_user
config_get wan_pppoe_pass "$cfg" wan_pppoe_pass
[[ "${wan_pppoe_user} != $(uci -q get network.wan.username)" || "${wan_pppoe_pass} != $(uci -q get network.wan.password)" ]] && {
uci -q del_list network.@device[0].ports="$device"
uci -q del network.lan.gateway
uci -q del dhcp.lan.ignore
uci -q del network.lan.dns
uci -q del firewall.@zone[0].masq
uci delete network.wan
uci set network.wan=interface
uci set network.wan.proto='pppoe'
@@ -40,39 +61,19 @@ add_wizard() {
}
}
;;
siderouter)
[ "$dhcp" == "0" ] && dhcp="1"
if [[ "${lan_gateway}" != "$(uci -q get network.lan.gateway)" || "${dhcp}" != "$(uci -q get dhcp.lan.ignore)" ]]; then
uci -q set network.lan.gateway="${lan_gateway}"
[ -n "$lan_dns" ] || lan_dns='223.5.5.5'
[ -n "$dhcp" ] && uci -q set dhcp.lan.ignore="1" || uci -q del dhcp.lan.ignore
uci -q set firewall.@zone[0].masq='1'
WAN=$(uci -q get network.wan.device)
uci -q add_list network.@device[0].ports="$WAN"
uci -q add_list network.@device[0].ports="$WAN"
uci -q set wizard.default.old_network_device="$WAN"
;;
esac
config_get lan_ipaddr "$cfg" lan_ipaddr
test -n "${lan_ipaddr}" && {
uci set network.lan.ipaddr="${lan_ipaddr}"
}
config_get siderouter "$cfg" siderouter
config_get old_siderouter "$cfg" old_siderouter
config_get lan_gateway "$cfg" lan_gateway
config_get dhcp "$cfg" dhcp
config_get lan_dns "$cfg" lan_dns
config_get ipv6 "$cfg" ipv6
config_get old_ipv6 "$cfg" old_ipv6
config_get autoupgrade_pkg "$cfg" autoupgrade_pkg
[ "$dhcp" == "0" ] && dhcp="1"
if [[ "${lan_gateway}" != "$(uci -q get network.lan.gateway)" || "${dhcp}" != "$(uci -q get dhcp.lan.ignore)" ]]; then
if [ "${siderouter}" == "1" ]; then
uci -q set network.lan.gateway="${lan_gateway}"
[ -n "$lan_dns" ] || lan_dns='223.5.5.5'
[ -n "$dhcp" ] && uci -q set dhcp.lan.ignore="1" || uci -q del dhcp.lan.ignore
uci -q set firewall.@zone[0].masq='1'
uci -q set network.wan.proto='none'
elif [ "${siderouter}" == "0" ]; then
uci -q del network.lan.gateway
uci -q del dhcp.lan.ignore
uci -q del network.lan.dns
uci -q del firewall.@zone[0].masq
uci -q set network.wan.proto='dhcp'
fi
fi
[ -n "$lan_dns" ] && {
[ "$(uci -q get dhcp.@dnsmasq[0].noresolv)" == 1 ] && {
@@ -214,7 +215,7 @@ process_shortcut() {
local shortcut to_url comments lanaddr
local cfg="$1"
lanaddr="$(uci get network.lan.ipaddr)"
[ -n $lanaddr ] && lanaddr="$(echo "$lanaddr" | sed -e "s/\/2\+//")"
[ -n $lanaddr ] && lanaddr="$(echo "$lanaddr"| cut -d/ -f1)"
config_get shortcut "$cfg" shortcut
config_get to_url "$cfg" to_url