mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 15:45:13 +08:00
🐤 Sync 2026-10-03 00:12:36
This commit is contained in:
1 parent
ce3df55b24
commit
cb1d978497
58 files changed
+1627
-1018
No files matched your search
@@ -117,7 +117,8 @@ return view.extend({
|
||||
|
||||
/* Netfilter flow offload support */
|
||||
|
||||
if (L.hasSystemFeature('offloading')) {
|
||||
const hasMediatekHNAT = fw4 && runtimeStatus?.hnat_available === true;
|
||||
if (L.hasSystemFeature('offloading') || hasMediatekHNAT) {
|
||||
s = m.section(form.TypedSection, 'defaults', _('Routing/NAT Offloading'),
|
||||
_('Not fully compatible with QoS/SQM.'));
|
||||
|
||||
@@ -129,17 +130,22 @@ return view.extend({
|
||||
o.value('1', _("Software flow offloading"), _('Software based offloading for routing/NAT.'));
|
||||
if (L.hasSystemFeature('offloading_hw'))
|
||||
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卸载");
|
||||
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 (hasMediatekHNAT && flow_offloading === '3')
|
||||
return '3';
|
||||
return (flow_offloading === '1')
|
||||
? ((flow_offloading_hw === '1' && has_hw_offloading) ? '2' : '1')
|
||||
: '0';
|
||||
};
|
||||
o.write = function(section_id, value) {
|
||||
uci.set('firewall', section_id, 'flow_offloading', value === '0' ? null : '1');
|
||||
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',
|
||||
(value === '2' && L.hasSystemFeature('offloading_hw')) ? '1' : null);
|
||||
};
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
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
|
||||
|
||||
rules="$(iptables-save -t nat 2>/dev/null)"
|
||||
|
||||
@@ -19,4 +21,4 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
printf '{"nat_mode":"%s","tcp_cca":"%s"}\n' "$nat_mode" "$tcp_cca"
|
||||
printf '{"nat_mode":"%s","tcp_cca":"%s","hnat_available":%s}\n' "$nat_mode" "$tcp_cca" "$hnat_available"
|
||||
Reference in new issue
Block a user