Mediatek:add ipv6 speed limit support for eqos-mtk

This commit is contained in:
padavanonly 2023-12-14 12:59:12 +08:00 committed by hanwckf
parent 79ae6c2516
commit d310f779b3
16 changed files with 149 additions and 44 deletions

View File

@ -155,6 +155,7 @@ CONFIG_PACKAGE_ca-certificates=y
CONFIG_PACKAGE_datconf=y CONFIG_PACKAGE_datconf=y
CONFIG_PACKAGE_datconf-lua=y CONFIG_PACKAGE_datconf-lua=y
CONFIG_PACKAGE_ethtool=y CONFIG_PACKAGE_ethtool=y
CONFIG_PACKAGE_ebtables=y
CONFIG_PACKAGE_htop=y CONFIG_PACKAGE_htop=y
CONFIG_PACKAGE_ip-bridge=y CONFIG_PACKAGE_ip-bridge=y
CONFIG_PACKAGE_ip6tables-extra=y CONFIG_PACKAGE_ip6tables-extra=y
@ -193,6 +194,9 @@ CONFIG_PACKAGE_kmod-crypto-rng=y
CONFIG_PACKAGE_kmod-crypto-seqiv=y CONFIG_PACKAGE_kmod-crypto-seqiv=y
CONFIG_PACKAGE_kmod-crypto-sha256=y CONFIG_PACKAGE_kmod-crypto-sha256=y
CONFIG_PACKAGE_kmod-crypto-sha512=y CONFIG_PACKAGE_kmod-crypto-sha512=y
CONFIG_PACKAGE_kmod-ebtables=y
CONFIG_PACKAGE_kmod-ebtables-ipv4=y
CONFIG_PACKAGE_kmod-ebtables-ipv6=y
CONFIG_PACKAGE_kmod-fs-autofs4=y CONFIG_PACKAGE_kmod-fs-autofs4=y
CONFIG_PACKAGE_kmod-fs-vfat=y CONFIG_PACKAGE_kmod-fs-vfat=y
CONFIG_PACKAGE_kmod-inet-diag=y CONFIG_PACKAGE_kmod-inet-diag=y

View File

@ -155,6 +155,7 @@ CONFIG_PACKAGE_ca-certificates=y
CONFIG_PACKAGE_datconf=y CONFIG_PACKAGE_datconf=y
CONFIG_PACKAGE_datconf-lua=y CONFIG_PACKAGE_datconf-lua=y
CONFIG_PACKAGE_ethtool=y CONFIG_PACKAGE_ethtool=y
CONFIG_PACKAGE_ebtables=y
CONFIG_PACKAGE_htop=y CONFIG_PACKAGE_htop=y
CONFIG_PACKAGE_ip-bridge=y CONFIG_PACKAGE_ip-bridge=y
CONFIG_PACKAGE_ip6tables-extra=y CONFIG_PACKAGE_ip6tables-extra=y
@ -193,6 +194,9 @@ CONFIG_PACKAGE_kmod-crypto-rng=y
CONFIG_PACKAGE_kmod-crypto-seqiv=y CONFIG_PACKAGE_kmod-crypto-seqiv=y
CONFIG_PACKAGE_kmod-crypto-sha256=y CONFIG_PACKAGE_kmod-crypto-sha256=y
CONFIG_PACKAGE_kmod-crypto-sha512=y CONFIG_PACKAGE_kmod-crypto-sha512=y
CONFIG_PACKAGE_kmod-ebtables=y
CONFIG_PACKAGE_kmod-ebtables-ipv4=y
CONFIG_PACKAGE_kmod-ebtables-ipv6=y
CONFIG_PACKAGE_kmod-fs-autofs4=y CONFIG_PACKAGE_kmod-fs-autofs4=y
CONFIG_PACKAGE_kmod-fs-vfat=y CONFIG_PACKAGE_kmod-fs-vfat=y
CONFIG_PACKAGE_kmod-inet-diag=y CONFIG_PACKAGE_kmod-inet-diag=y

View File

@ -126,6 +126,7 @@ CONFIG_PACKAGE_ca-certificates=y
CONFIG_PACKAGE_datconf=y CONFIG_PACKAGE_datconf=y
CONFIG_PACKAGE_datconf-lua=y CONFIG_PACKAGE_datconf-lua=y
CONFIG_PACKAGE_ethtool=y CONFIG_PACKAGE_ethtool=y
CONFIG_PACKAGE_ebtables=y
CONFIG_PACKAGE_htop=y CONFIG_PACKAGE_htop=y
CONFIG_PACKAGE_ip-bridge=y CONFIG_PACKAGE_ip-bridge=y
CONFIG_PACKAGE_ip6tables-extra=y CONFIG_PACKAGE_ip6tables-extra=y
@ -164,6 +165,9 @@ CONFIG_PACKAGE_kmod-crypto-rng=y
CONFIG_PACKAGE_kmod-crypto-seqiv=y CONFIG_PACKAGE_kmod-crypto-seqiv=y
CONFIG_PACKAGE_kmod-crypto-sha256=y CONFIG_PACKAGE_kmod-crypto-sha256=y
CONFIG_PACKAGE_kmod-crypto-sha512=y CONFIG_PACKAGE_kmod-crypto-sha512=y
CONFIG_PACKAGE_kmod-ebtables=y
CONFIG_PACKAGE_kmod-ebtables-ipv4=y
CONFIG_PACKAGE_kmod-ebtables-ipv6=y
CONFIG_PACKAGE_kmod-fs-autofs4=y CONFIG_PACKAGE_kmod-fs-autofs4=y
CONFIG_PACKAGE_kmod-fs-vfat=y CONFIG_PACKAGE_kmod-fs-vfat=y
CONFIG_PACKAGE_kmod-inet-diag=y CONFIG_PACKAGE_kmod-inet-diag=y

View File

@ -124,6 +124,7 @@ CONFIG_PACKAGE_ca-certificates=y
CONFIG_PACKAGE_datconf=y CONFIG_PACKAGE_datconf=y
CONFIG_PACKAGE_datconf-lua=y CONFIG_PACKAGE_datconf-lua=y
CONFIG_PACKAGE_ethtool=y CONFIG_PACKAGE_ethtool=y
CONFIG_PACKAGE_ebtables=y
CONFIG_PACKAGE_htop=y CONFIG_PACKAGE_htop=y
CONFIG_PACKAGE_ip-bridge=y CONFIG_PACKAGE_ip-bridge=y
CONFIG_PACKAGE_ip6tables-extra=y CONFIG_PACKAGE_ip6tables-extra=y
@ -162,6 +163,9 @@ CONFIG_PACKAGE_kmod-crypto-rng=y
CONFIG_PACKAGE_kmod-crypto-seqiv=y CONFIG_PACKAGE_kmod-crypto-seqiv=y
CONFIG_PACKAGE_kmod-crypto-sha256=y CONFIG_PACKAGE_kmod-crypto-sha256=y
CONFIG_PACKAGE_kmod-crypto-sha512=y CONFIG_PACKAGE_kmod-crypto-sha512=y
CONFIG_PACKAGE_kmod-ebtables=y
CONFIG_PACKAGE_kmod-ebtables-ipv4=y
CONFIG_PACKAGE_kmod-ebtables-ipv6=y
CONFIG_PACKAGE_kmod-fs-autofs4=y CONFIG_PACKAGE_kmod-fs-autofs4=y
CONFIG_PACKAGE_kmod-fs-vfat=y CONFIG_PACKAGE_kmod-fs-vfat=y
CONFIG_PACKAGE_kmod-inet-diag=y CONFIG_PACKAGE_kmod-inet-diag=y

View File

@ -131,6 +131,7 @@ CONFIG_PACKAGE_ca-certificates=y
CONFIG_PACKAGE_datconf=y CONFIG_PACKAGE_datconf=y
CONFIG_PACKAGE_datconf-lua=y CONFIG_PACKAGE_datconf-lua=y
CONFIG_PACKAGE_ethtool=y CONFIG_PACKAGE_ethtool=y
CONFIG_PACKAGE_ebtables=y
CONFIG_PACKAGE_htop=y CONFIG_PACKAGE_htop=y
CONFIG_PACKAGE_ip-bridge=y CONFIG_PACKAGE_ip-bridge=y
CONFIG_PACKAGE_ip6tables-extra=y CONFIG_PACKAGE_ip6tables-extra=y
@ -169,6 +170,9 @@ CONFIG_PACKAGE_kmod-crypto-rng=y
CONFIG_PACKAGE_kmod-crypto-seqiv=y CONFIG_PACKAGE_kmod-crypto-seqiv=y
CONFIG_PACKAGE_kmod-crypto-sha256=y CONFIG_PACKAGE_kmod-crypto-sha256=y
CONFIG_PACKAGE_kmod-crypto-sha512=y CONFIG_PACKAGE_kmod-crypto-sha512=y
CONFIG_PACKAGE_kmod-ebtables=y
CONFIG_PACKAGE_kmod-ebtables-ipv4=y
CONFIG_PACKAGE_kmod-ebtables-ipv6=y
CONFIG_PACKAGE_kmod-fs-autofs4=y CONFIG_PACKAGE_kmod-fs-autofs4=y
CONFIG_PACKAGE_kmod-fs-vfat=y CONFIG_PACKAGE_kmod-fs-vfat=y
CONFIG_PACKAGE_kmod-inet-diag=y CONFIG_PACKAGE_kmod-inet-diag=y

View File

@ -131,6 +131,7 @@ CONFIG_PACKAGE_ca-certificates=y
CONFIG_PACKAGE_datconf=y CONFIG_PACKAGE_datconf=y
CONFIG_PACKAGE_datconf-lua=y CONFIG_PACKAGE_datconf-lua=y
CONFIG_PACKAGE_ethtool=y CONFIG_PACKAGE_ethtool=y
CONFIG_PACKAGE_ebtables=y
CONFIG_PACKAGE_htop=y CONFIG_PACKAGE_htop=y
CONFIG_PACKAGE_ip-bridge=y CONFIG_PACKAGE_ip-bridge=y
CONFIG_PACKAGE_ip6tables-extra=y CONFIG_PACKAGE_ip6tables-extra=y
@ -169,6 +170,9 @@ CONFIG_PACKAGE_kmod-crypto-rng=y
CONFIG_PACKAGE_kmod-crypto-seqiv=y CONFIG_PACKAGE_kmod-crypto-seqiv=y
CONFIG_PACKAGE_kmod-crypto-sha256=y CONFIG_PACKAGE_kmod-crypto-sha256=y
CONFIG_PACKAGE_kmod-crypto-sha512=y CONFIG_PACKAGE_kmod-crypto-sha512=y
CONFIG_PACKAGE_kmod-ebtables=y
CONFIG_PACKAGE_kmod-ebtables-ipv4=y
CONFIG_PACKAGE_kmod-ebtables-ipv6=y
CONFIG_PACKAGE_kmod-fs-autofs4=y CONFIG_PACKAGE_kmod-fs-autofs4=y
CONFIG_PACKAGE_kmod-fs-vfat=y CONFIG_PACKAGE_kmod-fs-vfat=y
CONFIG_PACKAGE_kmod-inet-diag=y CONFIG_PACKAGE_kmod-inet-diag=y

View File

@ -24,6 +24,10 @@ return view.extend({
o.default = o.disabled; o.default = o.disabled;
o.rmempty = false; o.rmempty = false;
o = s.option(form.Flag, 'ipv6enabled', _('IPV6Enable'));
o.default = o.disabled;
o.rmempty = false;
o = s.option(form.Value, 'download', _('Download speed (Mbit/s)'), o = s.option(form.Value, 'download', _('Download speed (Mbit/s)'),
_('Total download bandwidth.')); _('Total download bandwidth.'));
o.datatype = 'and(uinteger,min(1))'; o.datatype = 'and(uinteger,min(1))';
@ -42,7 +46,7 @@ return view.extend({
o = s.option(form.Flag, 'enabled', _('Enable')); o = s.option(form.Flag, 'enabled', _('Enable'));
o.default = o.enabled; o.default = o.enabled;
o = s.option(form.Value, 'ip', _('IP address')); o = s.option(form.Value, 'ip', _('IPV4 address'));
o.datatype = 'ip4addr'; o.datatype = 'ip4addr';
for (var i of Object.entries(data[1]?.hosts)) for (var i of Object.entries(data[1]?.hosts))
for (var v in i[1].ipaddrs) for (var v in i[1].ipaddrs)
@ -52,6 +56,15 @@ return view.extend({
} }
o.rmempty = false; o.rmempty = false;
var hosts = data[1]?.hosts;
o = s.option(form.Value, 'mac', _('IPV6 host'));
o.datatype = 'macaddr';
Object.keys(hosts).forEach(function(mac) {
var hint = hosts[mac].name || L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4)[0];
o.value(mac, hint ? '%s (%s)'.format(mac, hint) : mac);
});
o.rmempty = true;
o = s.option(form.Value, 'download', _('Download speed (kbit/s)')); o = s.option(form.Value, 'download', _('Download speed (kbit/s)'));
o.datatype = 'and(uinteger,min(0))'; o.datatype = 'and(uinteger,min(0))';
o.rmempty = false; o.rmempty = false;

View File

@ -19,12 +19,15 @@ msgstr ""
msgid "Enable" msgid "Enable"
msgstr "" msgstr ""
msgid "IPV6Enable"
msgstr ""
#: applications/luci-app-eqos/root/usr/share/rpcd/acl.d/luci-app-eqos.json:3 #: applications/luci-app-eqos/root/usr/share/rpcd/acl.d/luci-app-eqos.json:3
msgid "Grant UCI access for luci-app-eqos" msgid "Grant UCI access for luci-app-eqos"
msgstr "" msgstr ""
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:46 #: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:46
msgid "IP address" msgid "IPV4 address"
msgstr "" msgstr ""
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:19 #: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:19
@ -54,3 +57,6 @@ msgstr ""
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:60 #: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:60
msgid "Upload speed (kbit/s)" msgid "Upload speed (kbit/s)"
msgstr "" msgstr ""
msgid "IPV6 host"
msgstr ""

View File

@ -27,13 +27,20 @@ msgstr "网速控制"
msgid "Enable" msgid "Enable"
msgstr "启用" msgstr "启用"
msgid "IPV6Enable"
msgstr "同时作用IPV6"
#: applications/luci-app-eqos/root/usr/share/rpcd/acl.d/luci-app-eqos.json:3 #: applications/luci-app-eqos/root/usr/share/rpcd/acl.d/luci-app-eqos.json:3
msgid "Grant UCI access for luci-app-eqos" msgid "Grant UCI access for luci-app-eqos"
msgstr "授予 luci-app-eqos 访问 UCI 配置的权限" msgstr "授予 luci-app-eqos 访问 UCI 配置的权限"
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:46 #: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:46
msgid "IP address" msgid "IPV4 address"
msgstr "IP 地址" msgstr "IPV4 地址"
msgid "IPV6 host"
msgstr "IPV6 主机"
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:19 #: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:19
msgid "Network speed control service.(Compatiable with Mediatek HNAT)" msgid "Network speed control service.(Compatiable with Mediatek HNAT)"

View File

@ -11,13 +11,15 @@ parse_device() {
config_get_bool enabled "$cfg" "enabled" "1" config_get_bool enabled "$cfg" "enabled" "1"
[ "$enabled" -eq "1" ] || return 1 [ "$enabled" -eq "1" ] || return 1
local ip download upload comment
local ip download upload comment mac
config_get ip "$cfg" ip config_get ip "$cfg" ip
config_get download "$cfg" "download" config_get download "$cfg" "download"
config_get upload "$cfg" "upload" config_get upload "$cfg" "upload"
config_get comment "$cfg" "comment" config_get comment "$cfg" "comment"
config_get mac "$cfg" "mac"
eqos add "$ip" "$download" "$upload" "$comment" eqos add "$ip" "$download" "$upload" "$comment" "$mac"
} }
start_service() { start_service() {
@ -30,10 +32,22 @@ start_service() {
local download upload comment local download upload comment
config_get download "config" "download" config_get download "config" "download"
config_get upload "config" "upload" config_get upload "config" "upload"
config_get comment "comment" "comment" config_get comment "config" "comment"
eqos start "$download" "$upload" "$comment" eqos start "$download" "$upload" "$comment"
local ipv6enabled
config_get_bool ipv6enabled "config" "ipv6enabled" "0"
ip6tables -t mangle -N eqos
ip6tables -t mangle -F eqos
ebtables -t nat -N eqos
ebtables -t nat -F eqos
if [ "$ipv6enabled" -eq "1" ]; then
ebtables -t nat -D POSTROUTING -j eqos -p ipv6
ebtables -t nat -A POSTROUTING -j eqos -p ipv6
ip6tables -t mangle -D FORWARD -j eqos
ip6tables -t mangle -A FORWARD -j eqos
fi
config_foreach parse_device "device" config_foreach parse_device "device"
} }

View File

@ -26,10 +26,10 @@ start_qos() {
tc filter add dev $dev parent ffff: protocol ip u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev ${dev}-ifb tc filter add dev $dev parent ffff: protocol ip u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev ${dev}-ifb
} }
case "$1" in iptables_stop() {
"stop")
stop_qos
iptables -t mangle -D FORWARD -j eqos iptables -t mangle -D FORWARD -j eqos
ip6tables -t mangle -D FORWARD -j eqos
ebtables -t nat -D POSTROUTING -j eqos -p ipv6
echo 0 > /sys/kernel/debug/hnat/qos_toggle echo 0 > /sys/kernel/debug/hnat/qos_toggle
sed -i '/\/etc\/init.d\/eqos start/d' /etc/firewall.user sed -i '/\/etc\/init.d\/eqos start/d' /etc/firewall.user
iptables -t mangle -D FORWARD -i br-lan -j DSCP --set-dscp 0 iptables -t mangle -D FORWARD -i br-lan -j DSCP --set-dscp 0
@ -48,18 +48,20 @@ case "$1" in
echo 0 wrr 10000000 > /sys/kernel/debug/hnat/qdma_sch1 echo 0 wrr 10000000 > /sys/kernel/debug/hnat/qdma_sch1
echo 0 wrr 10000000 > /sys/kernel/debug/hnat/qdma_sch2 echo 0 wrr 10000000 > /sys/kernel/debug/hnat/qdma_sch2
echo 0 wrr 10000000 > /sys/kernel/debug/hnat/qdma_sch3 echo 0 wrr 10000000 > /sys/kernel/debug/hnat/qdma_sch3
;; }
"start")
stop_qos iptables_start_prepare() {
ip6tables -t mangle -D FORWARD -i br-lan -j DSCP --set-dscp 0
ip6tables -t mangle -D FORWARD -o br-lan -j DSCP --set-dscp 0
ip6tables -t mangle -A FORWARD -i br-lan -j DSCP --set-dscp 0
ip6tables -t mangle -A FORWARD -o br-lan -j DSCP --set-dscp 0
iptables -t mangle -D FORWARD -i br-lan -j DSCP --set-dscp 0 iptables -t mangle -D FORWARD -i br-lan -j DSCP --set-dscp 0
iptables -t mangle -D FORWARD -o br-lan -j DSCP --set-dscp 0 iptables -t mangle -D FORWARD -o br-lan -j DSCP --set-dscp 0
iptables -t mangle -A FORWARD -i br-lan -j DSCP --set-dscp 0 iptables -t mangle -A FORWARD -i br-lan -j DSCP --set-dscp 0
iptables -t mangle -A FORWARD -o br-lan -j DSCP --set-dscp 0 iptables -t mangle -A FORWARD -o br-lan -j DSCP --set-dscp 0
start_qos $2 $3 ip6tables -t mangle -D FORWARD -i br-lan -j DSCP --set-dscp 0
ip6tables -t mangle -D FORWARD -o br-lan -j DSCP --set-dscp 0
ip6tables -t mangle -A FORWARD -i br-lan -j DSCP --set-dscp 0
ip6tables -t mangle -A FORWARD -o br-lan -j DSCP --set-dscp 0
}
iptables_start_inital() {
iptables -t mangle -N eqos iptables -t mangle -N eqos
iptables -t mangle -F eqos iptables -t mangle -F eqos
iptables -t mangle -D FORWARD -j eqos iptables -t mangle -D FORWARD -j eqos
@ -67,8 +69,6 @@ case "$1" in
echo 1 > /sys/kernel/debug/hnat/qos_toggle echo 1 > /sys/kernel/debug/hnat/qos_toggle
echo 0 wrr 10000000 > /sys/kernel/debug/hnat/qdma_sch0 echo 0 wrr 10000000 > /sys/kernel/debug/hnat/qdma_sch0
echo 0 wrr 10000000 > /sys/kernel/debug/hnat/qdma_sch1 echo 0 wrr 10000000 > /sys/kernel/debug/hnat/qdma_sch1
echo 1 wrr $(($3*1000)) > /sys/kernel/debug/hnat/qdma_sch2
echo 1 wrr $(($2*1000)) > /sys/kernel/debug/hnat/qdma_sch3
echo 0 0 0 0 0 0 0 > /sys/kernel/debug/hnat/qdma_txq0 echo 0 0 0 0 0 0 0 > /sys/kernel/debug/hnat/qdma_txq0
echo 1 0 0 0 0 0 0 > /sys/kernel/debug/hnat/qdma_txq8 echo 1 0 0 0 0 0 0 > /sys/kernel/debug/hnat/qdma_txq8
echo "11 5" >/sys/kernel/debug/hnat/hnat_setting echo "11 5" >/sys/kernel/debug/hnat/hnat_setting
@ -77,24 +77,45 @@ case "$1" in
sed -i '/\/etc\/init.d\/eqos start/d' /etc/firewall.user sed -i '/\/etc\/init.d\/eqos start/d' /etc/firewall.user
echo "/etc/init.d/eqos start" >> /etc/firewall.user echo "/etc/init.d/eqos start" >> /etc/firewall.user
echo "10 1" > /sys/kernel/debug/hnat/hnat_setting echo "10 1" > /sys/kernel/debug/hnat/hnat_setting
}
case "$1" in
"stop")
stop_qos
iptables_stop
;;
"start")
stop_qos
iptables_start_prepare
start_qos $2 $3
iptables_start_inital
echo 1 wrr $(($3*1000)) > /sys/kernel/debug/hnat/qdma_sch2
echo 1 wrr $(($2*1000)) > /sys/kernel/debug/hnat/qdma_sch3
;; ;;
"add") "add")
ip="$2" ip="$2"
dl="$3" dl="$3"
up="$4" up="$4"
id="$5" idpair=$((id+32)) id="$5" idpair=$((id+32))
macaddr="$6"
cnt=$(tc class show dev $dev | wc -l) cnt=$(tc class show dev $dev | wc -l)
if [ $id -lt 32 ]; then
if [ $id -lt 32 ]; then
iptables -t mangle -D eqos -s $ip -j DSCP --set-dscp ${id} iptables -t mangle -D eqos -s $ip -j DSCP --set-dscp ${id}
iptables -t mangle -D eqos -d $ip -j DSCP --set-dscp ${idpair} iptables -t mangle -D eqos -d $ip -j DSCP --set-dscp ${idpair}
ip6tables -t mangle -D eqos -m mac --mac-source $macaddr -j MARK --set-mark ${id}
ebtables -t nat -D eqos -p ipv6 -d $macaddr -j mark --mark-set ${idpair}
if [ $up -ne 0 ]; then if [ $up -ne 0 ]; then
echo 2 0 0 1 ${up} 4 1 > /sys/kernel/debug/hnat/qdma_txq${id} echo 2 0 0 1 ${up} 4 1 > /sys/kernel/debug/hnat/qdma_txq${id}
iptables -t mangle -A eqos -s $ip -j DSCP --set-dscp ${id} iptables -t mangle -A eqos -s $ip -j DSCP --set-dscp ${id}
ip6tables -t mangle -A eqos -m mac --mac-source $macaddr -j MARK --set-mark ${id}
fi fi
if [ $dl -ne 0 ]; then if [ $dl -ne 0 ]; then
echo 3 0 0 1 ${dl} 4 1 > /sys/kernel/debug/hnat/qdma_txq${idpair} echo 3 0 0 1 ${dl} 4 1 > /sys/kernel/debug/hnat/qdma_txq${idpair}
iptables -t mangle -A eqos -d $ip -j DSCP --set-dscp ${idpair} iptables -t mangle -A eqos -d $ip -j DSCP --set-dscp ${idpair}
ebtables -t nat -A eqos -p ipv6 -d $macaddr -j mark --mark-set ${idpair}
fi fi
else else
iptables -t mangle -D eqos -s $ip -j MARK --set-mark 0x99 iptables -t mangle -D eqos -s $ip -j MARK --set-mark 0x99
@ -105,13 +126,14 @@ case "$1" in
if [ $dl -ne 0 ]; then if [ $dl -ne 0 ]; then
iptables -t mangle -A eqos -d $ip -j MARK --set-mark 0x99 iptables -t mangle -A eqos -d $ip -j MARK --set-mark 0x99
fi fi
fi fi
if [ $id -gt 31 ]; then
tc class add dev $dev parent 1:1 classid 1:1$cnt htb rate ${dl}kbit ceil ${dl}kbit tc class add dev $dev parent 1:1 classid 1:1$cnt htb rate ${dl}kbit ceil ${dl}kbit
tc filter add dev $dev parent 1:0 protocol ip u32 match ip dst $ip flowid 1:1$cnt tc filter add dev $dev parent 1:0 protocol ip u32 match ip dst $ip flowid 1:1$cnt
tc class add dev ${dev}-ifb parent 1:1 classid 1:1$cnt htb rate ${up}kbit ceil ${up}kbit tc class add dev ${dev}-ifb parent 1:1 classid 1:1$cnt htb rate ${up}kbit ceil ${up}kbit
tc filter add dev ${dev}-ifb parent 1:0 protocol ip u32 match ip src $ip flowid 1:1$cnt tc filter add dev ${dev}-ifb parent 1:0 protocol ip u32 match ip src $ip flowid 1:1$cnt
fi
;; ;;
*) *)
echo "Usage: $0 <command> [options]" echo "Usage: $0 <command> [options]"

View File

@ -174,13 +174,13 @@ return view.extend({
o.rmempty = false; o.rmempty = false;
o.depends('fastpath_mh_eth_hnat', '1'); o.depends('fastpath_mh_eth_hnat', '1');
o = s.option(form.Flag, 'fastpath_mh_eth_hnat_macvlan', _('Enable ethernet HNAT for MACVLAN'), o = s.option(form.Flag, 'fastpath_mh_eth_hnat_macvlan', _('Enable ethernet HNAT for MACVLAN WAN device'),
_('Enable hardware offloading for macvlan (sing wan only).')); _('Enable hardware offloading for macvlan (sing wan only).'));
o.default = o.enabled; o.default = o.enabled;
o.rmempty = false; o.rmempty = false;
o.depends('fastpath_mh_eth_hnat', '1'); o.depends('fastpath_mh_eth_hnat', '1');
o = s.option(form.Value, 'fastpath_mh_eth_hnat_bind_rate', _('HNAT bind rate threshold (pps/s)'), o = s.option(form.Value, 'fastpath_mh_eth_hnat_bind_rate', _('HNAT bind rate threshold (pps)'),
_('The smaller the threshold, the easier it is for the connection to be accelerated.')); _('The smaller the threshold, the easier it is for the connection to be accelerated.'));
o.datatype = 'and(uinteger,min(1))'; o.datatype = 'and(uinteger,min(1))';
o.rmempty = false; o.rmempty = false;
@ -190,8 +190,8 @@ return view.extend({
_('Full cone NAT (NAT1) can improve gaming performance effectively.')); _('Full cone NAT (NAT1) can improve gaming performance effectively.'));
o.value('0', _('Disable')) o.value('0', _('Disable'))
if (features.hasXTFULLCONENAT) if (features.hasXTFULLCONENAT)
o.value('1', _('xt_FULLCONENAT')); o.value('1', _('XT_FULLCONE_NAT'));
o.value('2', _('Boardcom fullcone')); o.value('2', _('Boardcom_FULLCONE_NAT'));
o.default = '0'; o.default = '0';
o.rmempty = false; o.rmempty = false;

View File

@ -6,7 +6,7 @@ msgid "Acceleration Status"
msgstr "" msgstr ""
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:191 #: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:191
msgid "Boardcom fullcone" msgid "Boardcom_FULLCONE_NAT"
msgstr "" msgstr ""
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:151 #: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:151
@ -32,6 +32,22 @@ msgstr ""
msgid "Enable IPv6 Acceleration." msgid "Enable IPv6 Acceleration."
msgstr "" msgstr ""
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:177
msgid "Enable ethernet HNAT for MACVLAN WAN device"
msgstr ""
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:178
msgid "Enable hardware offloading for macvlan (sing wan only)."
msgstr ""
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:183
msgid "HNAT bind rate threshold (pps)"
msgstr ""
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:184
msgid "The smaller the threshold, the easier it is for the connection to be accelerated."
msgstr ""
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:152 #: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:152
msgid "" msgid ""
"Enable bridge acceleration (may be functional conflict with bridge-mode VPN " "Enable bridge acceleration (may be functional conflict with bridge-mode VPN "
@ -161,5 +177,9 @@ msgid "TurboACC settings"
msgstr "" msgstr ""
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:190 #: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:190
msgid "xt_FULLCONENAT" msgid "XT_FULLCONE_NAT"
msgstr ""
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:191
msgid "Boardcom_FULLCONE_NAT"
msgstr "" msgstr ""

View File

@ -13,8 +13,8 @@ msgid "Acceleration Status"
msgstr "加速状态" msgstr "加速状态"
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:191 #: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:191
msgid "Boardcom fullcone" msgid "Boardcom_FULLCONE_NAT"
msgstr "Boardcom fullcone" msgstr "Boardcom_FULLCONE_NAT(更低的CPU占用)"
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:151 #: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:151
msgid "Bridge Acceleration" msgid "Bridge Acceleration"
@ -58,16 +58,16 @@ msgid "Enable hardware offloading for wired IPv6 connections."
msgstr "为有线 IPv6 连接启用硬件加速。" msgstr "为有线 IPv6 连接启用硬件加速。"
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:177 #: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:177
msgid "Enable ethernet HNAT for MACVLAN" msgid "Enable ethernet HNAT for MACVLAN WAN device"
msgstr "启用MACVLAN HNAT" msgstr "启用MACVLAN WAN 设备 HNAT"
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:178 #: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:178
msgid "Enable hardware offloading for macvlan (sing wan only)." msgid "Enable hardware offloading for macvlan (sing wan only)."
msgstr "为MACVLAN 连接启用硬件加速(仅支持单WAN)。" msgstr "为MACVLAN 连接启用硬件加速(仅支持单WAN)。"
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:183 #: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:183
msgid "HNAT bind rate threshold (pps/s)" msgid "HNAT bind rate threshold (pps)"
msgstr "HNAT加速速率阈值(pps/s)" msgstr "HNAT连接速率绑定阈值(pps)"
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:184 #: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:184
msgid "The smaller the threshold, the easier it is for the connection to be accelerated." msgid "The smaller the threshold, the easier it is for the connection to be accelerated."
@ -186,5 +186,6 @@ msgid "TurboACC settings"
msgstr "网络加速设置" msgstr "网络加速设置"
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:190 #: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:190
msgid "xt_FULLCONENAT" msgid "XT_FULLCONE_NAT"
msgstr "xt_FULLCONENAT" msgstr "XT_FULLCONE_NAT(更佳的兼容性)"

View File

@ -56,7 +56,7 @@ start() {
echo "12 $fastpath_mh_eth_hnat_macvlan" > "$hnat_path/hnat_setting" echo "12 $fastpath_mh_eth_hnat_macvlan" > "$hnat_path/hnat_setting"
fi fi
if [ "$fastpath_mh_eth_hnat" -eq "1" ]; then if [ "$fastpath_mh_eth_hnat" -eq "1" ]; then
config_get_bool fastpath_mh_eth_hnat_macvlan "config" "fastpath_mh_eth_hnat_bind_rate" "1" config_get fastpath_mh_eth_hnat_bind_rate "config" "fastpath_mh_eth_hnat_bind_rate"
echo "11 $fastpath_mh_eth_hnat_bind_rate" > "$hnat_path/hnat_setting" echo "11 $fastpath_mh_eth_hnat_bind_rate" > "$hnat_path/hnat_setting"
fi fi
;; ;;

View File

@ -1416,8 +1416,6 @@ static unsigned int skb_to_hnat_info(struct sk_buff *skb,
entry.ipv6_5t_route.iblk2.dscp = entry.ipv6_5t_route.iblk2.dscp =
(ip6h->priority << 4 | (ip6h->priority << 4 |
(ip6h->flow_lbl[0] >> 4)); (ip6h->flow_lbl[0] >> 4));
dscp = (ip6h->priority << 4 |
(ip6h->flow_lbl[0] >> 4));
break; break;
case NEXTHDR_IPIP: case NEXTHDR_IPIP: