1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Add option to enable/disable nDPI

This commit is contained in:
Ycarus (Yannick Chabanois) 2021-05-28 17:48:24 +02:00
parent d5fd515873
commit 7840a05a8a
3 changed files with 35 additions and 19 deletions

View file

@ -341,31 +341,33 @@ _bypass_proto() {
[ -z "$intf" ] && intf="all"
[ -z "$proto" ] && return
if [ "$intf" = "all" ]; then
iptables-restore -w --wait=60 --noflush <<-EOF
*mangle
-A omr-bypass-dpi -m ndpi --proto $proto -j MARK --set-mark 0x539
COMMIT
EOF
if [ "$disableipv6" = "0" ]; then
ip6tables-restore -w --wait=60 --noflush <<-EOF
if [ "$(uci -q get openmptcprouter.settings.ndpi)" != "0" ]; then
if [ "$intf" = "all" ]; then
iptables-restore -w --wait=60 --noflush <<-EOF
*mangle
-A omr-bypass6-dpi -m ndpi --proto $proto -j MARK --set-mark 0x6539
-A omr-bypass-dpi -m ndpi --proto $proto -j MARK --set-mark 0x539
COMMIT
EOF
fi
else
iptables-restore -w --wait=60 --noflush <<-EOF
*mangle
-A omr-bypass-dpi -m ndpi --proto $proto -j MARK --set-mark 0x539$intfid
COMMIT
EOF
if [ "$disableipv6" = "0" ]; then
ip6tables-restore -w --wait=60 --noflush <<-EOF
if [ "$disableipv6" = "0" ]; then
ip6tables-restore -w --wait=60 --noflush <<-EOF
*mangle
-A omr-bypass6-dpi -m ndpi --proto $proto -j MARK --set-mark 0x6539
COMMIT
EOF
fi
else
iptables-restore -w --wait=60 --noflush <<-EOF
*mangle
-A omr-bypass6-dpi -m ndpi --proto $proto -j MARK --set-mark 0x6539$intfid
-A omr-bypass-dpi -m ndpi --proto $proto -j MARK --set-mark 0x539$intfid
COMMIT
EOF
if [ "$disableipv6" = "0" ]; then
ip6tables-restore -w --wait=60 --noflush <<-EOF
*mangle
-A omr-bypass6-dpi -m ndpi --proto $proto -j MARK --set-mark 0x6539$intfid
COMMIT
EOF
fi
fi
fi
# Use dnsmasq ipset to bypass domains of the proto

View file

@ -1041,6 +1041,10 @@ function settings_add()
local shadowsocksudp = luci.http.formvalue("shadowsocksudp") or "0"
ucic:set("openmptcprouter","settings","shadowsocksudp",shadowsocksudp)
-- Enable/disable nDPI
local ndpi = luci.http.formvalue("ndpi") or "1"
ucic:set("openmptcprouter","settings","ndpi",ndpi)
-- Enable/disable fast open
local disablefastopen = luci.http.formvalue("disablefastopen") or "0"
if disablefastopen == "0" then

View file

@ -331,6 +331,16 @@
</div>
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title"><%:Disable nDPI%></label>
<div class="cbi-value-field">
<input type="checkbox" name="ndpi" class="cbi-input-checkbox" value="0" <% if luci.model.uci.cursor():get("openmptcprouter","settings","ndpi") == "0" then %>checked<% end %>>
<br />
<div class="cbi-value-description">
<%:Disable nDPI, used for protocols in OMR-ByPass%>
</div>
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title"><%:Disable ModemManager%></label>
<div class="cbi-value-field">