mirror of
https://github.com/gSpotx2f/ruantiblock_openwrt.git
synced 2026-05-15 07:00:59 +00:00
Bugfixes.
This commit is contained in:
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ruantiblock
|
||||
PKG_VERSION:=2.1.12
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=3
|
||||
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/ruantiblock_openwrt>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@@ -89,7 +89,7 @@ ENABLE_TMP_DOWNLOADS=0
|
||||
### Скачивать блэклисты через прокси
|
||||
ENABLE_BLLIST_PROXY=0
|
||||
### Список хостов источников блэклиста
|
||||
BLLIST_HOSTS="reestr.rublacklist.net raw.githubusercontent.com app.assembla.com antifilter.download"
|
||||
BLLIST_HOSTS="reestr.rublacklist.net raw.githubusercontent.com app.assembla.com antifilter.download blockedin.org"
|
||||
### Кол-во попыток обновления блэклиста (в случае неудачи)
|
||||
MODULE_RUN_ATTEMPTS=3
|
||||
### Таймаут между попытками обновления
|
||||
|
||||
@@ -125,7 +125,7 @@ export ENABLE_TMP_DOWNLOADS=0
|
||||
### Скачивать блэклисты через прокси
|
||||
export ENABLE_BLLIST_PROXY=0
|
||||
### Список хостов источников блэклиста
|
||||
export BLLIST_HOSTS="reestr.rublacklist.net raw.githubusercontent.com app.assembla.com antifilter.download"
|
||||
export BLLIST_HOSTS="reestr.rublacklist.net raw.githubusercontent.com app.assembla.com antifilter.download blockedin.org"
|
||||
### Кол-во попыток обновления блэклиста (в случае неудачи)
|
||||
export MODULE_RUN_ATTEMPTS=3
|
||||
### Таймаут между попытками обновления
|
||||
@@ -241,11 +241,12 @@ if [ "$ENABLE_LOGGING" = "1" -a $? -ne 0 ]; then
|
||||
fi
|
||||
export LOGGER_CMD
|
||||
export LOGGER_PARAMS="-t ${APP_NAME}"
|
||||
export WGET_CMD="$(which wget)"
|
||||
WGET_CMD="$(which wget)"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo " Error! Wget doesn't exists" >&2
|
||||
exit 1
|
||||
fi
|
||||
export WGET_CMD
|
||||
export WGET_PARAMS="--no-check-certificate -q -O"
|
||||
NSLOOKUP_CMD="$(which nslookup)"
|
||||
if [ $? -ne 0 ]; then
|
||||
@@ -1046,7 +1047,7 @@ CheckDnsmasqConfDir() {
|
||||
}
|
||||
|
||||
Update() {
|
||||
local _arg="$1" _return_code=0
|
||||
local _arg="$1" _return_code=0 _upd_sets_ret_code=0
|
||||
MakeToken
|
||||
if [ -e "$U_PID_FILE" ] && [ "$_arg" != "force-update" ]; then
|
||||
echo " ${NAME} ${_arg} - Error! Another instance of update is already running" >&2
|
||||
@@ -1062,9 +1063,13 @@ Update() {
|
||||
FlushInstancesNftSets bllist
|
||||
fi
|
||||
GetBlacklistFiles
|
||||
_return_code=$?
|
||||
FlushInstancesNftSets bllist
|
||||
UpdateBllistSets
|
||||
_return_code=$?
|
||||
_upd_sets_ret_code=$?
|
||||
if [ $_return_code -eq 0 ]; then
|
||||
_return_code=$_upd_sets_ret_code
|
||||
fi
|
||||
RestartDnsmasq
|
||||
ToggleUPIDFile del
|
||||
### Post-update script
|
||||
|
||||
@@ -42,7 +42,9 @@ NftRouteDelete() {
|
||||
NftRouteAdd() {
|
||||
local _vpn_ip _type="$1" _route_table_id=$2 _pkts_mark=$3 _if_vpn="$4" _vpn_gw_ip="$5"
|
||||
if [ "$_type" = "lo" ]; then
|
||||
echo 0 > "/proc/sys/net/ipv4/conf/lo/rp_filter"
|
||||
if [ -d "/proc/sys/net/ipv4/conf/lo" ]; then
|
||||
echo 0 > "/proc/sys/net/ipv4/conf/lo/rp_filter"
|
||||
fi
|
||||
$IP_CMD rule add fwmark "$_pkts_mark" table "$_route_table_id" priority "$LO_RULE_PRIO"
|
||||
$IP_CMD route add local default dev lo table "$_route_table_id"
|
||||
|
||||
@@ -58,22 +60,33 @@ NftRouteAdd() {
|
||||
else
|
||||
_vpn_ip=$($IP_CMD addr list dev "$_if_vpn" 2> /dev/null | $AWK_CMD '/inet/{f=($3 == "peer") ? 4 : 2; sub("/[0-9]{1,2}$", "", $f); print $f; exit}')
|
||||
fi
|
||||
if [ -n "$_vpn_ip" -a "$_type" = "vpn" ]; then
|
||||
echo 0 > "/proc/sys/net/ipv4/conf/${_if_vpn}/rp_filter"
|
||||
if [ "$_type" = "vpn" ]; then
|
||||
if [ -d "/proc/sys/net/ipv4/conf/${_if_vpn}" ]; then
|
||||
echo 0 > "/proc/sys/net/ipv4/conf/${_if_vpn}/rp_filter"
|
||||
fi
|
||||
NftRouteDelete "$_route_table_id" 2> /dev/null
|
||||
$IP_CMD rule add fwmark "$_pkts_mark" table "$_route_table_id" priority "$VPN_RULE_PRIO"
|
||||
$IP_CMD route add default via "$_vpn_ip" table "$_route_table_id" metric 100
|
||||
if [ $? -ne 0 ]; then
|
||||
echo " Error! An error occurred while adding the route. Routing table id=${_route_table_id}, VPN gateway IP=${_vpn_ip}" >&2
|
||||
MakeLogRecord "err" "Error! An error occurred while adding the route. Routing table id=${_route_table_id}, VPN gateway IP=${_vpn_ip}"
|
||||
fi
|
||||
$IP_CMD route add blackhole default table "$_route_table_id" metric 200
|
||||
|
||||
if [ $DEBUG -ge 1 ]; then
|
||||
echo " nft_functions.NftRouteAdd: ${IP_CMD} rule add fwmark ${_pkts_mark} table ${_route_table_id} priority ${VPN_RULE_PRIO}" >&2
|
||||
MakeLogRecord "debug" "nft_functions.NftRouteAdd: ${IP_CMD} rule add fwmark ${_pkts_mark} table ${_route_table_id} priority ${VPN_RULE_PRIO}"
|
||||
echo " nft_functions.NftRouteAdd: ${IP_CMD} route add default via ${_vpn_ip} table ${_route_table_id}" >&2
|
||||
MakeLogRecord "debug" "nft_functions.NftRouteAdd: ${IP_CMD} route add default via ${_vpn_ip} table ${_route_table_id}"
|
||||
fi
|
||||
|
||||
if [ -n "$_vpn_ip" ]; then
|
||||
$IP_CMD route add default via "$_vpn_ip" table "$_route_table_id" metric 100
|
||||
if [ $? -ne 0 ]; then
|
||||
echo " Error! An error occurred while adding the route. Routing table id=${_route_table_id}, VPN gateway IP=${_vpn_ip}" >&2
|
||||
MakeLogRecord "err" "Error! An error occurred while adding the route. Routing table id=${_route_table_id}, VPN gateway IP=${_vpn_ip}"
|
||||
fi
|
||||
|
||||
if [ $DEBUG -ge 1 ]; then
|
||||
echo " nft_functions.NftRouteAdd: ${IP_CMD} route add default via ${_vpn_ip} table ${_route_table_id}" >&2
|
||||
MakeLogRecord "debug" "nft_functions.NftRouteAdd: ${IP_CMD} route add default via ${_vpn_ip} table ${_route_table_id}"
|
||||
fi
|
||||
fi
|
||||
$IP_CMD route add blackhole default table "$_route_table_id" metric 200
|
||||
|
||||
if [ $DEBUG -ge 1 ]; then
|
||||
echo " nft_functions.NftRouteAdd: ${IP_CMD} route add blackhole default table ${_route_table_id} metric 200" >&2
|
||||
MakeLogRecord "debug" "nft_functions.NftRouteAdd: ${IP_CMD} route add blackhole default table ${_route_table_id} metric 200"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user