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

Merge branch 'masgera'

This commit is contained in:
suyuan 2021-02-14 00:48:11 +08:00
commit bd0e2f6d3c
15 changed files with 142 additions and 26 deletions

View file

@ -98,6 +98,7 @@ jobs:
user: root
port: ${{ secrets.OMR_DEPLOY_PORT }}
key: ${{ secrets.PRIVATE_KEY }}
args: -tt
- if: steps.branch_name.outputs.SOURCE_BRANCH != ''
name: Deploy - Create directory
uses: ysurac/ssh-action@master
@ -112,6 +113,7 @@ jobs:
user: root
port: ${{ secrets.OMR_DEPLOY_PORT }}
key: ${{ secrets.PRIVATE_KEY }}
args: -tt
- name: Move binaries for rsync
working-directory: ../../omr
env:

View file

@ -32,7 +32,6 @@ return L.view.extend({
s.tab('advanced', _('Advanced Settings'));
o = s.taboption('general', form.Flag, 'enable', _('Enabled'));
o.default = o.enabled;
o = s.taboption('general',form.Value, 'label', _('Label'));
o.rmempty = true;
@ -65,11 +64,9 @@ return L.view.extend({
o.rmempty = false;
o = s.taboption('advanced', form.Flag, 'mptcp', _('MPTCP'));
o.default = o.enabled;
o.modalonly = true;
o = s.taboption('advanced', form.Flag, 'chacha20', _('chacha'), _('Force fallback cipher'));
o.default = o.enabled;
o.modalonly = true;
o = s.taboption('advanced', form.Value, 'timeout', _('Timeout'));
@ -78,7 +75,6 @@ return L.view.extend({
o.modalonly = true;
o = s.taboption('advanced', form.Flag, 'multiqueue', _('Multiqueue'));
o.default = o.enabled;
o.rmempty = false;
o.modalonly = true;

View file

@ -40,7 +40,6 @@ return L.view.extend({
s.tab('advanced', _('Advanced Settings'));
o = s.taboption('general', form.Flag, 'enable', _('Enabled'));
o.default = o.enabled;
o = s.taboption('general',form.Value, 'label', _('Label'));
o.rmempty = true;
@ -74,11 +73,9 @@ return L.view.extend({
o.rmempty = false;
o = s.taboption('advanced', form.Flag, 'persist', _('Persist'), _('Keep the tunnel device after exiting'));
o.default = o.enabled;
o.modalonly = true;
o = s.taboption('advanced', form.Flag, 'chacha', _('chacha'), _('Force fallback cipher'));
o.default = o.enabled;
o.modalonly = true;
o = s.taboption('advanced', form.Value, 'kxtimeout', _('Key rotation timeout'));

View file

@ -864,6 +864,10 @@ function settings_add()
local disablegwping = luci.http.formvalue("disablegwping") or "0"
ucic:set("openmptcprouter","settings","disablegwping",disablegwping)
-- Enable/disable renaming intf
local disableintfrename = luci.http.formvalue("disableintfrename") or "0"
ucic:set("openmptcprouter","settings","disableintfrename",disableintfrename)
-- Enable/disable default gateway
local disabledefaultgw = luci.http.formvalue("disabledefaultgw") or "1"
ucic:set("openmptcprouter","settings","defaultgw",disabledefaultgw)

View file

@ -244,6 +244,16 @@
</div>
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title"><%:Disable interfaces auto rename%></label>
<div class="cbi-value-field">
<input type="checkbox" name="disableintfrename" class="cbi-input-checkbox" value="1" <% if luci.model.uci.cursor():get("openmptcprouter","settings","disableintfrename") == "1" then %>checked<% end %>>
<br />
<div class="cbi-value-description">
<%:Disable renaming interfaces%>
</div>
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title"><%:When proxy shadowsocks is used, use it for UDP if proxy down%></label>
<div class="cbi-value-field">

View file

@ -837,4 +837,4 @@
</div>
</form>
<script type="text/javascript">cbi_init();</script>
<%+footer%>
<%+footer%>

View file

@ -27,14 +27,14 @@ _set_intf_name() {
if [ "$modalias" = "$chk_modalias" ] && [ "$INTERFACE" != "$ifname" ]; then
logger -t "OMR-Rename" "Rename ${INTERFACE} to ${ifname}"
existif=0
ip link set ${INTERFACE} down
ip link set ${INTERFACE} down 2>&1 >/dev/null
[ "$(ip link show ${ifname} 2>/dev/null)" != "" ] && {
ip link set ${ifname} name ${ifname}tmp
ip link set ${ifname} name ${ifname}tmp 2>&1 >/dev/null
existif=1
}
ip link set ${INTERFACE} name ${ifname}
ip link set ${ifname} up
[ "$existif" = "1" ] && ip link set ${ifname}tmp ${$INTERFACE}
ip link set ${INTERFACE} name ${ifname} 2>&1 >/dev/null
ip link set ${ifname} up 2>&1 >/dev/null
[ "$existif" = "1" ] && ip link set ${ifname}tmp ${$INTERFACE} 2>&1 >/dev/null
fi
fi
elif [ -f /dev/${DEVICE_NAME} ] && [ -n "$MODALIAS" ] && [ "$modalias" = "$MODALIAS" ]; then
@ -46,18 +46,20 @@ _set_intf_name() {
}
[ -z "$modalias" ] && [ -n "$device" ] && [ -n "$ifname" ] && [ "/sys${DEVPATH}" = "$device" ] && [ "$INTERFACE" != "$ifname" ] && {
logger -t "OMR-Rename" "Rename ${INTERFACE} to ${ifname}"
ip link set ${INTERFACE} down
ip link set ${INTERFACE} down 2>&1 >/dev/null
existif=0
[ "$(ip link show ${ifname} 2>/dev/null)" != "" ] && {
ip link set ${ifname} name ${ifname}tmp
ip link set ${ifname} name ${ifname}tmp 2>&1 >/dev/null
existif=1
}
ip link set ${INTERFACE} name ${ifname}
ip link set ${ifname} up
[ "$existif" = "1" ] && ip link set ${ifname}tmp ${$INTERFACE}
ip link set ${INTERFACE} name ${ifname} 2>&1 >/dev/null
ip link set ${ifname} up 2>&1 >/dev/null
[ "$existif" = "1" ] && ip link set ${ifname}tmp ${$INTERFACE} 2>&1 >/dev/null
}
}
config_load network
config_foreach _set_intf_name interface
config_foreach _set_intf_name interface
if [ "$(uci -q get openmptcprouter.settings.disableintfrename)" != "0" ]; then
config_load network
config_foreach _set_intf_name interface
config_foreach _set_intf_name interface
fi

View file

@ -104,6 +104,15 @@ start_service() {
# remove sysctl already defined in /etc/sysctl.d/
sed -i -e '/tcp_fin_timeout/d' -e '/tcp_keepalive_time/d' -e '/nf_conntrack_max/d' -e '/tcp_syn_retries/d' -e '/tcp_fastopen/d' -e '/tcp_retries2/d' -e '/tcp_retries1/d' -e '/ip_default_ttl/d' /etc/sysctl.conf
sed -i -e '/tcp_fin_timeout/d' -e '/tcp_keepalive_time/d' -e '/nf_conntrack_max/d' -e '/tcp_syn_retries/d' -e '/tcp_fastopen/d' -e '/tcp_retries2/d' -e '/tcp_retries1/d' -e '/ip_default_ttl/d' /etc/sysctl.d/10-default.conf
if [ "$(uci -q get rpcd.@rpcd[0].socket)" != "/var/run/ubus/ubus.sock" ]; then
uci -q batch <<-EOF >/dev/null
set rpcd.@rpcd[0].socket='/var/run/ubus/ubus.sock'
commit rpcd
EOF
/etc/init.d/rpcd restart 2>&1 >/dev/null
fi
}
reload_service() {

View file

@ -595,7 +595,7 @@ if [ "$multipath_config" = "on" ] || [ "$multipath_config" = "backup" ]; then
# if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" != "1" ] && [ "$(pgrep glorytun-udp)" != "" ] && [ "$(glorytun-udp set | grep 'kxtimeout 7d')" = "" ]; then
# glorytun-udp set dev tun0 kxtimeout 7d > /dev/null 2>&1
# fi
[ "$multipath_config" = "backup" ] && [ "$(pgrep glorytun-udp)" != "" ] && glorytun-udp path addr $OMR_TRACKER_DEVICE_IP dev tun0 set pref 200 > /dev/null 2>&1
[ "$multipath_config" = "backup" ] && [ "$(pgrep glorytun-udp)" != "" ] && glorytun-udp path addr $OMR_TRACKER_DEVICE_IP dev tun0 set pref 125 > /dev/null 2>&1
fi
[ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipathvpn)" != "1" ] && {
[ "$multipath_status" = "$multipath_config" ] || {

View file

@ -150,8 +150,8 @@ _dns() {
-b "${deviceip}" \
+time="$OMR_TRACKER_TIMEOUT" \
+tries=1 \
openmptcprouter.com
) && echo "$ret" | grep -sq "94.23.252.192" && {
one.one.one.one
) && echo "$ret" | grep -sq "1.1.1.1" && {
OMR_TRACKER_LATENCY=$(echo "$ret" | awk '/Query time/{print $4}')
_update_rto "$OMR_TRACKER_LATENCY"
return

View file

@ -0,0 +1,46 @@
#!/bin/sh
# vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 :
name=$0
basename="$(basename $0)"
_log() {
logger -p daemon.info -t "${basename}" "$@"
}
_ping_server() {
local host=$1
ret=$(ping \
-w "$OMR_TRACKER_TIMEOUT" \
-c 1 \
-q \
"${host}"
) && echo "$ret" | grep -sq " 0% packet loss" && {
server_ping=true
}
}
_ping_tunnel() {
local name=$1
config_get gateway $1 gateway
config_get ifname $1 ifname
config_get disabled $1 disabled
[ "$(echo $ifname | grep omrip)" != "" ] && [ -n "$gateway" ] && [ "$disabled" != "1" ] && {
_ping_server $gateway
}
}
. /lib/functions.sh
timeout=${OMR_TRACKER_TIMEOUT:-5}
interval=${OMR_TRACKER_INTERVAL:-10}
intervaltries=${OMR_TRACKER_INTERVAL_TRIES:-2}
retry=${OMR_TRACKER_TRIES:-4}
waittest=${OMR_TRACKER_WAIT_TEST:-0}
while true; do
server_ping=false
config_load network
config_foreach _ping_tunnel interface
sleep "${interval}"
done

View file

@ -103,6 +103,28 @@ _launch_server_tracker() {
procd_close_instance
}
_launch_gre_tracker() {
local hosts timeout tries interval interval_tries options type enabled wait_test
_validate_section "defaults" "defaults"
_validate_section "gre" "gre"
[ "${enabled}" = "0" ] && return
[ -z "${interval_tries}" ] && interval_tries=1
procd_open_instance
# shellcheck disable=SC2086
procd_set_param command /bin/omr-tracker-gre "$1" $options
procd_append_param env "OMR_TRACKER_TIMEOUT=$timeout"
procd_append_param env "OMR_TRACKER_TRIES=$tries"
procd_append_param env "OMR_TRACKER_INTERVAL=$interval"
procd_append_param env "OMR_TRACKER_INTERVAL_TRIES=$interval_tries"
procd_append_param env "OMR_TRACKER_WAIT_TEST=$wait_test"
procd_set_param limits nofile="51200 51200"
procd_set_param respawn 0 10 0
procd_set_param stderr 1
procd_close_instance
}
_initialize_shadowsocks_tracker() {
local redir_tcp server tracker_server
config_get redir_tcp ss_rules redir_tcp
@ -199,6 +221,11 @@ _multi_server() {
[ "$backup" = "1" ] && multiserver=true
}
_gre_tunnel() {
config_get proto $1 proto
[ "$proto" = "gre" ] && gretunnel=true
}
start_service() {
local ss_disabled
logger -t "omr-tracker" "Launching..."
@ -224,6 +251,10 @@ start_service() {
config_load openmptcprouter
config_foreach _multi_server server
[ "$multiserver" = true ] && _launch_server_tracker
gretunnel=false
config_load network
config_foreach _gre_tunnel interface
[ "$gretunnel" = true ] && _launch_gre_tracker
logger -t "omr-tracker" "Launched"
}

View file

@ -2,7 +2,7 @@
# Copyright (C) 2018 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
# Released under GPL 3. See LICENSE for the full terms.
START=1
START=11
STOP=98
boot() {
@ -16,6 +16,7 @@ boot() {
[ -n "$files" ] && {
mkdir -p /usr/share/omr-update
if [ "$(grep rom /etc/mtab)" = "" ]; then
rm /usr/share/omr-update/*
cp /etc/uci-defaults/* /usr/share/omr-update
fi
uci -q set openmptcprouter.settings=settings

View file

@ -78,7 +78,7 @@ MY_DEPENDS := \
!TARGET_mvebu:kmod-usb-net-huawei-cdc-ncm !TARGET_mvebu:kmod-usb-net-rndis !TARGET_mvebu:kmod-usb-net-cdc-ether !TARGET_mvebu:kmod-usb-net-ipheth !TARGET_mvebu:usbmuxd \
kmod-rt2800-usb kmod-rtl8xxxu kmod-rtl8192cu kmod-net-rtl8192su \
!TARGET_mvebu:luci-proto-qmi wpad-basic kmod-mt7601u kmod-rtl8187 \
luci-app-mlvpn mlvpn 464xlat !TARGET_mvebu:kmod-usb-net-smsc75xx kmod-zram kmod-swconfig swconfig kmod-ipt-nat kmod-ipt-nat6 luci-app-https-dns-proxy kmod-tcp-nanqinlang (TARGET_x86_64||TARGET_arm64):kmod-tcp-bbr2 iptables-mod-ipopt igmpproxy ss iptraf-ng \
luci-app-mlvpn mlvpn 464xlat !TARGET_mvebu:kmod-usb-net-smsc75xx kmod-zram kmod-swconfig swconfig kmod-ipt-nat kmod-ipt-nat6 luci-app-https-dns-proxy kmod-tcp-nanqinlang (TARGET_x86_64||aarch64):kmod-tcp-bbr2 iptables-mod-ipopt igmpproxy ss iptraf-ng \
luci-app-acl block-mount blockd fstools luci-app-shutdown libwebp luci-proto-gre tcptraceroute luci-proto-mbim kmod-rtl8xxxu kmod-ath9k-htc luci-app-ttyd luci-mod-dashboard (TARGET_x86||TARGET_x86_64):rtl8192eu-firmware kmod-usb2 libustream-wolfssl (TARGET_x86||TARGET_x86_64):kmod-ixgbevf \
hwinfo (TARGET_x86||TARGET_x86_64):dmidecode luci-app-packet-capture kmod-bonding luci-proto-bonding
# luci-theme-bootstrap luci-theme-openwrt-2020 luci-theme-openwrt luci-app-status

View file

@ -0,0 +1,18 @@
#!/bin/sh
cd /etc/uci-defaults || exit 0
source /etc/os-release
OMRVERSION=$(echo $VERSION | sed 's/v//')
files="$(ls /etc/uci-defaults/)"
[ -n "$files" ] && {
mkdir -p /usr/share/omr-update
if [ "$(grep rom /etc/mtab)" = "" ]; then
rm /usr/share/omr-update/*
cp /etc/uci-defaults/* /usr/share/omr-update
fi
uci -q set openmptcprouter.settings=settings
uci -q set openmptcprouter.settings.version=${OMRVERSION}
uci -q commit
}
exit 0