🦄 Sync 2026-10-29 02:34:23

This commit is contained in:
github-actions[bot] committed 2026-10-29 02:34:23 +08:00
1 parent bfd56813e0
commit e3f5e4d6cc
3 files changed
+19 -4

No files matched your search

@@ -69,6 +69,9 @@ return view.extend({
m = new form.Map('firewall', _('Firewall - Zone Settings'),
_('The firewall creates zones over your network interfaces to control network traffic flow.'));
const hasQualcommECM = runtimeStatus?.ecm_available === true;
if (hasQualcommECM)
m.chain('ecm');
s = m.section(form.TypedSection, 'defaults', _('General Settings'));
s.anonymous = true;
@@ -118,7 +121,7 @@ return view.extend({
/* Netfilter flow offload support */
const hasMediatekHNAT = fw4 && runtimeStatus?.hnat_available === true;
if (L.hasSystemFeature('offloading') || hasMediatekHNAT) {
if (L.hasSystemFeature('offloading') || hasMediatekHNAT || hasQualcommECM) {
s = m.section(form.TypedSection, 'defaults', _('Routing/NAT Offloading'),
_('Not fully compatible with QoS/SQM.'));
@@ -132,11 +135,15 @@ return view.extend({
o.value('2', _("Hardware flow offloading"), _('Hardware based offloading for routing with/without NAT.') + ' ' + _(' Requires hardware NAT support.'));
if (hasMediatekHNAT)
o.value('3', "Mediatek HNAT", "基于Mediatek原厂闭源驱动的HNAT卸载");
if (hasQualcommECM)
o.value('4', 'Qualcomm NSS ECM 加速', 'ECM Auto 模式,自动选择加速引擎。');
o.optional = false;
o.load = function (section_id) {
const flow_offloading = uci.get('firewall', section_id, 'flow_offloading');
const flow_offloading_hw = uci.get('firewall', section_id, 'flow_offloading_hw');
const has_hw_offloading = L.hasSystemFeature('offloading_hw');
if (hasQualcommECM && uci.get('ecm', 'global', 'acceleration_engine') !== 'disabled')
return '4';
if (hasMediatekHNAT && flow_offloading === '3')
return '3';
return (flow_offloading === '1')
@@ -144,6 +151,11 @@ return view.extend({
: '0';
};
o.write = function(section_id, value) {
if (hasQualcommECM) {
if (!uci.get('ecm', 'global'))
uci.add('ecm', 'ecm', 'global');
uci.set('ecm', 'global', 'acceleration_engine', value === '4' ? 'auto' : 'disabled');
}
uci.set('firewall', section_id, 'flow_offloading', value === '3' ? '3' : ((value === '1' || value === '2') ? '1' : '0'));
uci.unset('firewall', section_id, 'mediatek_hnat');
uci.set('firewall', section_id, 'flow_offloading_hw',
@@ -4,6 +4,9 @@ tcp_cca="$(cat /proc/sys/net/ipv4/tcp_congestion_control 2>/dev/null)"
nat_mode="disabled"
hnat_available=false
[ -e /sys/kernel/debug/hnat/hook_toggle ] && hnat_available=true
ecm_available=false
[ -x /etc/init.d/qca-nss-ecm ] && [ -f /etc/config/ecm ] &&
[ -f /usr/share/ucitrack/qca-nss-ecm.json ] && ecm_available=true
rules="$(iptables-save -t nat 2>/dev/null)"
@@ -21,4 +24,4 @@ else
fi
fi
printf '{"nat_mode":"%s","tcp_cca":"%s","hnat_available":%s}\n' "$nat_mode" "$tcp_cca" "$hnat_available"
printf '{"nat_mode":"%s","tcp_cca":"%s","hnat_available":%s,"ecm_available":%s}\n' "$nat_mode" "$tcp_cca" "$hnat_available" "$ecm_available"
@@ -11,7 +11,7 @@
"file": [ "read" ],
"luci": [ "getConntrackHelpers" ]
},
"uci": [ "firewall" ]
"uci": [ "firewall", "ecm" ]
},
"write": {
"file": {
@@ -23,7 +23,7 @@
"file": [ "write", "exec" ],
"uci": [ "commit" ]
},
"uci": [ "firewall" ]
"uci": [ "firewall", "ecm" ]
}
}
}