mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-04 23:33:56 +08:00
🦄 Sync 2026-10-29 02:34:23
This commit is contained in:
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'),
|
m = new form.Map('firewall', _('Firewall - Zone Settings'),
|
||||||
_('The firewall creates zones over your network interfaces to control network traffic flow.'));
|
_('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 = m.section(form.TypedSection, 'defaults', _('General Settings'));
|
||||||
s.anonymous = true;
|
s.anonymous = true;
|
||||||
@@ -118,7 +121,7 @@ return view.extend({
|
|||||||
/* Netfilter flow offload support */
|
/* Netfilter flow offload support */
|
||||||
|
|
||||||
const hasMediatekHNAT = fw4 && runtimeStatus?.hnat_available === true;
|
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'),
|
s = m.section(form.TypedSection, 'defaults', _('Routing/NAT Offloading'),
|
||||||
_('Not fully compatible with QoS/SQM.'));
|
_('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.'));
|
o.value('2', _("Hardware flow offloading"), _('Hardware based offloading for routing with/without NAT.') + ' ' + _(' Requires hardware NAT support.'));
|
||||||
if (hasMediatekHNAT)
|
if (hasMediatekHNAT)
|
||||||
o.value('3', "Mediatek HNAT", "基于Mediatek原厂闭源驱动的HNAT卸载");
|
o.value('3', "Mediatek HNAT", "基于Mediatek原厂闭源驱动的HNAT卸载");
|
||||||
|
if (hasQualcommECM)
|
||||||
|
o.value('4', 'Qualcomm NSS ECM 加速', 'ECM Auto 模式,自动选择加速引擎。');
|
||||||
o.optional = false;
|
o.optional = false;
|
||||||
o.load = function (section_id) {
|
o.load = function (section_id) {
|
||||||
const flow_offloading = uci.get('firewall', section_id, 'flow_offloading');
|
const flow_offloading = uci.get('firewall', section_id, 'flow_offloading');
|
||||||
const flow_offloading_hw = uci.get('firewall', section_id, 'flow_offloading_hw');
|
const flow_offloading_hw = uci.get('firewall', section_id, 'flow_offloading_hw');
|
||||||
const has_hw_offloading = L.hasSystemFeature('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')
|
if (hasMediatekHNAT && flow_offloading === '3')
|
||||||
return '3';
|
return '3';
|
||||||
return (flow_offloading === '1')
|
return (flow_offloading === '1')
|
||||||
@@ -144,6 +151,11 @@ return view.extend({
|
|||||||
: '0';
|
: '0';
|
||||||
};
|
};
|
||||||
o.write = function(section_id, value) {
|
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.set('firewall', section_id, 'flow_offloading', value === '3' ? '3' : ((value === '1' || value === '2') ? '1' : '0'));
|
||||||
uci.unset('firewall', section_id, 'mediatek_hnat');
|
uci.unset('firewall', section_id, 'mediatek_hnat');
|
||||||
uci.set('firewall', section_id, 'flow_offloading_hw',
|
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"
|
nat_mode="disabled"
|
||||||
hnat_available=false
|
hnat_available=false
|
||||||
[ -e /sys/kernel/debug/hnat/hook_toggle ] && hnat_available=true
|
[ -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)"
|
rules="$(iptables-save -t nat 2>/dev/null)"
|
||||||
|
|
||||||
@@ -21,4 +24,4 @@ else
|
|||||||
fi
|
fi
|
||||||
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" ],
|
"file": [ "read" ],
|
||||||
"luci": [ "getConntrackHelpers" ]
|
"luci": [ "getConntrackHelpers" ]
|
||||||
},
|
},
|
||||||
"uci": [ "firewall" ]
|
"uci": [ "firewall", "ecm" ]
|
||||||
},
|
},
|
||||||
"write": {
|
"write": {
|
||||||
"file": {
|
"file": {
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
"file": [ "write", "exec" ],
|
"file": [ "write", "exec" ],
|
||||||
"uci": [ "commit" ]
|
"uci": [ "commit" ]
|
||||||
},
|
},
|
||||||
"uci": [ "firewall" ]
|
"uci": [ "firewall", "ecm" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user