mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Fix merge
This commit is contained in:
commit
8e9389f476
160 changed files with 26795 additions and 3701 deletions
11
.github/workflows/main.yml
vendored
11
.github/workflows/main.yml
vendored
|
@ -3,13 +3,13 @@ on: [push]
|
|||
|
||||
env:
|
||||
REPO_URL: 'https://github.com/ysurac/openmptcprouter'
|
||||
OMR_KERNEL: '5.4'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
OMR_TARGET: [bpi-r1, bpi-r2, bpi-r64, rpi2, rpi4, wrt32x, espressobin, r2s, rpi3, wrt3200acm, x86, x86_64, ubnt-erx, r4s]
|
||||
OMR_TARGET: [bpi-r1, bpi-r2, bpi-r64, rpi2, rpi4, wrt32x, espressobin, r2s, rpi3, wrt3200acm, x86, x86_64, ubnt-erx, r4s, r7800]
|
||||
OMR_KERNEL: [5.4, 5.15]
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
|
||||
|
@ -61,10 +61,11 @@ jobs:
|
|||
OMR_FEED_URL: https://github.com/ysurac/openmptcprouter-feeds
|
||||
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
|
||||
OMR_TARGET: ${{ matrix.OMR_TARGET }}
|
||||
OMR_KERNEL: ${{ matrix.OMR_KERNEL }}
|
||||
OMR_HOST: ${{ secrets.OMR_HOST }}
|
||||
OMR_PORT: ${{ secrets.OMR_PORT }}
|
||||
run: |
|
||||
OMR_FEED_SRC="${SOURCE_NAME}" sh build.sh prepare {tools,toolchain}/install -j$(nproc) || OMR_FEED_SRC="${SOURCE_NAME}" sh build.sh prepare {tools,toolchain}/install -j1 V=s
|
||||
OMR_KERNEL="${OMR_KERNEL}" OMR_FEED_SRC="${SOURCE_NAME}" sh build.sh prepare {tools,toolchain}/install -j$(nproc) || OMR_KERNEL="${OMR_KERNEL}" OMR_FEED_SRC="${SOURCE_NAME}" sh build.sh prepare {tools,toolchain}/install -j1 V=s
|
||||
#echo -e "${{ secrets.OMR_PRIVKEY }}" > $OMR_TARGET/source/key-build
|
||||
#echo -e "${{ secrets.OMR_PUBKEY }}" > $OMR_TARGET/source/key-build.pub
|
||||
- name: Build packages
|
||||
|
@ -108,7 +109,7 @@ jobs:
|
|||
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
|
||||
with:
|
||||
command: |
|
||||
mkdir -p deploy/${{env.SOURCE_BRANCH}}/${{env.OMR_KERNEL}}/${{matrix.OMR_TARGET}}
|
||||
mkdir -p deploy/${{env.SOURCE_BRANCH}}/${{matrix.OMR_KERNEL}}/${{matrix.OMR_TARGET}}
|
||||
host: ${{ secrets.OMR_DEPLOY_HOST }}
|
||||
user: deploy
|
||||
port: ${{ secrets.OMR_DEPLOY_PORT }}
|
||||
|
@ -141,7 +142,7 @@ jobs:
|
|||
uses: ysurac/action-rsync@master
|
||||
env:
|
||||
ARGS: -av --delete-after
|
||||
TARGET: deploy/${{ steps.branch_name.outputs.SOURCE_BRANCH }}/${{env.OMR_KERNEL}}/${{matrix.OMR_TARGET}}
|
||||
TARGET: deploy/${{ steps.branch_name.outputs.SOURCE_BRANCH }}/${{matrix.OMR_KERNEL}}/${{matrix.OMR_TARGET}}
|
||||
SOURCE: ./bin/
|
||||
KEY: ${{ secrets.PRIVATE_KEY }}
|
||||
USER: deploy
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bcm27xx-eeprom
|
||||
PKG_VERSION:=2fec47bd7f981c9cb21b0fb3fdd4fe07f23f9e3b
|
||||
PKG_VERSION:=47976e4409c6999a8e211976c75c60a97c90275c
|
||||
PKG_RELEASE:=4
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/raspberrypi/rpi-eeprom/tar.gz/$(PKG_VERSION)?
|
||||
PKG_HASH:=f54c26ec399801dee7d3d0cc0e969c28878b6f42c982e166c863edb91d2d2a21
|
||||
PKG_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause Custom
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
|
|
@ -14,7 +14,7 @@ Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
|||
|
||||
--- a/rpi-eeprom-update
|
||||
+++ b/rpi-eeprom-update
|
||||
@@ -24,17 +24,17 @@ else
|
||||
@@ -24,12 +24,12 @@ else
|
||||
fi
|
||||
|
||||
# Selects the release sub-directory
|
||||
|
@ -26,15 +26,9 @@ Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
|||
ENABLE_VL805_UPDATES=${ENABLE_VL805_UPDATES:-1}
|
||||
RECOVERY_BIN=${RECOVERY_BIN:-${FIRMWARE_ROOT}/${FIRMWARE_RELEASE_STATUS}/recovery.bin}
|
||||
BOOTFS=${BOOTFS:-/boot}
|
||||
-VCMAILBOX=${VCMAILBOX:-/opt/vc/bin/vcmailbox}
|
||||
+VCMAILBOX=${VCMAILBOX:-/usr/bin/vcmailbox}
|
||||
CM4_ENABLE_RPI_EEPROM_UPDATE=${CM4_ENABLE_RPI_EEPROM_UPDATE:-0}
|
||||
RPI_EEPROM_UPDATE_CONFIG_TOOL="${RPI_EEPROM_UPDATE_CONFIG_TOOL:-raspi-config}"
|
||||
|
||||
DT_BOOTLOADER_TS=${DT_BOOTLOADER_TS:-/proc/device-tree/chosen/bootloader/build-timestamp}
|
||||
|
||||
EXIT_SUCCESS=0
|
||||
EXIT_UPDATE_REQUIRED=1
|
||||
--- a/rpi-eeprom-update-default
|
||||
+++ b/rpi-eeprom-update-default
|
||||
@@ -1,8 +1,9 @@
|
||||
|
|
58
cryptodev-linux/Makefile
Normal file
58
cryptodev-linux/Makefile
Normal file
|
@ -0,0 +1,58 @@
|
|||
#
|
||||
# Copyright (C) 2014 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# $Id$
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=cryptodev-linux
|
||||
PKG_VERSION:=1.12
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/$(PKG_NAME)/$(PKG_NAME)/tar.gz/$(PKG_NAME)-$(PKG_VERSION)?
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_HASH:=f51c2254749233b1b1d7ec9445158bd709f124f88e1c650fe2faac83c3a81938
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
PKG_MAINTAINER:=Ansuel Smith <ansuelsmth@gmail.com>
|
||||
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/cryptodev
|
||||
SUBMENU:=Cryptographic API modules
|
||||
TITLE:=Driver for cryptographic acceleration
|
||||
URL:=http://cryptodev-linux.org/
|
||||
VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE)
|
||||
DEPENDS:=+kmod-crypto-authenc +kmod-crypto-hash
|
||||
FILES:=$(PKG_BUILD_DIR)/cryptodev.$(LINUX_KMOD_SUFFIX)
|
||||
AUTOLOAD:=$(call AutoLoad,50,cryptodev)
|
||||
MODPARAMS.cryptodev:=cryptodev_verbosity=-1
|
||||
endef
|
||||
|
||||
define KernelPackage/cryptodev/description
|
||||
This is a driver for that allows to use the Linux kernel supported
|
||||
hardware ciphers by user-space applications.
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
KERNEL_DIR="$(LINUX_DIR)"
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/crypto
|
||||
$(CP) $(PKG_BUILD_DIR)/crypto/cryptodev.h $(STAGING_DIR)/usr/include/crypto/
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,cryptodev))
|
|
@ -29,6 +29,16 @@ validate_section() {
|
|||
'externalip:string:auto'
|
||||
}
|
||||
|
||||
version_over_5_4() {
|
||||
MAJOR_VERSION=$(uname -r | awk -F '.' '{print $1}')
|
||||
MINOR_VERSION=$(uname -r | awk -F '.' '{print $2}')
|
||||
if [ $MAJOR_VERSION -ge 5 ] && [ $MINOR_VERSION -gt 13 ] || [ $MAJOR_VERSION -gt 5 ] ; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
start_instance() {
|
||||
local enable key host port dev
|
||||
|
||||
|
@ -49,7 +59,7 @@ start_instance() {
|
|||
key=""
|
||||
|
||||
if [ "$(uci -q get network.omrvpn)" != "" ] && [ "$(uci -q get network.omrvpn)" != "$dev" ]; then
|
||||
uci -q set network.omrvpn.ifname=$dev
|
||||
uci -q set network.omrvpn.device=$dev
|
||||
uci -q commit
|
||||
fi
|
||||
|
||||
|
@ -58,6 +68,10 @@ start_instance() {
|
|||
|
||||
_log "starting ${PROG_NAME} ${1} instance $*"
|
||||
|
||||
if version_over_5_4; then
|
||||
PROG="mptcpize run ${PROG}"
|
||||
fi
|
||||
|
||||
procd_open_instance
|
||||
|
||||
procd_set_param command ${PROG} ${mode} \
|
||||
|
|
|
@ -50,7 +50,7 @@ start_instance() {
|
|||
key=""
|
||||
|
||||
if [ "$(uci -q get network.omrvpn)" != "" ]; then
|
||||
uci -q set network.omrvpn.ifname=$dev
|
||||
uci -q set network.omrvpn.device=$dev
|
||||
uci -q commit
|
||||
fi
|
||||
|
||||
|
|
|
@ -9,11 +9,14 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=glorytun
|
||||
PKG_VERSION:=0.0.35
|
||||
PKG_RELEASE:=6
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=6d58536f4232fea8eaa10fb60aace8ba11f29ed6
|
||||
PKG_SOURCE:=glorytun-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/angt/glorytun/releases/download/v$(PKG_VERSION)
|
||||
PKG_HASH:=49e4d8ea4ff2990300b37947b0bd0da3c8e0985bc6eddf29f4146306188fff64
|
||||
PKG_SOURCE_URL:=https://github.com/Ysurac/glorytun.git
|
||||
PKG_VERSION:=0.0.35-$(PKG_SOURCE_VERSION)
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -11,4 +11,5 @@ config glorytun 'vpn'
|
|||
option localip '10.255.255.2'
|
||||
option remoteip '10.255.255.1'
|
||||
option multiqueue '1'
|
||||
option label 'Default VPN'
|
||||
option label 'Default VPN'
|
||||
option timeout '10000'
|
|
@ -59,9 +59,10 @@ start_instance() {
|
|||
key=""
|
||||
|
||||
if [ "$(uci -q get network.omrvpn)" != "" ]; then
|
||||
uci -q set network.omrvpn.ifname=${dev}
|
||||
uci -q set network.omrvpn.device=${dev}
|
||||
uci -q commit network
|
||||
fi
|
||||
|
||||
_log "starting ${PROG_NAME} ${1} instance $*"
|
||||
|
||||
procd_open_instance
|
||||
|
|
|
@ -13,10 +13,11 @@ endif
|
|||
# Unset environment variables
|
||||
# There are more magic variables to track down, but ain't nobody got time for that
|
||||
|
||||
# From https://golang.org/cmd/go/#hdr-Environment_variables
|
||||
# From https://pkg.go.dev/cmd/go#hdr-Environment_variables
|
||||
|
||||
# General-purpose environment variables:
|
||||
unexport \
|
||||
GO111MODULE \
|
||||
GCCGO \
|
||||
GOARCH \
|
||||
GOBIN \
|
||||
|
@ -36,6 +37,7 @@ unexport \
|
|||
# GONOPROXY
|
||||
# GOSUMDB
|
||||
# GONOSUMDB
|
||||
# GOVCS
|
||||
|
||||
# Environment variables for use with cgo:
|
||||
unexport \
|
||||
|
@ -63,23 +65,20 @@ unexport \
|
|||
# Special-purpose environment variables:
|
||||
unexport \
|
||||
GCCGOTOOLDIR \
|
||||
GOEXPERIMENT \
|
||||
GOROOT_FINAL \
|
||||
GO_EXTLINK_ENABLED
|
||||
# Unmodified:
|
||||
# GIT_ALLOW_PROTOCOL
|
||||
|
||||
# From https://golang.org/cmd/go/#hdr-Module_support
|
||||
unexport \
|
||||
GO111MODULE
|
||||
|
||||
# From https://golang.org/pkg/runtime/#hdr-Environment_Variables
|
||||
# From https://pkg.go.dev/runtime#hdr-Environment_Variables
|
||||
unexport \
|
||||
GOGC \
|
||||
GOMAXPROCS \
|
||||
GORACE \
|
||||
GOTRACEBACK
|
||||
|
||||
# From https://golang.org/cmd/cgo/#hdr-Using_cgo_with_the_go_command
|
||||
# From https://pkg.go.dev/cmd/cgo#hdr-Using_cgo_with_the_go_command
|
||||
unexport \
|
||||
CC_FOR_TARGET \
|
||||
CXX_FOR_TARGET
|
||||
|
@ -111,10 +110,6 @@ unexport \
|
|||
BOOT_GO_GCFLAGS \
|
||||
BOOT_GO_LDFLAGS
|
||||
|
||||
# From https://golang.org/src/cmd/dist/buildruntime.go
|
||||
unexport \
|
||||
GOEXPERIMENT
|
||||
|
||||
# From https://golang.org/src/cmd/dist/buildtool.go
|
||||
unexport \
|
||||
GOBOOTSTRAP_TOOLEXEC
|
||||
|
@ -148,8 +143,11 @@ else
|
|||
endif
|
||||
|
||||
ifeq ($(GO_ARCH),386)
|
||||
# ensure binaries can run on older CPUs
|
||||
GO_386:=387
|
||||
ifeq ($(CONFIG_TARGET_x86_geode)$(CONFIG_TARGET_x86_legacy),y)
|
||||
GO_386:=softfloat
|
||||
else
|
||||
GO_386:=sse2
|
||||
endif
|
||||
|
||||
# -fno-plt: causes "unexpected GOT reloc for non-dynamic symbol" errors
|
||||
GO_CFLAGS_TO_REMOVE:=-fno-plt
|
||||
|
@ -195,19 +193,23 @@ GO_ARCH_DEPENDS:=@(aarch64||arm||i386||i686||mips||mips64||mips64el||mipsel||pow
|
|||
|
||||
# ASLR/PIE
|
||||
|
||||
# From https://golang.org/src/cmd/internal/sys/supported.go
|
||||
GO_PIE_SUPPORTED_OS_ARCH:= \
|
||||
android_386 android_amd64 android_arm android_arm64 \
|
||||
linux_386 linux_amd64 linux_arm linux_arm64 \
|
||||
android_386 android_amd64 android_arm android_arm64 \
|
||||
linux_386 linux_amd64 linux_arm linux_arm64 \
|
||||
\
|
||||
windows_386 windows_amd64 windows_arm \
|
||||
windows_386 windows_amd64 windows_arm \
|
||||
\
|
||||
darwin_amd64 darwin_arm64 \
|
||||
ios_amd64 ios_arm64 \
|
||||
\
|
||||
darwin_amd64 \
|
||||
freebsd_amd64 \
|
||||
\
|
||||
aix_ppc64 \
|
||||
\
|
||||
linux_ppc64le linux_s390x
|
||||
linux_ppc64le linux_riscv64 linux_s390x
|
||||
|
||||
# From https://golang.org/src/cmd/go/internal/work/init.go
|
||||
go_pie_install_suffix=$(if $(filter $(1),aix_ppc64 windows_386 windows_amd64 windows_arm),,shared)
|
||||
|
||||
ifneq ($(filter $(GO_HOST_OS_ARCH),$(GO_PIE_SUPPORTED_OS_ARCH)),)
|
||||
|
@ -236,7 +238,7 @@ endif
|
|||
|
||||
# General build info
|
||||
|
||||
GO_BUILD_CACHE_DIR:=$(or $(call qstrip,$(CONFIG_GOLANG_BUILD_CACHE_DIR)),$(TOPDIR)/.go-build)
|
||||
GO_BUILD_CACHE_DIR:=$(or $(call qstrip,$(CONFIG_GOLANG_BUILD_CACHE_DIR)),$(TMP_DIR)/go-build)
|
||||
GO_MOD_CACHE_DIR:=$(DL_DIR)/go-mod-cache
|
||||
|
||||
GO_MOD_ARGS= \
|
||||
|
@ -249,6 +251,6 @@ GO_GENERAL_BUILD_CONFIG_VARS= \
|
|||
GO_MOD_ARGS="$(GO_MOD_ARGS)"
|
||||
|
||||
define Go/CacheCleanup
|
||||
$(GENERAL_BUILD_CONFIG_VARS) \
|
||||
$(GO_GENERAL_BUILD_CONFIG_VARS) \
|
||||
$(SHELL) $(GO_INCLUDE_DIR)/golang-build.sh cache_cleanup
|
||||
endef
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
GO_VERSION_MAJOR_MINOR:=1.15
|
||||
GO_VERSION_PATCH:=2
|
||||
GO_VERSION_MAJOR_MINOR:=1.17
|
||||
GO_VERSION_PATCH:=3
|
||||
|
||||
PKG_NAME:=golang
|
||||
PKG_VERSION:=$(GO_VERSION_MAJOR_MINOR)$(if $(GO_VERSION_PATCH),.$(GO_VERSION_PATCH))
|
||||
|
@ -20,7 +20,7 @@ GO_SOURCE_URLS:=https://dl.google.com/go/ \
|
|||
|
||||
PKG_SOURCE:=go$(PKG_VERSION).src.tar.gz
|
||||
PKG_SOURCE_URL:=$(GO_SOURCE_URLS)
|
||||
PKG_HASH:=28bf9d0bcde251011caae230a4a05d917b172ea203f2a62f2c2f9533589d4b4d
|
||||
PKG_HASH:=705c64251e5b25d5d55ede1039c6aa22bea40a7a931d14c370339853643c3df0
|
||||
|
||||
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
|
@ -48,12 +48,13 @@ HOST_GO_VALID_OS_ARCH:= \
|
|||
freebsd_386 freebsd_amd64 freebsd_arm freebsd_arm64 \
|
||||
linux_386 linux_amd64 linux_arm linux_arm64 \
|
||||
openbsd_386 openbsd_amd64 openbsd_arm openbsd_arm64 \
|
||||
netbsd_386 netbsd_amd64 netbsd_arm netbsd_arm64 \
|
||||
windows_386 windows_amd64 windows_arm windows_arm64 \
|
||||
\
|
||||
netbsd_386 netbsd_amd64 netbsd_arm \
|
||||
plan9_386 plan9_amd64 plan9_arm \
|
||||
windows_386 windows_amd64 windows_arm \
|
||||
\
|
||||
darwin_amd64 darwin_arm64 \
|
||||
ios_amd64 ios_arm64 \
|
||||
\
|
||||
dragonfly_amd64 \
|
||||
illumos_amd64 \
|
||||
|
@ -64,7 +65,9 @@ HOST_GO_VALID_OS_ARCH:= \
|
|||
\
|
||||
linux_ppc64 linux_ppc64le \
|
||||
linux_mips linux_mipsle linux_mips64 linux_mips64le \
|
||||
linux_riscv64 linux_s390x
|
||||
linux_riscv64 linux_s390x \
|
||||
\
|
||||
openbsd_mips64
|
||||
|
||||
BOOTSTRAP_SOURCE:=go1.4-bootstrap-20171003.tar.gz
|
||||
BOOTSTRAP_SOURCE_URL:=$(GO_SOURCE_URLS)
|
||||
|
@ -258,12 +261,14 @@ endif
|
|||
$(eval $(call GoCompiler/AddProfile,Package,$(PKG_BUILD_DIR),$(PKG_GO_PREFIX),$(PKG_GO_VERSION_ID),$(GO_OS_ARCH),$(PKG_GO_INSTALL_SUFFIX)))
|
||||
|
||||
PKG_GO_ZBOOTSTRAP_MODS:= \
|
||||
s/defaultGO386 = `[^`]*`/defaultGO386 = `$(or $(GO_386),387)`/; \
|
||||
s/defaultGO386 = `[^`]*`/defaultGO386 = `$(or $(GO_386),sse2)`/; \
|
||||
s/defaultGOARM = `[^`]*`/defaultGOARM = `$(or $(GO_ARM),5)`/; \
|
||||
s/defaultGOMIPS = `[^`]*`/defaultGOMIPS = `$(or $(GO_MIPS),hardfloat)`/; \
|
||||
s/defaultGOMIPS64 = `[^`]*`/defaultGOMIPS64 = `$(or $(GO_MIPS64),hardfloat)`/; \
|
||||
s/defaultGOPPC64 = `[^`]*`/defaultGOPPC64 = `power8`/;
|
||||
|
||||
PKG_GO_ZBOOTSTRAP_PATH:=$(PKG_BUILD_DIR)/src/internal/buildcfg/zbootstrap.go
|
||||
|
||||
PKG_GO_VARS= \
|
||||
GOCACHE="$(GO_BUILD_CACHE_DIR)" \
|
||||
GOENV=off \
|
||||
|
@ -306,8 +311,17 @@ define Build/Compile
|
|||
$(PKG_GO_VARS) \
|
||||
)
|
||||
|
||||
$(SED) '$(PKG_GO_ZBOOTSTRAP_MODS)' \
|
||||
"$(PKG_BUILD_DIR)/src/cmd/internal/objabi/zbootstrap.go"
|
||||
$(SED) '$(PKG_GO_ZBOOTSTRAP_MODS)' "$(PKG_GO_ZBOOTSTRAP_PATH)"
|
||||
|
||||
( \
|
||||
if echo 'int main() { return 0; }' | $(TARGET_CC) -o $(PKG_BUILD_DIR)/test-ldso -x c - > /dev/null 2>&1; then \
|
||||
LDSO=$$$$( \
|
||||
readelf -l $(PKG_BUILD_DIR)/test-ldso | \
|
||||
sed -n -e 's/^.*interpreter: \(.*\)[]]/\1/p' \
|
||||
) ; \
|
||||
fi ; \
|
||||
$(SED) "s,defaultGO_LDSO = \`[^\`]*\`,defaultGO_LDSO = \`$$$$LDSO\`," "$(PKG_GO_ZBOOTSTRAP_PATH)" ; \
|
||||
)
|
||||
|
||||
@echo "Building target Go second stage"
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=https-dns-proxy
|
||||
PKG_VERSION:=2021-01-17
|
||||
PKG_RELEASE=2
|
||||
PKG_VERSION:=2021-06-03
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/aarond10/https_dns_proxy
|
||||
PKG_SOURCE_DATE:=2021-01-17
|
||||
PKG_SOURCE_VERSION:=37511cc08712d7548978a4f6f1cc457b7594fb96
|
||||
PKG_MIRROR_HASH:=4e6a7dcb69e350d1df9f17570439b589e031e249da7f91f2ec7600a955e0aaa3
|
||||
PKG_SOURCE_DATE:=2021-06-03
|
||||
PKG_SOURCE_VERSION:=5651b984f770a8bcecb14aeffc224703f8f82586
|
||||
PKG_MIRROR_HASH:=b65161936269aa3117debad0fcfce157024726b78d7e7da77c226f7aa8da5b4d
|
||||
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.net>
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
|
|
@ -1,95 +1,3 @@
|
|||
# DNS Over HTTPS Proxy (https-dns-proxy)
|
||||
# README
|
||||
|
||||
A lean RFC8484-compatible (no JSON API support) DNS-over-HTTPS (DoH) proxy service which supports DoH servers ran by AdGuard, CleanBrowsing, Cloudflare, Google, ODVR (nic.cz) and Quad9. Please see the [README](https://github.com/stangri/openwrt_packages/blob/master/https-dns-proxy/files/README.md) for further information. Based on [@aarond10](https://github.com/aarond10)'s [https-dns-proxy](https://github.com/aarond10/https_dns_proxy).
|
||||
|
||||
## Features
|
||||
|
||||
- [RFC8484](https://tools.ietf.org/html/rfc8484)-compatible DoH Proxy.
|
||||
- Compact size.
|
||||
- Web UI (```luci-app-https-dns-proxy```) available.
|
||||
- (By default) automatically updates DNSMASQ settings to use DoH proxy when it's started and reverts to old DNSMASQ resolvers when DoH proxy is stopped.
|
||||
|
||||
## Screenshots (luci-app-https-dns-proxy)
|
||||
|
||||

|
||||
|
||||
## Requirements
|
||||
|
||||
This proxy requires the following packages to be installed on your router: ```libc```, ```libcares```, ```libcurl```, ```libev```, ```ca-bundle```. They will be automatically installed when you're installing ```https-dns-proxy```.
|
||||
|
||||
## Unmet Dependencies
|
||||
|
||||
If you are running a development (trunk/snapshot) build of OpenWrt/LEDE Project on your router and your build is outdated (meaning that packages of the same revision/commit hash are no longer available and when you try to satisfy the [requirements](#requirements) you get errors), please flash either current LEDE release image or current development/snapshot image.
|
||||
|
||||
## How To Install
|
||||
|
||||
Install ```https-dns-proxy``` and ```luci-app-https-dns-proxy``` packages from Web UI or run the following in the command line:
|
||||
|
||||
```sh
|
||||
opkg update; opkg install https-dns-proxy luci-app-https-dns-proxy;
|
||||
```
|
||||
|
||||
## Default Settings
|
||||
|
||||
Default configuration has service enabled and starts the service with Google and Cloudflare DoH servers. In most configurations, you will keep the default ```DNSMASQ``` service installed to handle requests from devices in your local network and point ```DNSMASQ``` to use ```https-dns-proxy``` for name resolution.
|
||||
|
||||
By default, the service will intelligently override existing ```DNSMASQ``` servers settings on start to use the DoH servers and restores original ```DNSMASQ``` servers on stop. See the [Configuration Settings](#configuration-settings) section below for more information and how to disable this behavior.
|
||||
|
||||
## Configuration Settings
|
||||
|
||||
Configuration contains the (named) "main" config section where you can configure which ```DNSMASQ``` settings the service will automatically affect and the typed (unnamed) https-dns-proxy instance settings. The original config file is included below:
|
||||
|
||||
```text
|
||||
config main 'config'
|
||||
option update_dnsmasq_config '*'
|
||||
|
||||
config https-dns-proxy
|
||||
option bootstrap_dns '8.8.8.8,8.8.4.4'
|
||||
option resolver_url 'https://dns.google/dns-query'
|
||||
option listen_addr '127.0.0.1'
|
||||
option listen_port '5053'
|
||||
option user 'nobody'
|
||||
option group 'nogroup'
|
||||
|
||||
config https-dns-proxy
|
||||
option bootstrap_dns '1.1.1.1,1.0.0.1'
|
||||
option resolver_url 'https://cloudflare-dns.com/dns-query'
|
||||
option listen_addr '127.0.0.1'
|
||||
option listen_port '5054'
|
||||
option user 'nobody'
|
||||
option group 'nogroup'
|
||||
```
|
||||
|
||||
The ```update_dnsmasq_config``` option can be set to dash (set to ```'-'``` to not change ```DNSMASQ``` server settings on start/stop), can be set to ```'*'``` to affect all ```DNSMASQ``` instance server settings or have a space-separated list of ```DNSMASQ``` instances to affect (like ```'0 4 5'```). If this option is omitted, the default setting is ```'*'```.
|
||||
|
||||
Starting with ```https-dns-proxy``` version ```2019-12-03-3``` and higher, when the service is set to update the DNSMASQ servers setting on start/stop, it does not override entries which contain either ```#``` or ```/```, so the entries like listed below will be kept in use:
|
||||
|
||||
```test
|
||||
list server '/onion/127.0.0.1#65453'
|
||||
list server '/openwrt.org/8.8.8.8'
|
||||
list server '/pool.ntp.org/8.8.8.8'
|
||||
list server '127.0.0.1#15353'
|
||||
list server '127.0.0.1#55353'
|
||||
list server '127.0.0.1#65353'
|
||||
```
|
||||
|
||||
The https-dns-proxy instance settings are:
|
||||
|
||||
|Parameter|Type|Default|Description|
|
||||
| --- | --- | --- | --- |
|
||||
|bootstrap_dns|IP Address||The non-encrypted DNS servers to be used to resolve the DoH server name on start.|
|
||||
|edns_subnet|Subnet||EDNS Subnet address can be supplied to supported DoH servers to provide local resolution results.|
|
||||
|listen_addr|IP Address|127.0.0.1|The local IP address to listen to requests.|
|
||||
|listen_port|port|5053 and up|If this setting is omitted, the service will start the first https-dns-proxy instance on port 5053, second on 5054 and so on.|
|
||||
|logfile|Full filepath||Full filepath to the file to log the instance events to.|
|
||||
|resolver_url|URL||The https URL to the RFC8484-compatible resolver.|
|
||||
|proxy_server|URL||Local proxy server to use when accessing resolvers.|
|
||||
|user|String|nobody|Local user to run instance under.|
|
||||
|group|String|nogroup|Local group to run instance under.|
|
||||
|use_http1|Boolean|0|If set to 1, use HTTP/1 on installations with broken/outdated ```curl``` package. Included for posterity reasons, you will most likely not ever need it on OpenWrt.|
|
||||
|verbosity|Integer|0|logging verbosity level. fatal = 0, error = 1, warning = 2, info = 3, debug = 4|
|
||||
|use_ipv6_resolvers_only|Boolean|0|If set to 1, Forces IPv6 DNS resolvers instead of IPv4|
|
||||
|
||||
## Thanks
|
||||
|
||||
This OpenWrt package wouldn't have been possible without [@aarond10](https://github.com/aarond10)'s [https-dns-proxy](https://github.com/aarond10/https_dns_proxy) and his active participation in the OpenWrt package itself. Special thanks to [@jow-](https://github.com/jow-) for general package/luci guidance.
|
||||
README has been moved to [https://docs.openwrt.melmac.net/https-dns-proxy/](https://docs.openwrt.melmac.net/https-dns-proxy/).
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyright 2019-2020 Stan Grishin (stangri@melmac.net)
|
||||
# shellcheck disable=SC2039
|
||||
# shellcheck disable=SC2039,SC3043,SC3060
|
||||
PKG_VERSION='dev-test'
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
|
@ -16,8 +16,7 @@ else
|
|||
fi
|
||||
|
||||
readonly PROG=/usr/sbin/https-dns-proxy
|
||||
dnsmasqConfig=''
|
||||
forceDNS='1'
|
||||
dnsmasqConfig=''; forceDNS=''; forceDNSPorts='';
|
||||
|
||||
version() { echo "$PKG_VERSION"; }
|
||||
|
||||
|
@ -95,10 +94,11 @@ start_instance() {
|
|||
is_force_dns_active() { iptables-save | grep -q -w -- '--dport 53'; }
|
||||
|
||||
start_service() {
|
||||
local p=5053
|
||||
local p=5053 c
|
||||
config_load 'https-dns-proxy'
|
||||
config_get dnsmasqConfig 'config' 'update_dnsmasq_config' '*'
|
||||
config_get_bool forceDNS 'config' 'force_dns' '1'
|
||||
config_get forceDNSPorts 'config' 'force_dns_port' '53 853'
|
||||
dhcp_backup 'create'
|
||||
config_load 'https-dns-proxy'
|
||||
config_foreach start_instance 'https-dns-proxy'
|
||||
|
@ -109,16 +109,28 @@ start_service() {
|
|||
procd_set_param stderr 1
|
||||
procd_open_data
|
||||
json_add_array firewall
|
||||
json_add_object ''
|
||||
json_add_string type redirect
|
||||
json_add_string name https_dns_proxy_dns_redirect
|
||||
json_add_string target DNAT
|
||||
json_add_string src lan
|
||||
json_add_string proto tcpudp
|
||||
json_add_string src_dport 53
|
||||
json_add_string dest_port 53
|
||||
json_add_string reflection 0
|
||||
json_close_object
|
||||
for c in $forceDNSPorts; do
|
||||
if netstat -tuln | grep 'LISTEN' | grep ":${c}" >/dev/null 2>&1 || [ "$c" = "53" ]; then
|
||||
json_add_object ""
|
||||
json_add_string type redirect
|
||||
json_add_string target DNAT
|
||||
json_add_string src lan
|
||||
json_add_string proto "tcp udp"
|
||||
json_add_string src_dport "$c"
|
||||
json_add_string dest_port "$c"
|
||||
json_add_boolean reflection 0
|
||||
json_close_object
|
||||
else
|
||||
json_add_object ""
|
||||
json_add_string type rule
|
||||
json_add_string src lan
|
||||
json_add_string dest "*"
|
||||
json_add_string proto "tcp udp"
|
||||
json_add_string dest_port "$c"
|
||||
json_add_string target REJECT
|
||||
json_close_object
|
||||
fi
|
||||
done
|
||||
json_close_array
|
||||
procd_close_data
|
||||
procd_close_instance
|
||||
|
@ -159,7 +171,7 @@ dnsmasq_add_doh_server() {
|
|||
dnsmasq_create_server_backup() {
|
||||
local cfg="$1"
|
||||
local i
|
||||
uci -q get "dhcp.${cfg}" >/dev/null || return 0
|
||||
uci -q get "dhcp.${cfg}" >/dev/null || return 1
|
||||
if ! uci -q get "dhcp.${cfg}.doh_backup_noresolv" >/dev/null; then
|
||||
if [ -z "$(uci -q get "dhcp.${cfg}.noresolv")" ]; then
|
||||
uci -q set "dhcp.${cfg}.noresolv=1"
|
||||
|
@ -170,13 +182,17 @@ dnsmasq_create_server_backup() {
|
|||
fi
|
||||
fi
|
||||
if ! uci -q get "dhcp.${cfg}.doh_backup_server" >/dev/null; then
|
||||
if [ -z "$(uci -q get "dhcp.${cfg}.server")" ]; then
|
||||
uci -q add_list "dhcp.${cfg}.doh_backup_server="
|
||||
fi
|
||||
for i in $(uci -q get "dhcp.${cfg}.server"); do
|
||||
uci -q add_list "dhcp.${cfg}.doh_backup_server=$i"
|
||||
if [ "$i" = "${i//127.0.0.1}" ] && [ "$i" = "$(echo "$i" | tr -d /)" ]; then
|
||||
if [ "$i" = "$(echo "$i" | tr -d /\#)" ]; then
|
||||
uci -q del_list "dhcp.${cfg}.server=$i"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
dnsmasq_restore_server_backup() {
|
||||
|
@ -209,7 +225,8 @@ dhcp_backup() {
|
|||
config_foreach dnsmasq_create_server_backup 'dnsmasq'
|
||||
elif [ -n "$dnsmasqConfig" ]; then
|
||||
for i in $dnsmasqConfig; do
|
||||
dnsmasq_create_server_backup "@dnsmasq[${i}]"
|
||||
dnsmasq_create_server_backup "@dnsmasq[${i}]" || \
|
||||
dnsmasq_create_server_backup "$i"
|
||||
done
|
||||
fi
|
||||
;;
|
||||
|
|
3
https-dns-proxy/test.sh
Normal file
3
https-dns-proxy/test.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
/etc/init.d/"$1" version 2>&1 | grep "$2"
|
83
iperf3/Makefile
Normal file
83
iperf3/Makefile
Normal file
|
@ -0,0 +1,83 @@
|
|||
#
|
||||
# Copyright (C) 2007-2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=iperf
|
||||
PKG_VERSION:=3.10.1
|
||||
PKG_RELEASE:=10
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://downloads.es.net/pub/iperf
|
||||
PKG_HASH:=03bc9760cc54a245191d46bfc8edaf8a4750f0e87abca6764486972044d6715a
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
DISABLE_NLS:=
|
||||
|
||||
define Package/iperf3/default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Internet Protocol bandwidth measuring tool
|
||||
URL:=https://github.com/esnet/iperf
|
||||
endef
|
||||
|
||||
define Package/iperf3
|
||||
$(call Package/iperf3/default)
|
||||
VARIANT:=nossl
|
||||
endef
|
||||
|
||||
define Package/iperf3-ssl
|
||||
$(call Package/iperf3/default)
|
||||
TITLE+= with iperf_auth support
|
||||
VARIANT:=ssl
|
||||
DEPENDS:= +libopenssl
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -D_GNU_SOURCE
|
||||
CONFIGURE_ARGS += --disable-shared
|
||||
|
||||
ifeq ($(BUILD_VARIANT),ssl)
|
||||
CONFIGURE_ARGS += --with-openssl="$(STAGING_DIR)/usr"
|
||||
else
|
||||
CONFIGURE_ARGS += --without-openssl
|
||||
endif
|
||||
|
||||
MAKE_FLAGS += noinst_PROGRAMS=
|
||||
|
||||
define Package/iperf3/description
|
||||
Iperf is a modern alternative for measuring TCP and UDP bandwidth
|
||||
performance, allowing the tuning of various parameters and
|
||||
characteristics.
|
||||
endef
|
||||
|
||||
# autoreconf fails if the README file isn't present
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
touch $(PKG_BUILD_DIR)/README
|
||||
endef
|
||||
|
||||
define Package/iperf3/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/iperf3 $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
define Package/iperf3-ssl/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/iperf3 $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,iperf3))
|
||||
$(eval $(call BuildPackage,iperf3-ssl))
|
25
iperf3/patches/remove-in6_flowlabel_req.patch
Normal file
25
iperf3/patches/remove-in6_flowlabel_req.patch
Normal file
|
@ -0,0 +1,25 @@
|
|||
--- a/src/flowlabel.h 2021-06-24 13:26:33.142463630 +0200
|
||||
+++ b/src/flowlabel.h 2021-06-24 13:27:45.669235179 +0200
|
||||
@@ -37,21 +37,21 @@
|
||||
conflicts with "netinet/in.h" .
|
||||
*/
|
||||
|
||||
-#ifndef __ANDROID__
|
||||
+#ifndef _LINUX_IN6_H
|
||||
struct in6_flowlabel_req
|
||||
{
|
||||
struct in6_addr flr_dst;
|
||||
__u32 flr_label;
|
||||
__u8 flr_action;
|
||||
__u8 flr_share;
|
||||
__u16 flr_flags;
|
||||
__u16 flr_expires;
|
||||
__u16 flr_linger;
|
||||
__u32 __flr_pad;
|
||||
/* Options in format of IPV6_PKTOPTIONS */
|
||||
};
|
||||
#endif
|
||||
|
||||
#define IPV6_FL_A_GET 0
|
||||
#define IPV6_FL_A_PUT 1
|
||||
#define IPV6_FL_A_RENEW 2
|
|
@ -1,65 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2018 Chion Tang <tech@chionlab.moe>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=fullconenat
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_DATE:=2019-10-21
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/Chion82/netfilter-full-cone-nat.git
|
||||
PKG_SOURCE_VERSION:=0cf3b48fd7d2fa81d0297d1fff12bbd0580fc435
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/iptables-mod-fullconenat
|
||||
SUBMENU:=Firewall
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=FULLCONENAT iptables extension
|
||||
DEPENDS:=+iptables +kmod-ipt-fullconenat
|
||||
MAINTAINER:=Chion Tang <tech@chionlab.moe>
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-fullconenat/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/iptables
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libipt_FULLCONENAT.so $(1)/usr/lib/iptables
|
||||
endef
|
||||
|
||||
define KernelPackage/ipt-fullconenat
|
||||
SUBMENU:=Netfilter Extensions
|
||||
TITLE:=FULLCONENAT netfilter module
|
||||
DEPENDS:=+kmod-nf-ipt +kmod-nf-nat
|
||||
MAINTAINER:=Chion Tang <tech@chionlab.moe>
|
||||
KCONFIG:=CONFIG_NF_CONNTRACK_EVENTS=y CONFIG_NF_CONNTRACK_CHAIN_EVENTS=y
|
||||
FILES:=$(PKG_BUILD_DIR)/xt_FULLCONENAT.ko
|
||||
endef
|
||||
|
||||
include $(INCLUDE_DIR)/kernel-defaults.mk
|
||||
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
$(CP) ./files/Makefile $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
M="$(PKG_BUILD_DIR)" \
|
||||
EXTRA_CFLAGS="$(BUILDFLAGS)" \
|
||||
modules
|
||||
$(call Build/Compile/Default)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,iptables-mod-fullconenat))
|
||||
$(eval $(call KernelPackage,ipt-fullconenat))
|
|
@ -1,27 +0,0 @@
|
|||
## Netfilter and iptables extension for [FULLCONENAT](https://github.com/Chion82/netfilter-full-cone-nat) target ported to OpenWrt.
|
||||
|
||||
Compile
|
||||
---
|
||||
```
|
||||
# cd to OpenWrt source path
|
||||
# Clone this repo
|
||||
git clone -b master --single-branch https://github.com/LGA1150/openwrt-fullconenat package/fullconenat
|
||||
# Select Network -> Firewall -> iptables-mod-fullconenat
|
||||
make menuconfig
|
||||
# Compile
|
||||
make V=s
|
||||
```
|
||||
|
||||
Usage
|
||||
---
|
||||
You can apply [this patch](https://github.com/LGA1150/fullconenat-fw3-patch) to OpenWrt's Firewall3 (Recommended).
|
||||
|
||||
Or manually add the following rules to `/etc/firewall.user`
|
||||
```
|
||||
iptables -t nat -A zone_wan_prerouting -j FULLCONENAT
|
||||
iptables -t nat -A zone_wan_postrouting -j FULLCONENAT
|
||||
```
|
||||
|
||||
Workaround for conflicting with module `nf_conntrack_netlink`
|
||||
---
|
||||
This module uses conntrack events to register a callback function. In the same netns, only one callback method can be registered, that causes conflicts with `nf_conntrack_netlink`, which also uses conntrack events. Qualcomm Shortcut FE has introduced a patch to allow multiple callbacks to be registered. To apply, put [this patch](https://github.com/coolsnowwolf/lede/blob/master/target/linux/generic/hack-4.14/952-net-conntrack-events-support-multiple-registrant.patch) into `target/linux/generic/hack-4.14`.
|
|
@ -1,7 +0,0 @@
|
|||
libipt_FULLCONENAT.so: libipt_FULLCONENAT.o
|
||||
$(CC) -shared -lxtables -o $@ $^;
|
||||
libipt_FULLCONENAT.o: libipt_FULLCONENAT.c
|
||||
$(CC) ${CFLAGS} -fPIC -D_INIT=$*_init -c -o $@ $<;
|
||||
|
||||
obj-m += xt_FULLCONENAT.o
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
diff --git a/xt_FULLCONENAT.c b/xt_FULLCONENAT.c
|
||||
index 9e52eba..8658c5f 100644
|
||||
--- a/xt_FULLCONENAT.c
|
||||
+++ b/xt_FULLCONENAT.c
|
||||
@@ -702,9 +702,11 @@ static struct xt_target tg_reg[] __read_mostly = {
|
||||
|
||||
static int __init fullconenat_tg_init(void)
|
||||
{
|
||||
+ printk(KERN_INFO "xt_FULLCONENAT: RFC3489 Full Cone NAT module\n"
|
||||
+ "xt_FULLCONENAT: Copyright (C) 2018 Chion Tang <tech@chionlab.moe>\n");
|
||||
wq = create_singlethread_workqueue("xt_FULLCONENAT");
|
||||
if (wq == NULL) {
|
||||
- printk("xt_FULLCONENAT: warning: failed to create workqueue\n");
|
||||
+ printk(KERN_WARNING "xt_FULLCONENAT: warning: failed to create workqueue\n");
|
||||
}
|
||||
|
||||
return xt_register_targets(tg_reg, ARRAY_SIZE(tg_reg));
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (C) 2020 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||
# Copyright (C) 2020-2021 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
|
@ -8,10 +8,10 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ell
|
||||
PKG_VERSION:=0.30
|
||||
PKG_VERSION:=0.41
|
||||
PKG_RELEASE:=1
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_HASH:=51cf8cc66a9d1038e41f7d619ea5660aa4476904496562b2d45ca79370ca4a5e
|
||||
PKG_HASH:=4e8dba6c53cf152dbd0fd1dc3d4c7b04abf79e20a948895f85943e586870505c
|
||||
PKG_SOURCE_URL:=@KERNEL/linux/libs/ell
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=GPL
|
||||
|
|
|
@ -1,24 +1,22 @@
|
|||
#
|
||||
# Copyright (C) 2016 Velocloud Inc.
|
||||
# Copyright (C) 2016 Aleksander Morgado <aleksander@aleksander.es>
|
||||
# Copyright (C) 2021 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://gitlab.freedesktop.org/mobile-broadband/libmbim.git
|
||||
PKG_SOURCE_VERSION:=c90c7c5b877de6e413b4833aaf1a42d2d128b051
|
||||
|
||||
PKG_NAME:=libmbim
|
||||
PKG_VERSION:=1.25.3-$(PKG_SOURCE_VERSION)
|
||||
PKG_RELEASE:=10
|
||||
PKG_VERSION:=1.26.0
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_MAINTAINER:=Nicholas Smith <nicholas.smith@telcoantennas.com.au>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=https://www.freedesktop.org/software/libmbim
|
||||
PKG_HASH:=1e1f0926b22c77210442129eca689722ecf324ab9c9abf421a5c989f46e813cf
|
||||
|
||||
PKG_MAINTAINER:=Nicholas Smith <nicholas@nbembedded.com>
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
#
|
||||
# Copyright (C) 2016 Velocloud Inc.
|
||||
# Copyright (C) 2016 Aleksander Morgado <aleksander@aleksander.es>
|
||||
# Copyright (C) 2021 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
|
||||
PKG_SOURCE_VERSION:=29fab8a1d4496ca5a1d32bb486013b1868a718ba
|
||||
PKG_NAME:=libqmi
|
||||
PKG_VERSION:=1.29.3-$(PKG_SOURCE_VERSION)
|
||||
PKG_RELEASE:=10
|
||||
PKG_VERSION:=1.30.2
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_MAINTAINER:=Nicholas Smith <nicholas.smith@telcoantennas.com.au>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=https://www.freedesktop.org/software/libqmi
|
||||
PKG_HASH:=be01ece0ea2c2194cbea5744bf5aaf06c04ba5fb7ec7887a13116c76d114fedd
|
||||
|
||||
PKG_MAINTAINER:=Nicholas Smith <nicholas@nbembedded.com>
|
||||
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
@ -67,12 +66,22 @@ CONFIGURE_ARGS += \
|
|||
--disable-gtk-doc-pdf \
|
||||
--disable-silent-rules \
|
||||
--enable-firmware-update \
|
||||
--$(if $(LIBQMI_WITH_MBIM_QMUX),en,dis)able-mbim-qmux \
|
||||
--$(if $(LIBQMI_WITH_QRTR_GLIB),en,dis)able-qrtr \
|
||||
--enable-more-warnings=yes \
|
||||
--without-udev \
|
||||
--without-udev-base-dir
|
||||
|
||||
ifeq ($(CONFIG_LIBQMI_WITH_MBIM_QMUX),y)
|
||||
CONFIGURE_ARGS += --enable-mbim-qmux
|
||||
else
|
||||
CONFIGURE_ARGS += --disable-mbim-qmux
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LIBQMI_WITH_QRTR_GLIB),y)
|
||||
CONFIGURE_ARGS += --enable-qrtr
|
||||
else
|
||||
CONFIGURE_ARGS += --disable-qrtr
|
||||
endif
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(CP) \
|
||||
|
|
|
@ -15,7 +15,7 @@ if [ "$(uci -q get network.glorytun)" = "" ] && [ "$(uci -q get network.omrvpn)"
|
|||
uci -q batch <<-EOF >/dev/null
|
||||
delete network.glorytun
|
||||
set network.glorytun=interface
|
||||
set network.glorytun.ifname=tun0
|
||||
set network.glorytun.device=tun0
|
||||
set network.glorytun.proto=dhcp
|
||||
set network.glorytun.ip4table=vpn
|
||||
set network.glorytun.multipath=off
|
||||
|
@ -48,6 +48,7 @@ if [ "$(uci -q show firewall | grep Allow-All-LAN-to-VPN)" = "" ]; then
|
|||
set firewall.@rule[-1].name='Allow-All-LAN-to-VPN'
|
||||
set firewall.@rule[-1].dest='vpn'
|
||||
set firewall.@rule[-1].src='lan'
|
||||
set firewall.@rule[-1].proto='all'
|
||||
commit firewall
|
||||
EOF
|
||||
fi
|
||||
|
|
|
@ -8,3 +8,7 @@ config glorytun-udp 'vpn'
|
|||
option localip '10.255.254.2'
|
||||
option remoteip '10.255.254.1'
|
||||
option mode 'to'
|
||||
option kxtimeout '7d'
|
||||
option timetolerance '10m'
|
||||
option keepalive '25s'
|
||||
option rateauto '0'
|
|
@ -11,7 +11,7 @@ if [ "$(uci -q get network.glorytun-udp)" = "" ] && [ "$(uci -q get network.omrv
|
|||
uci -q batch <<-EOF >/dev/null
|
||||
delete network.glorytun-udp
|
||||
set network.glorytun-udp=interface
|
||||
set network.glorytun-udp.ifname=tun0
|
||||
set network.glorytun-udp.device=tun0
|
||||
set network.glorytun-udp.proto=dhcp
|
||||
set network.glorytun-udp.ip4table=vpn
|
||||
set network.glorytun-udp.multipath=off
|
||||
|
|
|
@ -82,6 +82,12 @@ return L.view.extend({
|
|||
o.rmempty = false;
|
||||
o.modalonly = true;
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'latency_tolerance', _('Latency tolerance'));
|
||||
o.default = '300';
|
||||
o.datatype = "uinteger";
|
||||
o.rmempty = false;
|
||||
o.modalonly = true;
|
||||
|
||||
return m.render();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -63,7 +63,10 @@ function multipath_bandwidth()
|
|||
local label = s["label"]
|
||||
local dev = get_device(intname)
|
||||
if dev == "" then
|
||||
dev = get_device(s["ifname"])
|
||||
dev = get_device(s["device"])
|
||||
if dev == "" then
|
||||
dev = get_device(s["ifname"])
|
||||
end
|
||||
end
|
||||
local multipath = s["multipath"] or ""
|
||||
if dev ~= "lo" and dev ~= "" then
|
||||
|
@ -207,13 +210,23 @@ function mptcp_monitor_data()
|
|||
luci.http.prepare_content("text/plain")
|
||||
local fullmesh
|
||||
fullmesh = io.popen("cat /proc/net/mptcp_net/snmp")
|
||||
if fullmesh then
|
||||
if fullmesh:read() ~= nil then
|
||||
while true do
|
||||
local ln = fullmesh:read("*l")
|
||||
if not ln then break end
|
||||
luci.http.write(ln)
|
||||
luci.http.write("\n")
|
||||
end
|
||||
else
|
||||
fullmesh = io.popen("nstat -z")
|
||||
if fullmesh then
|
||||
while true do
|
||||
local ln = fullmesh:read("*l")
|
||||
if not ln then break end
|
||||
luci.http.write(ln)
|
||||
luci.http.write("\n")
|
||||
end
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
@ -222,7 +235,7 @@ function mptcp_connections_data()
|
|||
luci.http.prepare_content("text/plain")
|
||||
local connections
|
||||
connections = io.popen("multipath -c")
|
||||
if connections then
|
||||
if connections:read() ~= nil then
|
||||
while true do
|
||||
local ln = connections:read("*l")
|
||||
if not ln then break end
|
||||
|
|
|
@ -21,56 +21,74 @@ o:value(0, translate("disable"))
|
|||
o = s:option(ListValue, "mptcp_path_manager", translate("Multipath TCP path-manager"), translate("Default is fullmesh"))
|
||||
o:value("default", translate("default"))
|
||||
o:value("fullmesh", "fullmesh")
|
||||
o:value("ndiffports", "ndiffports")
|
||||
o:value("binder", "binder")
|
||||
if uname.release:sub(1,4) ~= "4.14" then
|
||||
if uname.release:sub(1,4) ~= "5.14" then
|
||||
o:value("ndiffports", "ndiffports")
|
||||
o:value("binder", "binder")
|
||||
if uname.release:sub(1,4) ~= "4.14" then
|
||||
o:value("netlink", translate("Netlink"))
|
||||
end
|
||||
end
|
||||
o = s:option(ListValue, "mptcp_scheduler", translate("Multipath TCP scheduler"))
|
||||
o:value("default", translate("default"))
|
||||
o:value("roundrobin", "round-robin")
|
||||
o:value("redundant", "redundant")
|
||||
if uname.release:sub(1,4) ~= "4.14" then
|
||||
if uname.release:sub(1,4) ~= "5.14" then
|
||||
o:value("roundrobin", "round-robin")
|
||||
o:value("redundant", "redundant")
|
||||
if uname.release:sub(1,4) ~= "4.14" then
|
||||
o:value("blest", "BLEST")
|
||||
o:value("ecf", "ECF")
|
||||
end
|
||||
end
|
||||
if uname.release:sub(1,4) ~= "5.14" then
|
||||
o = s:option(Value, "mptcp_syn_retries", translate("Multipath TCP SYN retries"))
|
||||
o.datatype = "uinteger"
|
||||
o.rmempty = false
|
||||
end
|
||||
o = s:option(Value, "mptcp_syn_retries", translate("Multipath TCP SYN retries"))
|
||||
o.datatype = "uinteger"
|
||||
o.rmempty = false
|
||||
o = s:option(ListValue, "congestion", translate("Congestion Control"),translate("Default is cubic"))
|
||||
local availablecong = sys.exec("sysctl -n net.ipv4.tcp_available_congestion_control | xargs -n1 | sort | xargs")
|
||||
for cong in string.gmatch(availablecong, "[^%s]+") do
|
||||
o:value(cong, translate(cong))
|
||||
end
|
||||
|
||||
o = s:option(Value, "mptcp_fullmesh_num_subflows", translate("Fullmesh subflows for each pair of IP addresses"))
|
||||
o.datatype = "uinteger"
|
||||
o.rmempty = false
|
||||
o.default = 1
|
||||
--o:depends("mptcp_path_manager","fullmesh")
|
||||
if uname.release:sub(1,4) == "5.14" then
|
||||
o = s:option(Value, "mptcp_subflows", translate("specifies the maximum number of additional subflows allowed for each MPTCP connection"))
|
||||
o.datatype = "uinteger"
|
||||
o.rmempty = false
|
||||
o.default = 3
|
||||
|
||||
o = s:option(Value, "mptcp_add_addr_accepted", translate("specifies the maximum number of ADD_ADDR suboptions accepted for each MPTCP connection"))
|
||||
o.datatype = "uinteger"
|
||||
o.rmempty = false
|
||||
o.default = 1
|
||||
else
|
||||
o = s:option(Value, "mptcp_fullmesh_num_subflows", translate("Fullmesh subflows for each pair of IP addresses"))
|
||||
o.datatype = "uinteger"
|
||||
o.rmempty = false
|
||||
o.default = 1
|
||||
--o:depends("mptcp_path_manager","fullmesh")
|
||||
|
||||
o = s:option(ListValue, "mptcp_fullmesh_create_on_err", translate("Re-create fullmesh subflows after a timeout"))
|
||||
o:value(1, translate("enable"))
|
||||
o:value(0, translate("disable"))
|
||||
--o:depends("mptcp_path_manager","fullmesh")
|
||||
o = s:option(ListValue, "mptcp_fullmesh_create_on_err", translate("Re-create fullmesh subflows after a timeout"))
|
||||
o:value(1, translate("enable"))
|
||||
o:value(0, translate("disable"))
|
||||
--o:depends("mptcp_path_manager","fullmesh")
|
||||
|
||||
o = s:option(Value, "mptcp_ndiffports_num_subflows", translate("ndiffports subflows number"))
|
||||
o.datatype = "uinteger"
|
||||
o.rmempty = false
|
||||
o.default = 1
|
||||
--o:depends("mptcp_path_manager","ndiffports")
|
||||
o = s:option(Value, "mptcp_ndiffports_num_subflows", translate("ndiffports subflows number"))
|
||||
o.datatype = "uinteger"
|
||||
o.rmempty = false
|
||||
o.default = 1
|
||||
--o:depends("mptcp_path_manager","ndiffports")
|
||||
|
||||
o = s:option(ListValue, "mptcp_rr_cwnd_limited", translate("Fill the congestion window on all subflows for round robin"))
|
||||
o:value("Y", translate("enable"))
|
||||
o:value("N", translate("disable"))
|
||||
o.default = "Y"
|
||||
--o:depends("mptcp_scheduler","roundrobin")
|
||||
o = s:option(ListValue, "mptcp_rr_cwnd_limited", translate("Fill the congestion window on all subflows for round robin"))
|
||||
o:value("Y", translate("enable"))
|
||||
o:value("N", translate("disable"))
|
||||
o.default = "Y"
|
||||
--o:depends("mptcp_scheduler","roundrobin")
|
||||
|
||||
o = s:option(Value, "mptcp_rr_num_segments", translate("Consecutive segments that should be sent for round robin"))
|
||||
o.datatype = "uinteger"
|
||||
o.rmempty = false
|
||||
o.default = 1
|
||||
--o:depends("mptcp_scheduler","roundrobin")
|
||||
o = s:option(Value, "mptcp_rr_num_segments", translate("Consecutive segments that should be sent for round robin"))
|
||||
o.datatype = "uinteger"
|
||||
o.rmempty = false
|
||||
o.default = 1
|
||||
--o:depends("mptcp_scheduler","roundrobin")
|
||||
end
|
||||
|
||||
s = m:section(TypedSection, "interface", translate("Interfaces Settings"))
|
||||
o = s:option(ListValue, "multipath", translate("Multipath TCP"), translate("One interface must be set as master"))
|
||||
|
|
|
@ -238,8 +238,8 @@
|
|||
labelup_25.parentNode.appendChild(textup);
|
||||
}
|
||||
|
||||
labeldn_scale.innerHTML = String.format('<%:(%d minutes window, %d seconds interval)%>', 3, data_wanted / 60);
|
||||
labelup_scale.innerHTML = String.format('<%:(%d minutes window, %d seconds interval)%>', 3, data_wanted / 60);
|
||||
labeldn_scale.innerHTML = String.format('<%:(%d minutes window, %d seconds interval)%>', 4, data_wanted / 60);
|
||||
labelup_scale.innerHTML = String.format('<%:(%d minutes window, %d seconds interval)%>', 4, data_wanted / 60);
|
||||
|
||||
/* render datasets, start update interval */
|
||||
XHR.poll(3, '<%=build_url(bandwidthtotalurl, all)%>', null,
|
||||
|
|
|
@ -100,12 +100,14 @@ _bypass_domain() {
|
|||
fi
|
||||
if [ "$(uci -q get dhcp.@dnsmasq[0].ipset | grep /$domain/)" = "" ]; then
|
||||
uci -q add_list dhcp.@dnsmasq[0].ipset="/$domain/omr_dst_bypass_$intf,omr6_dst_bypass_$intf"
|
||||
add_domains="true"
|
||||
else
|
||||
dnsmasqipset=$(uci -q get dhcp.@dnsmasq[0].ipset | sed 's/ /\n/g')
|
||||
for dnsipset in $dnsmasqipset; do
|
||||
if [ "$(echo $dnsipset | cut -d/ -f2)" = "$domain" ]; then
|
||||
uci -q del_list dhcp.@dnsmasq[0].ipset=$dnsipset
|
||||
uci -q add_list dhcp.@dnsmasq[0].ipset="$dnsipset,omr_dst_bypass_$intf,omr6_dst_bypass_$intf"
|
||||
add_domains="true"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
@ -502,8 +504,8 @@ _intf_rule_v2ray_rules() {
|
|||
_intf_rule() {
|
||||
local intf
|
||||
intf=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$intf" ] && config_get intf $1 ifname
|
||||
[ -n "$(echo $intf | grep '@')" ] && intf=$(ifstatus "$1" | jsonfilter -q -e '@["device"]')
|
||||
[ -z "$intf" ] && config_get intf $1 device
|
||||
#count=$((count+1))
|
||||
config_get count $1 metric
|
||||
local mode
|
||||
|
@ -537,7 +539,7 @@ _intf_rule() {
|
|||
EOF
|
||||
else
|
||||
ip rule add prio 1 fwmark 0x539$count lookup $count pref 1 > /dev/null 2>&1
|
||||
ip -6 rule add prio 1 fwmark 0x6539$count lookup 6$count > /dev/null 2>&1
|
||||
ip -6 rule add prio 1 fwmark 0x6539$count lookup 6$count pref 1 > /dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
if [ "$(iptables-save | grep omr-bypass | grep omr_dst_bypass_$intf)" = "" ]; then
|
||||
|
@ -680,6 +682,7 @@ boot() {
|
|||
start_service() {
|
||||
#local count
|
||||
logger -t "omr-bypass" "Starting OMR-ByPass..."
|
||||
add_domains="false"
|
||||
config_load omr-bypass
|
||||
config_foreach _add_proto proto
|
||||
disableipv6="$(uci -q get openmptcprouter.settings.disable_ipv6)"
|
||||
|
@ -797,11 +800,11 @@ start_service() {
|
|||
config_foreach _bypass_proto dpis
|
||||
uci -q commit omr-bypass
|
||||
|
||||
[ -z "$RELOAD" ] && {
|
||||
[ -z "$RELOAD" ] && [ "$add_domains" = "true" ] && {
|
||||
logger -t "omr-bypass" "Restart dnsmasq..."
|
||||
/etc/init.d/dnsmasq restart
|
||||
}
|
||||
[ -n "$RELOAD" ] && {
|
||||
[ -n "$RELOAD" ] && [ "$add_domains" = "true" ] && {
|
||||
logger -t "omr-bypass" "Reload dnsmasq..."
|
||||
/etc/init.d/dnsmasq reload
|
||||
}
|
||||
|
|
|
@ -19,10 +19,10 @@ config_get lan_device lan ifname
|
|||
config_load dscp
|
||||
|
||||
_ipt4() {
|
||||
iptables -w -t mangle "$@"
|
||||
iptables -w -t mangle "$@" 2>&1 >/dev/null
|
||||
}
|
||||
_ipt6() {
|
||||
ip6tables -w -t mangle "$@"
|
||||
ip6tables -w -t mangle "$@" >/dev/null
|
||||
}
|
||||
|
||||
_add_dscp_rule() {
|
||||
|
|
|
@ -26,7 +26,11 @@ end
|
|||
function interface_from_device(dev)
|
||||
for _, iface in ipairs(net:get_networks()) do
|
||||
local ifacen = iface:name()
|
||||
local ifacename = ucic:get("network",ifacen,"ifname")
|
||||
local ifacename = ""
|
||||
ifacename = ucic:get("network",ifacen,"device")
|
||||
if ifacename == "" then
|
||||
ifacename = ucic:get("network",ifacen,"ifname")
|
||||
end
|
||||
if ifacename == dev then
|
||||
return ifacen
|
||||
end
|
||||
|
@ -34,6 +38,17 @@ function interface_from_device(dev)
|
|||
return ""
|
||||
end
|
||||
|
||||
function uci_device_from_interface(intf)
|
||||
intfname = ucic:get("network",intf,"device")
|
||||
deviceuci = ""
|
||||
ucic:foreach("network", "device", function(s)
|
||||
if intfname == ucic:get("network",s[".name"],"name") then
|
||||
deviceuci = s[".name"]
|
||||
end
|
||||
end)
|
||||
return deviceuci
|
||||
end
|
||||
|
||||
function wizard_add()
|
||||
local gostatus = true
|
||||
|
||||
|
@ -113,7 +128,10 @@ function wizard_add()
|
|||
end)
|
||||
local defif = "eth0"
|
||||
if add_interface_ifname == "" then
|
||||
local defif1 = ucic:get("network","wan1_dev","ifname") or ""
|
||||
local defif1 = ucic:get("network","wan1_dev","device") or ""
|
||||
if defif1 == "" then
|
||||
defif1 = ucic:get("network","wan1_dev","ifname") or ""
|
||||
end
|
||||
if defif1 ~= "" then
|
||||
defif = defif1
|
||||
end
|
||||
|
@ -126,17 +144,29 @@ function wizard_add()
|
|||
if ointf ~= "" then
|
||||
if ucic:get("network",ointf,"type") == "" then
|
||||
ucic:set("network",ointf,"type","macvlan")
|
||||
ucic:set("network",ointf,"device",ointf)
|
||||
ucic:set("network",ointf .. "_dev","device")
|
||||
ucic:set("network",ointf .. "_dev","type","macvlan")
|
||||
ucic:set("network",ointf .. "_dev","mode","vepa")
|
||||
ucic:set("network",ointf .. "_dev","ifname",defif)
|
||||
ucic:set("network",ointf .. "_dev","name",ointf)
|
||||
end
|
||||
wanif = "wan" .. i
|
||||
end
|
||||
|
||||
ucic:set("network","wan" .. i,"interface")
|
||||
ucic:set("network","wan" .. i,"ifname",defif)
|
||||
ucic:set("network","wan" .. i,"device",defif)
|
||||
ucic:set("network","wan" .. i,"proto","static")
|
||||
ucic:set("openmptcprouter","wan" .. i,"interface")
|
||||
if ointf ~= "" then
|
||||
ucic:set("network","wan" .. i,"type","macvlan")
|
||||
ucic:set("network","wan" .. i,"device","wan" .. i)
|
||||
ucic:set("network","wan" .. i,"masterintf",defif)
|
||||
ucic:set("network","wan" .. i .. "_dev","device")
|
||||
ucic:set("network","wan" .. i .. "_dev","type","macvlan")
|
||||
ucic:set("network","wan" .. i .. "_dev","mode","vepa")
|
||||
ucic:set("network","wan" .. i .. "_dev","ifname",defif)
|
||||
ucic:set("network","wan" .. i .. "_dev","name","wan" .. i)
|
||||
end
|
||||
ucic:set("network","wan" .. i,"ip4table","wan")
|
||||
if multipath_master then
|
||||
|
@ -171,7 +201,7 @@ function wizard_add()
|
|||
ucic:set("sqm","wan" .. i,"script","simple.qos")
|
||||
ucic:set("sqm","wan" .. i,"qdisc_advanced","0")
|
||||
ucic:set("sqm","wan" .. i,"linklayer","none")
|
||||
ucic:set("sqm","wan" .. i,"enabled","0")
|
||||
ucic:set("sqm","wan" .. i,"enabled","1")
|
||||
ucic:set("sqm","wan" .. i,"debug_logging","0")
|
||||
ucic:set("sqm","wan" .. i,"verbosity","5")
|
||||
ucic:set("sqm","wan" .. i,"download","0")
|
||||
|
@ -197,7 +227,10 @@ function wizard_add()
|
|||
local delete_intf = luci.http.formvaluetable("delete") or ""
|
||||
if delete_intf ~= "" then
|
||||
for intf, _ in pairs(delete_intf) do
|
||||
local defif = ucic:get("network",intf,"ifname")
|
||||
local defif = ucic:get("network",intf,"ifname") or ""
|
||||
if defif == "" then
|
||||
defif = ucic:get("network",intf,"ifname")
|
||||
end
|
||||
ucic:delete("network",intf)
|
||||
if ucic:get("network",intf .. "_dev") ~= "" then
|
||||
ucic:delete("network",intf .. "_dev")
|
||||
|
@ -251,6 +284,7 @@ function wizard_add()
|
|||
local sqmenabled = luci.http.formvalue("cbid.sqm.%s.enabled" % intf) or "0"
|
||||
local multipath = luci.http.formvalue("cbid.network.%s.multipath" % intf) or "on"
|
||||
local lan = luci.http.formvalue("cbid.network.%s.lan" % intf) or "0"
|
||||
local ttl = luci.http.formvalue("cbid.network.%s.ttl" % intf) or ""
|
||||
if typeintf ~= "" then
|
||||
if typeintf == "normal" then
|
||||
typeintf = ""
|
||||
|
@ -262,15 +296,42 @@ function wizard_add()
|
|||
end
|
||||
if typeintf == "macvlan" and masterintf ~= "" then
|
||||
ucic:set("network",intf,"type","macvlan")
|
||||
ucic:set("network",intf .. "_dev","device")
|
||||
ucic:set("network",intf .. "_dev","type","macvlan")
|
||||
ucic:set("network",intf .. "_dev","ifname",masterinf)
|
||||
ucic:set("network",intf .. "_dev","mode","vepa")
|
||||
ucic:set("network",intf .. "_dev","name",intf)
|
||||
ucic:set("network",intf,"masterintf",masterintf)
|
||||
elseif typeintf == "" and ifname ~= "" and (proto == "static" or proto == "dhcp" or proto == "dhcpv6") then
|
||||
ucic:set("network",intf,"ifname",ifname)
|
||||
ucic:set("network",intf,"device",ifname)
|
||||
if uci_device_from_interface(intf) == "" then
|
||||
ucic:set("network",intf .. "_dev","device")
|
||||
ucic:set("network",intf .. "_dev","name",ifname)
|
||||
end
|
||||
elseif typeintf == "" and device ~= "" and proto == "ncm" then
|
||||
ucic:set("network",intf,"device",device_ncm)
|
||||
if uci_device_from_interface(intf) == "" then
|
||||
ucic:set("network",intf .. "_dev","device")
|
||||
ucic:set("network",intf .. "_dev","name",device_ncm)
|
||||
end
|
||||
elseif typeintf == "" and device ~= "" and proto == "qmi" then
|
||||
ucic:set("network",intf,"device",device_qmi)
|
||||
if uci_device_from_interface(intf) == "" then
|
||||
ucic:set("network",intf .. "_dev","device")
|
||||
ucic:set("network",intf .. "_dev","name",device_qmi)
|
||||
end
|
||||
elseif typeintf == "" and device ~= "" and proto == "modemmanager" then
|
||||
ucic:set("network",intf,"device",device_manager)
|
||||
if uci_device_from_interface(intf) == "" then
|
||||
ucic:set("network",intf .. "_dev","device")
|
||||
ucic:set("network",intf .. "_dev","name",device_manager)
|
||||
end
|
||||
elseif typeintf == "" and ifname ~= "" and proto == "static" then
|
||||
ucic:set("network",intf,"device",ifname)
|
||||
if uci_device_from_interface(intf) == "" then
|
||||
ucic:set("network",intf .. "_dev","device")
|
||||
ucic:set("network",intf .. "_dev","name",ifname)
|
||||
end
|
||||
end
|
||||
if proto == "pppoe" then
|
||||
ucic:set("network",intf,"pppd_options","persist maxfail 0")
|
||||
|
@ -278,6 +339,13 @@ function wizard_add()
|
|||
if proto ~= "other" then
|
||||
ucic:set("network",intf,"proto",proto)
|
||||
end
|
||||
|
||||
uci_device = uci_device_from_interface(intf)
|
||||
if uci_device == "" then
|
||||
uci_device = intf .. "_dev"
|
||||
end
|
||||
ucic:set("network",uci_device,"ttl",ttl)
|
||||
|
||||
ucic:set("network",intf,"apn",apn)
|
||||
ucic:set("network",intf,"pincode",pincode)
|
||||
ucic:set("network",intf,"delay",delay)
|
||||
|
@ -342,7 +410,10 @@ function wizard_add()
|
|||
if not ucic:get("sqm",intf) ~= "" then
|
||||
local defif = get_device(intf)
|
||||
if defif == "" then
|
||||
defif = ucic:get("network",intf,"ifname") or ""
|
||||
defif = ucic:get("network",intf,"device") or ""
|
||||
if defif == "" then
|
||||
defif = ucic:get("network",intf,"ifname") or ""
|
||||
end
|
||||
end
|
||||
ucic:set("sqm",intf,"queue")
|
||||
ucic:set("sqm",intf,"interface",defif)
|
||||
|
@ -442,7 +513,7 @@ function wizard_add()
|
|||
ucic:set("network","omrvpn","proto","bonding")
|
||||
end
|
||||
if vpn_intf ~= "" then
|
||||
ucic:set("network","omrvpn","ifname",vpn_intf)
|
||||
ucic:set("network","omrvpn","device",vpn_intf)
|
||||
ucic:set("sqm","omrvpn","interface",vpn_intf)
|
||||
ucic:save("network")
|
||||
ucic:commit("network")
|
||||
|
@ -809,7 +880,7 @@ function wizard_add()
|
|||
|
||||
local dsvpn_key = luci.http.formvalue("dsvpn_key")
|
||||
if dsvpn_key ~= "" then
|
||||
ucic:set("dsvpn","vpn","port","65011")
|
||||
ucic:set("dsvpn","vpn","port","65401")
|
||||
ucic:set("dsvpn","vpn","key",dsvpn_key)
|
||||
ucic:set("dsvpn","vpn","localip","10.255.251.2")
|
||||
ucic:set("dsvpn","vpn","remoteip","10.255.251.1")
|
||||
|
@ -894,7 +965,7 @@ function wizard_add()
|
|||
-- Restart all
|
||||
menuentry = ucic:get("openmptcprouter","settings","menu") or "openmptcprouter"
|
||||
if gostatus == true then
|
||||
luci.sys.call("/etc/init.d/macvlan restart >/dev/null 2>/dev/null")
|
||||
--luci.sys.call("/etc/init.d/macvlan restart >/dev/null 2>/dev/null")
|
||||
luci.sys.call("(env -i /bin/ubus call network reload) >/dev/null 2>/dev/null")
|
||||
luci.sys.call("ip addr flush dev tun0 >/dev/null 2>/dev/null")
|
||||
luci.sys.call("/etc/init.d/omr-tracker stop >/dev/null 2>/dev/null")
|
||||
|
|
|
@ -473,7 +473,7 @@
|
|||
if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea == "mlvpn0" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*") or ifacea:match("^erspan.*") or ifacea:match("^tun.*") or ifacea:match("^bond.*")) and device_notvirtual(ifacea) then
|
||||
if uci:get("network",ifname,"proto") ~= "macvlan" then
|
||||
%>
|
||||
<option value="<%=ifacea%>"<% if uci:get("network",ifname,"ifname") == ifacea then iffind = 1 %> selected="selected"<% end %>><%=ifacea%></option>
|
||||
<option value="<%=ifacea%>"<% if uci:get("network",ifname,"device") == ifacea then iffind = 1 %> selected="selected"<% end %>><%=ifacea%></option>
|
||||
<%
|
||||
else
|
||||
%>
|
||||
|
@ -483,9 +483,9 @@
|
|||
end
|
||||
end
|
||||
if uci:get("network",ifname,"proto") ~= "macvlan" then
|
||||
if iffind == 0 and uci:get("network",ifname,"ifname") ~= nil then
|
||||
if iffind == 0 and uci:get("network",ifname,"device") ~= nil then
|
||||
%>
|
||||
<option value="<%=uci:get("network",ifname,"ifname")%>" selected="selected"><%=uci:get("network",ifname,"ifname")%></option>
|
||||
<option value="<%=uci:get("network",ifname,"device")%>" selected="selected"><%=uci:get("network",ifname,"device")%></option>
|
||||
<%
|
||||
end
|
||||
else
|
||||
|
@ -616,7 +616,7 @@
|
|||
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.intf" name="cbid.network.<%=ifname%>.intf" size="1">
|
||||
<%
|
||||
iffind=0
|
||||
uciifname=uci:get("network",ifname,"ifname")
|
||||
uciifname=uci:get("network",ifname,"device")
|
||||
if uciifname ~= nil then
|
||||
if uciifname:match("/") then
|
||||
realifname=uciifname
|
||||
|
@ -682,7 +682,7 @@
|
|||
<div class="cbi-value" id="cbi-network-<%=ifname%>-ipv6address" data-index="8">
|
||||
<label class="cbi-value-title"><%:IPv6 address%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" id="cbid.network.<%=ifname%>.ip6addr" name="cbid.network.<%=ifname%>.ip6addr" class="cbi-input-text" value="<%=value%>" data-type="ip6addr">
|
||||
<input type="text" id="cbid.network.<%=ifname%>.ip6addr" name="cbid.network.<%=ifname%>.ip6addr" class="cbi-input-text" value="<%=value%>" data-type="ip6addr" data-optional="true">
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Set an IP in the same network as the modem%>
|
||||
|
@ -696,7 +696,7 @@
|
|||
<div class="cbi-value" id="cbi-network-<%=ifname%>-ip6gw" data-index="9">
|
||||
<label class="cbi-value-title"><%:IPv6 gateway%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" id="cbid.network.<%=ifname%>.ip6gw" name="cbid.network.<%=ifname%>.ip6gw" class="cbi-input-text" value="<%=uci:get("network",ifname,"ip6gw")%>" data-type="ip6addr">
|
||||
<input type="text" id="cbid.network.<%=ifname%>.ip6gw" name="cbid.network.<%=ifname%>.ip6gw" class="cbi-input-text" value="<%=uci:get("network",ifname,"ip6gw")%>" data-type="ip6addr" data-optional="true">
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Set here IP of the modem%>
|
||||
|
@ -893,6 +893,16 @@
|
|||
<%
|
||||
end
|
||||
%>
|
||||
<div class="cbi-value" data-index="14">
|
||||
<label class="cbi-value-title"><%:Force TTL%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="cbid.network.<%=ifname%>.ttl" class="cbi-input-text" value="<%=ttl%>" data-type="uinteger" data-optional="true">
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:You can force a TTL. Some LTE provider detect tethering by inpecting packet TTL value, setting it to 65 often solve the issue.%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%
|
||||
local download = "0"
|
||||
|
@ -909,7 +919,7 @@
|
|||
-- end
|
||||
--end
|
||||
%>
|
||||
<div class="cbi-value" data-index="14">
|
||||
<div class="cbi-value" data-index="15">
|
||||
<label class="cbi-value-title"><%:MPTCP over VPN%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input class="cbi-input-checkbox" type="checkbox" name="multipathvpn.<%=ifname%>.enabled" value="1" <% if uci:get("openmptcprouter",ifname,"multipathvpn") == "1" then %>checked<% end %> />
|
||||
|
@ -919,7 +929,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" data-index="15">
|
||||
<div class="cbi-value" data-index="16">
|
||||
<label class="cbi-value-title"><%:Enable SQM%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input class="cbi-input-checkbox" type="checkbox" name="cbid.sqm.<%=ifname%>.enabled" value="1" <% if uci:get("sqm",ifname,"enabled") == "1" then %>checked<% end %> />
|
||||
|
@ -929,7 +939,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" data-index="16">
|
||||
<div class="cbi-value" data-index="17">
|
||||
<label class="cbi-value-title"><%:Download speed (Kb/s)%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="cbid.sqm.<%=ifname%>.download" class="cbi-input-text" value="<%=download%>" data-type="uinteger">
|
||||
|
@ -945,7 +955,7 @@
|
|||
-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" data-index="17">
|
||||
<div class="cbi-value" data-index="18">
|
||||
<label class="cbi-value-title"><%:Upload speed (Kb/s)%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="cbid.sqm.<%=ifname%>.upload" class="cbi-input-text" value="<%=upload%>" data-type="uinteger">
|
||||
|
|
|
@ -12,9 +12,17 @@ get_mptcp_from_server() {
|
|||
get_mptcp() {
|
||||
serverip=$1
|
||||
if [ "$(echo $serverip | grep :)" ]; then
|
||||
support="$(curl -s -k -6 -m ${timeout} --interface $intf https://[$serverip]:$serverport/mptcpsupport)"
|
||||
if [ -f /proc/sys/net/mptcp/enabled ]; then
|
||||
support="$(mptcpize run curl -s -k -6 -m ${timeout} --interface $intf https://[$serverip]:$serverport/mptcpsupport)"
|
||||
else
|
||||
support="$(curl -s -k -6 -m ${timeout} --interface $intf https://[$serverip]:$serverport/mptcpsupport)"
|
||||
fi
|
||||
else
|
||||
support="$(curl -s -k -4 -m ${timeout} --interface $intf https://$serverip:$serverport/mptcpsupport)"
|
||||
if [ -f /proc/sys/net/mptcp/enabled ]; then
|
||||
support="$(mptcpize run curl -s -k -4 -m ${timeout} --interface $intf https://$serverip:$serverport/mptcpsupport)"
|
||||
else
|
||||
support="$(curl -s -k -4 -m ${timeout} --interface $intf https://$serverip:$serverport/mptcpsupport)"
|
||||
fi
|
||||
fi
|
||||
[ -n "$support" ] && {
|
||||
support=$(echo $support | jsonfilter -e '@.mptcp')
|
||||
|
@ -56,8 +64,10 @@ get_mptcp_from_website6() {
|
|||
support=""
|
||||
config_load openmptcprouter
|
||||
config_foreach get_mptcp_from_server server
|
||||
[ -z "$support" ] && [ -n "$(ip -4 a show dev $intf)" ] && get_mptcp_from_website
|
||||
[ -z "$support" ] && [ -n "$(ip -6 a show dev $intf)" ] && get_mptcp_from_website6
|
||||
if [ ! -f /proc/sys/net/mptcp/enabled ] && [ -z "$support" ]; then
|
||||
[ -n "$(ip -4 a show dev $intf)" ] && get_mptcp_from_website
|
||||
[ -n "$(ip -6 a show dev $intf)" ] && get_mptcp_from_website6
|
||||
fi
|
||||
if [ "$support" = "working" ]; then
|
||||
echo "MPTCP enabled"
|
||||
elif [ "$support" = "not working" ]; then
|
||||
|
|
0
luci-app-openmptcprouter/root/etc/hotplug.d/net/99-omr-rename
Normal file → Executable file
0
luci-app-openmptcprouter/root/etc/hotplug.d/net/99-omr-rename
Normal file → Executable file
|
@ -6,6 +6,8 @@ START=5
|
|||
|
||||
USE_PROCD=1
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
||||
omr_intf_del() {
|
||||
[ -z "$1" ] && return
|
||||
uci -q delete openmptcprouter.$1
|
||||
|
@ -18,11 +20,14 @@ omr_intf_check() {
|
|||
omr_intf_set() {
|
||||
local device
|
||||
local ifname
|
||||
config_get device "$1" device
|
||||
config_get type "$1" type
|
||||
|
||||
ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
|
||||
network_get_device ifname $1
|
||||
[ -z "$ifname" ] && network_get_physdev ifname $1
|
||||
[ -z "$ifname" ] && config_get ifname "$1" device
|
||||
[ -z "$ifname" ] && config_get ifname "$1" ifname
|
||||
[ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
|
||||
#config_get devicename "$1" _modem_device
|
||||
devicename=${ifname}
|
||||
config_get type "$1" type
|
||||
|
||||
if [ "$type" != "macvlan" ] && [ -n "$ifname" ] && [ -f /sys/class/net/${ifname}/device/uevent ]; then
|
||||
devicepath=$(readlink -f /sys/class/net/${ifname})
|
||||
|
@ -38,7 +43,7 @@ omr_intf_set() {
|
|||
uci -q delete network.$1.modalias
|
||||
uci -q delete network.$1.product
|
||||
fi
|
||||
elif [ "$type" != "macvlan" ] && [ -n "$device" ] && [ -f /sys/bus/usb-serial/devices/${devicename}/device/uevent ] && [ "$(cat /sys/class/net/${ifname}/device/uevent | grep PRODUCT)" != "" ]; then
|
||||
elif [ "$type" != "macvlan" ] && [ -n "$devicename" ] && [ -f /sys/bus/usb-serial/devices/${devicename}/device/uevent ] && [ "$(cat /sys/class/net/${ifname}/device/uevent | grep PRODUCT)" != "" ]; then
|
||||
mac=""
|
||||
if [ -f /sys/class/net/${ifname}/address ]; then
|
||||
mac="$(cat /sys/class/net/${ifname}/address | tr -d '\n')"
|
||||
|
@ -56,6 +61,10 @@ omr_set_settings() {
|
|||
local ifname
|
||||
local multipath
|
||||
config_get multipath "$1" multipath
|
||||
network_get_device ifname $1
|
||||
[ -z "$ifname" ] && network_get_physdev ifname $1
|
||||
[ -z "$ifname" ] && config_get ifname "$1" device
|
||||
[ -z "$ifname" ] && config_get ifname "$1" ifname
|
||||
config_get device "$1" device
|
||||
config_get proto "$1" proto
|
||||
config_get type "$1" type
|
||||
|
@ -144,15 +153,13 @@ start_service() {
|
|||
del_list dhcp.@dnsmasq[0].server='127.0.0.1#5353'
|
||||
add_list dhcp.@dnsmasq[0].server='114.114.114.114'
|
||||
set dhcp.@dnsmasq[0].dnsseccheckunsigned='0'
|
||||
delete dhcp.@dnsmasq[0].dnssec='1'
|
||||
delete dhcp.@dnsmasq[0].dnssec
|
||||
commit dhcp
|
||||
EOF
|
||||
elif [ "$(uci -q get openmptcprouter.settings.country)" = "world" ] && [ -n "$(uci -q get dhcp.@dnsmasq[0].server | grep '114.114.114.114')" ]; then
|
||||
uci -q batch <<-EOF > /dev/null
|
||||
add_list dhcp.@dnsmasq[0].server='127.0.0.1#5353'
|
||||
del_list dhcp.@dnsmasq[0].server='114.114.114.114'
|
||||
set dhcp.@dnsmasq[0].dnsseccheckunsigned='1'
|
||||
set dhcp.@dnsmasq[0].dnssec='1'
|
||||
commit dhcp
|
||||
EOF
|
||||
fi
|
||||
|
|
|
@ -11,7 +11,7 @@ local jsonc = require "luci.jsonc"
|
|||
function interface_from_device(dev)
|
||||
for _, iface in ipairs(net:get_networks()) do
|
||||
local ifacen = iface:name()
|
||||
local ifacename = ucic:get("network",ifacen,"ifname")
|
||||
local ifacename = ucic:get("network",ifacen,"device")
|
||||
if ifacename == dev then
|
||||
return ifacen
|
||||
end
|
||||
|
@ -72,7 +72,7 @@ function add_interface(add_interface_ifname)
|
|||
end
|
||||
|
||||
ucic:set("network","wan" .. i,"interface")
|
||||
ucic:set("network","wan" .. i,"ifname",defif)
|
||||
ucic:set("network","wan" .. i,"device",defif)
|
||||
ucic:set("network","wan" .. i,"proto","static")
|
||||
if ointf ~= "" then
|
||||
ucic:set("network","wan" .. i,"type","macvlan")
|
||||
|
@ -128,7 +128,7 @@ end
|
|||
|
||||
function remove_interface(intf)
|
||||
-- Remove existing interface
|
||||
local defif = ucic:get("network",intf,"ifname")
|
||||
local defif = ucic:get("network",intf,"device")
|
||||
ucic:delete("network",intf)
|
||||
ucic:delete("network",intf .. "_dev")
|
||||
ucic:save("network")
|
||||
|
@ -170,7 +170,7 @@ function set_interface(intf,proto,ipaddr,netmask,gateway,sqmenabled,downloadspee
|
|||
if not ucic:get("sqm",intf) ~= "" then
|
||||
local defif = get_device(intf)
|
||||
if defif == "" then
|
||||
defif = ucic:get("network",intf,"ifname") or ""
|
||||
defif = ucic:get("network",intf,"device") or ""
|
||||
end
|
||||
ucic:set("sqm",intf,"queue")
|
||||
ucic:set("sqm",intf,"interface",defif)
|
||||
|
@ -268,7 +268,7 @@ function default_vpn(default_vpn)
|
|||
ucic:set("network","omrvpn","proto","dhcp")
|
||||
end
|
||||
if vpn_intf ~= "" then
|
||||
ucic:set("network","omrvpn","ifname",vpn_intf)
|
||||
ucic:set("network","omrvpn","device",vpn_intf)
|
||||
ucic:save("network")
|
||||
ucic:commit("network")
|
||||
end
|
||||
|
@ -824,7 +824,7 @@ function interfaces_status()
|
|||
if mArray.openmptcprouter["external_check"] ~= false then
|
||||
mArray.openmptcprouter["proxy_addr"] = ut.trim(sys.exec("curl -s -4 --socks5 " .. tracker_ip .. ":" .. tracker_port .. " -m " .. timeout .. " " .. check_ipv4_website))
|
||||
if mArray.openmptcprouter["proxy_addr"] == "" then
|
||||
mArray.openmptcprouter["proxy_addr"] = ut.trim(sys.exec("curl -s -4 --socks5 " .. tracker_ip .. ":" .. tracker_port .. " -m " .. timeout .. " ifconfig.co"))
|
||||
mArray.openmptcprouter["proxy_addr"] = ut.trim(sys.exec("curl -s -4 --socks5 " .. tracker_ip .. ":" .. tracker_port .. " -m " .. timeout .. " ifconfig.me"))
|
||||
end
|
||||
--mArray.openmptcprouter["ss_addr6"] = sys.exec("curl -s -6 --socks5 " .. tracker_ip .. ":" .. tracker_port .. " -m 3 http://ipv6.openmptcprouter.com")
|
||||
end
|
||||
|
@ -961,7 +961,10 @@ function interfaces_status()
|
|||
if string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?glorytun(-udp)?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?dsvpn?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?mlvpn?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?openvpn?$'"), "%d+") then
|
||||
mArray.openmptcprouter["tun_service"] = true
|
||||
mArray.openmptcprouter["tun_ip"] = get_ip("omrvpn")
|
||||
local tun_dev = uci:get("network","omrvpn","ifname")
|
||||
local tun_dev = uci:get("network","omrvpn","device")
|
||||
if tun_dev == "" then
|
||||
tun_dev = uci:get("network","omrvpn","ifname")
|
||||
end
|
||||
if tun_dev == "" then
|
||||
tun_dev = get_device("omrvpn")
|
||||
end
|
||||
|
@ -1139,14 +1142,14 @@ function interfaces_status()
|
|||
|
||||
local ifname = get_device(interface)
|
||||
if ifname == "" or ifname == nil then
|
||||
ifname = section["ifname"] or ""
|
||||
ifname = section["device"] or ""
|
||||
end
|
||||
--if ifname ~= nil and ifname:match("^tun.*") and interface:match("^ovpn.*") then
|
||||
--ifname = get_device(interface:sub(5))
|
||||
--end
|
||||
|
||||
duplicateif = false
|
||||
if ifname ~= "" and ifname ~= nil and not (section["ifname"] ~= nil and section["ifname"]:match("^@.*")) then
|
||||
if ifname ~= "" and ifname ~= nil and not (section["device"] ~= nil and section["device"]:match("^@.*")) then
|
||||
if allintf[ifname] then
|
||||
connectivity = "ERROR"
|
||||
duplicateif = true
|
||||
|
@ -1156,7 +1159,7 @@ function interfaces_status()
|
|||
end
|
||||
|
||||
duplicatemac = false
|
||||
if mac ~= "" and mac ~= nil and not (section["ifname"] ~= nil and section["ifname"]:match("^@.*")) and not (ifname ~= nil and ifname:match("%.")) then
|
||||
if mac ~= "" and mac ~= nil and not (section["device"] ~= nil and section["device"]:match("^@.*")) and not (ifname ~= nil and ifname:match("%.")) then
|
||||
if allmac[mac] then
|
||||
connectivity = "ERROR"
|
||||
duplicatemac = true
|
||||
|
@ -1371,7 +1374,8 @@ function interfaces_status()
|
|||
if adminport == "" then
|
||||
adminport = "65500"
|
||||
end
|
||||
if server_ping == "UP" and uci:get("openmptcprouter", "settings", "disableserverhttptest") ~= "1" and ipaddr ~= "" and adminport ~= "" then
|
||||
-- httping disable for now, with -l (ssl) timeout is ignored
|
||||
if false and server_ping == "UP" and uci:get("openmptcprouter", "settings", "disableserverhttptest") ~= "1" and ipaddr ~= "" and adminport ~= "" then
|
||||
local server_http_result = ""
|
||||
local server_http_test = ""
|
||||
if mArray.openmptcprouter["service_addr_ip"] ~= "" then
|
||||
|
|
|
@ -164,7 +164,7 @@ function upgrade_check() {
|
|||
hide("#status_box");
|
||||
hide("#server_div");
|
||||
set_status("info", _("Searching for upgrades"), true);
|
||||
fetch(data.url + "/api/versions")
|
||||
fetch(data.url + "/api/versions?v=" + Date.now())
|
||||
.then(response => response.json())
|
||||
.then(response => {
|
||||
var branches = response["branches"]
|
||||
|
@ -348,7 +348,7 @@ function download_image() {
|
|||
}
|
||||
|
||||
function server_request() {
|
||||
fetch(data.url + "/api/build", {
|
||||
fetch(data.url + "/api/build?v=" + Date.now(), {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
|
|
|
@ -371,7 +371,7 @@ return baseclass.extend({
|
|||
|
||||
release: {
|
||||
title: _('Firmware Version'),
|
||||
value: (typeof boardinfo.release.description !== "undefined") ? boardinfo.release.description : null
|
||||
value: (typeof boardinfo.release !== "undefined") ? ((typeof boardinfo.release.description !== "undefined") ? boardinfo.release.description : null) : null
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#
|
||||
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
|
||||
# Copyright (C) 2020 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
||||
# Copyright (C) 2020-2021 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
# From https://github.com/openwrt/luci/commit/f5c04e1a2e173f536597f220db0380cc08869e8e
|
||||
# From https://github.com/openwrt/luci/commit/b88157e69a060ade618e48b30947729310935d61
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
|
|
917
luci-mod-network/htdocs/luci-static/resources/tools/network.js
Normal file
917
luci-mod-network/htdocs/luci-static/resources/tools/network.js
Normal file
|
@ -0,0 +1,917 @@
|
|||
'use strict';
|
||||
'require ui';
|
||||
'require dom';
|
||||
'require uci';
|
||||
'require form';
|
||||
'require network';
|
||||
'require baseclass';
|
||||
'require validation';
|
||||
'require tools.widgets as widgets';
|
||||
|
||||
function validateAddr(section_id, value) {
|
||||
if (value == '')
|
||||
return true;
|
||||
|
||||
var ipv6 = /6$/.test(this.section.formvalue(section_id, 'mode')),
|
||||
addr = ipv6 ? validation.parseIPv6(value) : validation.parseIPv4(value);
|
||||
|
||||
return addr ? true : (ipv6 ? _('Expecting a valid IPv6 address') : _('Expecting a valid IPv4 address'));
|
||||
}
|
||||
|
||||
function validateQoSMap(section_id, value) {
|
||||
if (value == '')
|
||||
return true;
|
||||
|
||||
var m = value.match(/^(\d+):(\d+)$/);
|
||||
|
||||
if (!m || +m[1] > 0xFFFFFFFF || +m[2] > 0xFFFFFFFF)
|
||||
return _('Expecting two priority values separated by a colon');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function deviceSectionExists(section_id, devname) {
|
||||
var exists = false;
|
||||
|
||||
uci.sections('network', 'device', function(ss) {
|
||||
exists = exists || (
|
||||
ss['.name'] != section_id &&
|
||||
ss.name == devname
|
||||
);
|
||||
});
|
||||
|
||||
return exists;
|
||||
}
|
||||
|
||||
function isBridgePort(dev) {
|
||||
if (!dev)
|
||||
return false;
|
||||
|
||||
if (dev.isBridgePort())
|
||||
return true;
|
||||
|
||||
var isPort = false;
|
||||
|
||||
uci.sections('network', null, function(s) {
|
||||
if (s['.type'] != 'interface' && s['.type'] != 'device')
|
||||
return;
|
||||
|
||||
if (s.type == 'bridge' && L.toArray(s.ifname).indexOf(dev.getName()) > -1)
|
||||
isPort = true;
|
||||
});
|
||||
|
||||
return isPort;
|
||||
}
|
||||
|
||||
function updateDevBadge(node, dev) {
|
||||
var type = dev.getType(),
|
||||
up = dev.getCarrier();
|
||||
|
||||
dom.content(node, [
|
||||
E('img', {
|
||||
'class': 'middle',
|
||||
'src': L.resource('icons/%s%s.png').format(type, up ? '' : '_disabled')
|
||||
}),
|
||||
'\x0a', dev.getName()
|
||||
]);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function renderDevBadge(dev) {
|
||||
return updateDevBadge(E('span', {
|
||||
'class': 'ifacebadge port-status-device',
|
||||
'style': 'font-weight:normal',
|
||||
'data-device': dev.getName()
|
||||
}), dev);
|
||||
}
|
||||
|
||||
function updatePortStatus(node, dev) {
|
||||
var carrier = dev.getCarrier(),
|
||||
duplex = dev.getDuplex(),
|
||||
speed = dev.getSpeed(),
|
||||
desc, title;
|
||||
|
||||
if (carrier && speed > 0 && duplex != null) {
|
||||
desc = '%d%s'.format(speed, duplex == 'full' ? 'FD' : 'HD');
|
||||
title = '%s, %d MBit/s, %s'.format(_('Connected'), speed, duplex == 'full' ? _('full-duplex') : _('half-duplex'));
|
||||
}
|
||||
else if (carrier) {
|
||||
desc = _('Connected');
|
||||
}
|
||||
else {
|
||||
desc = _('no link');
|
||||
}
|
||||
|
||||
dom.content(node, [
|
||||
E('img', {
|
||||
'class': 'middle',
|
||||
'src': L.resource('icons/port_%s.png').format(carrier ? 'up' : 'down')
|
||||
}),
|
||||
'\x0a', desc
|
||||
]);
|
||||
|
||||
if (title)
|
||||
node.setAttribute('data-tooltip', title);
|
||||
else
|
||||
node.removeAttribute('data-tooltip');
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function renderPortStatus(dev) {
|
||||
return updatePortStatus(E('span', {
|
||||
'class': 'ifacebadge port-status-link',
|
||||
'data-device': dev.getName()
|
||||
}), dev);
|
||||
}
|
||||
|
||||
function updatePlaceholders(opt, section_id) {
|
||||
var dev = network.instantiateDevice(opt.getUIElement(section_id).getValue());
|
||||
|
||||
for (var i = 0, co; (co = opt.section.children[i]) != null; i++) {
|
||||
if (co !== opt) {
|
||||
switch (co.option) {
|
||||
case 'mtu':
|
||||
case 'mtu6':
|
||||
co.getUIElement(section_id).setPlaceholder(dev.getMTU());
|
||||
break;
|
||||
|
||||
case 'macaddr':
|
||||
co.getUIElement(section_id).setPlaceholder(dev.getMAC());
|
||||
break;
|
||||
|
||||
case 'txqueuelen':
|
||||
co.getUIElement(section_id).setPlaceholder(dev._devstate('qlen'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var cbiTagValue = form.Value.extend({
|
||||
renderWidget: function(section_id, option_index, cfgvalue) {
|
||||
var widget = new ui.Dropdown(cfgvalue || ['-'], {
|
||||
'-': E([], [
|
||||
E('span', { 'class': 'hide-open', 'style': 'font-family:monospace' }, [ '—' ]),
|
||||
E('span', { 'class': 'hide-close' }, [ _('Do not participate', 'VLAN port state') ])
|
||||
]),
|
||||
'u': E([], [
|
||||
E('span', { 'class': 'hide-open', 'style': 'font-family:monospace' }, [ 'u' ]),
|
||||
E('span', { 'class': 'hide-close' }, [ _('Egress untagged', 'VLAN port state') ])
|
||||
]),
|
||||
't': E([], [
|
||||
E('span', { 'class': 'hide-open', 'style': 'font-family:monospace' }, [ 't' ]),
|
||||
E('span', { 'class': 'hide-close' }, [ _('Egress tagged', 'VLAN port state') ])
|
||||
]),
|
||||
'*': E([], [
|
||||
E('span', { 'class': 'hide-open', 'style': 'font-family:monospace' }, [ '*' ]),
|
||||
E('span', { 'class': 'hide-close' }, [ _('Primary VLAN ID', 'VLAN port state') ])
|
||||
])
|
||||
}, {
|
||||
id: this.cbid(section_id),
|
||||
sort: [ '-', 'u', 't', '*' ],
|
||||
optional: false,
|
||||
multiple: true
|
||||
});
|
||||
|
||||
var field = this;
|
||||
|
||||
widget.toggleItem = function(sb, li, force_state) {
|
||||
var lis = li.parentNode.querySelectorAll('li'),
|
||||
toggle = ui.Dropdown.prototype.toggleItem;
|
||||
|
||||
toggle.apply(this, [sb, li, force_state]);
|
||||
|
||||
if (force_state != null)
|
||||
return;
|
||||
|
||||
switch (li.getAttribute('data-value'))
|
||||
{
|
||||
case '-':
|
||||
if (li.hasAttribute('selected')) {
|
||||
for (var i = 0; i < lis.length; i++) {
|
||||
switch (lis[i].getAttribute('data-value')) {
|
||||
case '-':
|
||||
break;
|
||||
|
||||
case '*':
|
||||
toggle.apply(this, [sb, lis[i], false]);
|
||||
lis[i].setAttribute('unselectable', '');
|
||||
break;
|
||||
|
||||
default:
|
||||
toggle.apply(this, [sb, lis[i], false]);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 't':
|
||||
case 'u':
|
||||
if (li.hasAttribute('selected')) {
|
||||
for (var i = 0; i < lis.length; i++) {
|
||||
switch (lis[i].getAttribute('data-value')) {
|
||||
case li.getAttribute('data-value'):
|
||||
break;
|
||||
|
||||
case '*':
|
||||
lis[i].removeAttribute('unselectable');
|
||||
break;
|
||||
|
||||
default:
|
||||
toggle.apply(this, [sb, lis[i], false]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
toggle.apply(this, [sb, li, true]);
|
||||
}
|
||||
break;
|
||||
|
||||
case '*':
|
||||
if (li.hasAttribute('selected')) {
|
||||
var section_ids = field.section.cfgsections();
|
||||
|
||||
for (var i = 0; i < section_ids.length; i++) {
|
||||
var other_widget = field.getUIElement(section_ids[i]),
|
||||
other_value = L.toArray(other_widget.getValue());
|
||||
|
||||
if (other_widget === this)
|
||||
continue;
|
||||
|
||||
var new_value = other_value.filter(function(v) { return v != '*' });
|
||||
|
||||
if (new_value.length == other_value.length)
|
||||
continue;
|
||||
|
||||
other_widget.setValue(new_value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var node = widget.render();
|
||||
|
||||
node.style.minWidth = '4em';
|
||||
|
||||
if (cfgvalue == '-')
|
||||
node.querySelector('li[data-value="*"]').setAttribute('unselectable', '');
|
||||
|
||||
return E('div', { 'style': 'display:inline-block' }, node);
|
||||
},
|
||||
|
||||
cfgvalue: function(section_id) {
|
||||
var ports = L.toArray(uci.get('network', section_id, 'ports'));
|
||||
|
||||
for (var i = 0; i < ports.length; i++) {
|
||||
var s = ports[i].split(/:/);
|
||||
|
||||
if (s[0] != this.port)
|
||||
continue;
|
||||
|
||||
var t = /t/.test(s[1] || '') ? 't' : 'u';
|
||||
|
||||
return /\*/.test(s[1] || '') ? [t, '*'] : [t];
|
||||
}
|
||||
|
||||
return ['-'];
|
||||
},
|
||||
|
||||
write: function(section_id, value) {
|
||||
var ports = [];
|
||||
|
||||
for (var i = 0; i < this.section.children.length; i++) {
|
||||
var opt = this.section.children[i];
|
||||
|
||||
if (opt.port) {
|
||||
var val = L.toArray(opt.formvalue(section_id)).join('');
|
||||
|
||||
switch (val) {
|
||||
case '-':
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
ports.push(opt.port);
|
||||
break;
|
||||
|
||||
default:
|
||||
ports.push('%s:%s'.format(opt.port, val));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uci.set('network', section_id, 'ports', ports);
|
||||
},
|
||||
|
||||
remove: function() {}
|
||||
});
|
||||
|
||||
return baseclass.extend({
|
||||
replaceOption: function(s, tabName, optionClass, optionName, optionTitle, optionDescription) {
|
||||
var o = s.getOption(optionName);
|
||||
|
||||
if (o) {
|
||||
if (o.tab) {
|
||||
s.tabs[o.tab].children = s.tabs[o.tab].children.filter(function(opt) {
|
||||
return opt.option != optionName;
|
||||
});
|
||||
}
|
||||
|
||||
s.children = s.children.filter(function(opt) {
|
||||
return opt.option != optionName;
|
||||
});
|
||||
}
|
||||
|
||||
return s.taboption(tabName, optionClass, optionName, optionTitle, optionDescription);
|
||||
},
|
||||
|
||||
addDeviceOptions: function(s, dev, isNew) {
|
||||
var parent_dev = dev ? dev.getParent() : null,
|
||||
o, ss;
|
||||
|
||||
s.tab('devgeneral', _('General device options'));
|
||||
s.tab('devadvanced', _('Advanced device options'));
|
||||
s.tab('brport', _('Bridge port specific options'));
|
||||
s.tab('bridgevlan', _('Bridge VLAN filtering'));
|
||||
|
||||
o = this.replaceOption(s, 'devgeneral', form.ListValue, 'type', _('Device type'));
|
||||
o.readonly = !isNew;
|
||||
o.value('', _('Network device'));
|
||||
o.value('bridge', _('Bridge device'));
|
||||
o.value('8021q', _('VLAN (802.1q)'));
|
||||
o.value('8021ad', _('VLAN (802.1ad)'));
|
||||
o.value('macvlan', _('MAC VLAN'));
|
||||
o.value('veth', _('Virtual Ethernet'));
|
||||
o.validate = function(section_id, value) {
|
||||
if (value == 'bridge' || value == 'veth')
|
||||
updatePlaceholders(this.section.getOption('name_complex'), section_id);
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
o = this.replaceOption(s, 'devgeneral', widgets.DeviceSelect, 'name_simple', _('Existing device'));
|
||||
o.readonly = !isNew;
|
||||
o.rmempty = false;
|
||||
o.noaliases = true;
|
||||
o.default = (dev ? dev.getName() : '');
|
||||
o.ucioption = 'name';
|
||||
o.filter = function(section_id, value) {
|
||||
var dev = network.instantiateDevice(value);
|
||||
return !deviceSectionExists(section_id, value) && (dev.getType() != 'wifi' || dev.isUp());
|
||||
};
|
||||
o.validate = function(section_id, value) {
|
||||
updatePlaceholders(this, section_id);
|
||||
|
||||
return deviceSectionExists(section_id, value)
|
||||
? _('A configuration for the device "%s" already exists').format(value) : true;
|
||||
};
|
||||
o.onchange = function(ev, section_id, values) {
|
||||
updatePlaceholders(this, section_id);
|
||||
};
|
||||
o.depends('type', '');
|
||||
|
||||
o = this.replaceOption(s, 'devgeneral', widgets.DeviceSelect, 'ifname_single', _('Base device'));
|
||||
o.readonly = !isNew;
|
||||
o.rmempty = false;
|
||||
o.noaliases = true;
|
||||
o.default = (dev ? dev.getName() : '').match(/^.+\.\d+$/) ? dev.getName().replace(/\.\d+$/, '') : '';
|
||||
o.ucioption = 'ifname';
|
||||
o.filter = function(section_id, value) {
|
||||
var dev = network.instantiateDevice(value);
|
||||
return (dev.getType() != 'wifi' || dev.isUp());
|
||||
};
|
||||
o.validate = function(section_id, value) {
|
||||
updatePlaceholders(this, section_id);
|
||||
|
||||
if (isNew) {
|
||||
var type = this.section.formvalue(section_id, 'type'),
|
||||
name = this.section.getUIElement(section_id, 'name_complex');
|
||||
|
||||
if (type == 'macvlan' && value && name && !name.isChanged()) {
|
||||
var i = 0;
|
||||
|
||||
while (deviceSectionExists(section_id, '%smac%d'.format(value, i)))
|
||||
i++;
|
||||
|
||||
name.setValue('%smac%d'.format(value, i));
|
||||
name.triggerValidation();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
o.onchange = function(ev, section_id, values) {
|
||||
updatePlaceholders(this, section_id);
|
||||
};
|
||||
o.depends('type', '8021q');
|
||||
o.depends('type', '8021ad');
|
||||
o.depends('type', 'macvlan');
|
||||
|
||||
o = this.replaceOption(s, 'devgeneral', form.Value, 'vid', _('VLAN ID'));
|
||||
o.readonly = !isNew;
|
||||
o.datatype = 'range(1, 4094)';
|
||||
o.rmempty = false;
|
||||
o.default = (dev ? dev.getName() : '').match(/^.+\.\d+$/) ? dev.getName().replace(/^.+\./, '') : '';
|
||||
o.validate = function(section_id, value) {
|
||||
var base = this.section.formvalue(section_id, 'ifname_single'),
|
||||
vid = this.section.formvalue(section_id, 'vid'),
|
||||
name = this.section.getUIElement(section_id, 'name_complex');
|
||||
|
||||
if (base && vid && name && !name.isChanged()) {
|
||||
name.setValue('%s.%d'.format(base, vid));
|
||||
name.triggerValidation();
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
o.depends('type', '8021q');
|
||||
o.depends('type', '8021ad');
|
||||
|
||||
o = this.replaceOption(s, 'devgeneral', form.ListValue, 'mode', _('Mode'));
|
||||
o.value('vepa', _('VEPA (Virtual Ethernet Port Aggregator)', 'MACVLAN mode'));
|
||||
o.value('private', _('Private (Prevent communication between MAC VLANs)', 'MACVLAN mode'));
|
||||
o.value('bridge', _('Bridge (Support direct communication between MAC VLANs)', 'MACVLAN mode'));
|
||||
o.value('passthru', _('Pass-through (Mirror physical device to single MAC VLAN)', 'MACVLAN mode'));
|
||||
o.depends('type', 'macvlan');
|
||||
|
||||
o = this.replaceOption(s, 'devgeneral', form.Value, 'name_complex', _('Device name'));
|
||||
o.rmempty = false;
|
||||
o.datatype = 'maxlength(15)';
|
||||
o.readonly = !isNew;
|
||||
o.ucioption = 'name';
|
||||
o.validate = function(section_id, value) {
|
||||
var dev = network.instantiateDevice(value);
|
||||
|
||||
if (deviceSectionExists(section_id, value) || (isNew && (dev.dev || {}).idx))
|
||||
return _('The device name "%s" is already taken').format(value);
|
||||
|
||||
return true;
|
||||
};
|
||||
o.depends({ type: '', '!reverse': true });
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.DynamicList, 'ingress_qos_mapping', _('Ingress QoS mapping'), _('Defines a mapping of VLAN header priority to the Linux internal packet priority on incoming frames'));
|
||||
o.rmempty = true;
|
||||
o.validate = validateQoSMap;
|
||||
o.depends('type', '8021q');
|
||||
o.depends('type', '8021ad');
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.DynamicList, 'egress_qos_mapping', _('Egress QoS mapping'), _('Defines a mapping of Linux internal packet priority to VLAN header priority but for outgoing frames'));
|
||||
o.rmempty = true;
|
||||
o.validate = validateQoSMap;
|
||||
o.depends('type', '8021q');
|
||||
o.depends('type', '8021ad');
|
||||
|
||||
o = this.replaceOption(s, 'devgeneral', widgets.DeviceSelect, 'ifname_multi', _('Bridge ports'));
|
||||
o.size = 10;
|
||||
o.rmempty = true;
|
||||
o.multiple = true;
|
||||
o.noaliases = true;
|
||||
o.nobridges = true;
|
||||
o.ucioption = 'ports';
|
||||
o.default = L.toArray(dev ? dev.getPorts() : null).filter(function(p) { return p.getType() != 'wifi' }).map(function(p) { return p.getName() });
|
||||
o.filter = function(section_id, device_name) {
|
||||
var bridge_name = uci.get('network', section_id, 'name'),
|
||||
choice_dev = network.instantiateDevice(device_name),
|
||||
parent_dev = choice_dev.getParent();
|
||||
|
||||
/* only show wifi networks which are already present in "option ifname" */
|
||||
if (choice_dev.getType() == 'wifi') {
|
||||
var ifnames = L.toArray(uci.get('network', section_id, 'ports'));
|
||||
|
||||
for (var i = 0; i < ifnames.length; i++)
|
||||
if (ifnames[i] == device_name)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return (!parent_dev || parent_dev.getName() != bridge_name);
|
||||
};
|
||||
o.description = _('Specifies the wired ports to attach to this bridge. In order to attach wireless networks, choose the associated interface as network in the wireless settings.')
|
||||
o.onchange = function(ev, section_id, values) {
|
||||
ss.updatePorts(values);
|
||||
|
||||
return ss.parse().then(function() {
|
||||
ss.redraw();
|
||||
});
|
||||
};
|
||||
o.depends('type', 'bridge');
|
||||
|
||||
o = this.replaceOption(s, 'devgeneral', form.Flag, 'bridge_empty', _('Bring up empty bridge'), _('Bring up the bridge interface even if no ports are attached'));
|
||||
o.default = o.disabled;
|
||||
o.depends('type', 'bridge');
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Value, 'priority', _('Priority'));
|
||||
o.placeholder = '32767';
|
||||
o.datatype = 'range(0, 65535)';
|
||||
o.depends('type', 'bridge');
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Value, 'ageing_time', _('Ageing time'), _('Timeout in seconds for learned MAC addresses in the forwarding database'));
|
||||
o.placeholder = '30';
|
||||
o.datatype = 'uinteger';
|
||||
o.depends('type', 'bridge');
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Flag, 'stp', _('Enable <abbr title="Spanning Tree Protocol">STP</abbr>'), _('Enables the Spanning Tree Protocol on this bridge'));
|
||||
o.default = o.disabled;
|
||||
o.depends('type', 'bridge');
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Value, 'hello_time', _('Hello interval'), _('Interval in seconds for STP hello packets'));
|
||||
o.placeholder = '2';
|
||||
o.datatype = 'range(1, 10)';
|
||||
o.depends({ type: 'bridge', stp: '1' });
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Value, 'forward_delay', _('Forward delay'), _('Time in seconds to spend in listening and learning states'));
|
||||
o.placeholder = '15';
|
||||
o.datatype = 'range(2, 30)';
|
||||
o.depends({ type: 'bridge', stp: '1' });
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Value, 'max_age', _('Maximum age'), _('Timeout in seconds until topology updates on link loss'));
|
||||
o.placeholder = '20';
|
||||
o.datatype = 'range(6, 40)';
|
||||
o.depends({ type: 'bridge', stp: '1' });
|
||||
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Flag, 'igmp_snooping', _('Enable <abbr title="Internet Group Management Protocol">IGMP</abbr> snooping'), _('Enables IGMP snooping on this bridge'));
|
||||
o.default = o.disabled;
|
||||
o.depends('type', 'bridge');
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Value, 'hash_max', _('Maximum snooping table size'));
|
||||
o.placeholder = '512';
|
||||
o.datatype = 'uinteger';
|
||||
o.depends({ type: 'bridge', igmp_snooping: '1' });
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Flag, 'multicast_querier', _('Enable multicast querier'));
|
||||
o.defaults = { '1': [{'igmp_snooping': '1'}], '0': [{'igmp_snooping': '0'}] };
|
||||
o.depends('type', 'bridge');
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Value, 'robustness', _('Robustness'), _('The robustness value allows tuning for the expected packet loss on the network. If a network is expected to be lossy, the robustness value may be increased. IGMP is robust to (Robustness-1) packet losses'));
|
||||
o.placeholder = '2';
|
||||
o.datatype = 'min(1)';
|
||||
o.depends({ type: 'bridge', multicast_querier: '1' });
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Value, 'query_interval', _('Query interval'), _('Interval in centiseconds between multicast general queries. By varying the value, an administrator may tune the number of IGMP messages on the subnet; larger values cause IGMP Queries to be sent less often'));
|
||||
o.placeholder = '12500';
|
||||
o.datatype = 'uinteger';
|
||||
o.depends({ type: 'bridge', multicast_querier: '1' });
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Value, 'query_response_interval', _('Query response interval'), _('The max response time in centiseconds inserted into the periodic general queries. By varying the value, an administrator may tune the burstiness of IGMP messages on the subnet; larger values make the traffic less bursty, as host responses are spread out over a larger interval'));
|
||||
o.placeholder = '1000';
|
||||
o.datatype = 'uinteger';
|
||||
o.validate = function(section_id, value) {
|
||||
var qiopt = L.toArray(this.map.lookupOption('query_interval', section_id))[0],
|
||||
qival = qiopt ? (qiopt.formvalue(section_id) || qiopt.placeholder) : '';
|
||||
|
||||
if (value != '' && qival != '' && +value >= +qival)
|
||||
return _('The query response interval must be lower than the query interval value');
|
||||
|
||||
return true;
|
||||
};
|
||||
o.depends({ type: 'bridge', multicast_querier: '1' });
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Value, 'last_member_interval', _('Last member interval'), _('The max response time in centiseconds inserted into group-specific queries sent in response to leave group messages. It is also the amount of time between group-specific query messages. This value may be tuned to modify the "leave latency" of the network. A reduced value results in reduced time to detect the loss of the last member of a group'));
|
||||
o.placeholder = '100';
|
||||
o.datatype = 'uinteger';
|
||||
o.depends({ type: 'bridge', multicast_querier: '1' });
|
||||
|
||||
o = this.replaceOption(s, 'devgeneral', form.Value, 'mtu', _('MTU'));
|
||||
o.datatype = 'range(576, 9200)';
|
||||
o.validate = function(section_id, value) {
|
||||
var parent_mtu = (dev && dev.getType() == 'vlan') ? (parent_dev ? parent_dev.getMTU() : null) : null;
|
||||
|
||||
if (parent_mtu !== null && +value > parent_mtu)
|
||||
return _('The MTU must not exceed the parent device MTU of %d bytes').format(parent_mtu);
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
o = this.replaceOption(s, 'devgeneral', form.Value, 'macaddr', _('MAC address'));
|
||||
o.datatype = 'macaddr';
|
||||
|
||||
o = this.replaceOption(s, 'devgeneral', form.Value, 'peer_name', _('Peer device name'));
|
||||
o.rmempty = true;
|
||||
o.datatype = 'maxlength(15)';
|
||||
o.depends('type', 'veth');
|
||||
o.load = function(section_id) {
|
||||
var sections = uci.sections('network', 'device'),
|
||||
idx = 0;
|
||||
|
||||
for (var i = 0; i < sections.length; i++)
|
||||
if (sections[i]['.name'] == section_id)
|
||||
break;
|
||||
else if (sections[i].type == 'veth')
|
||||
idx++;
|
||||
|
||||
this.placeholder = 'veth%d'.format(idx);
|
||||
|
||||
return form.Value.prototype.load.apply(this, arguments);
|
||||
};
|
||||
|
||||
o = this.replaceOption(s, 'devgeneral', form.Value, 'peer_macaddr', _('Peer MAC address'));
|
||||
o.rmempty = true;
|
||||
o.datatype = 'macaddr';
|
||||
o.depends('type', 'veth');
|
||||
|
||||
o = this.replaceOption(s, 'devgeneral', form.Value, 'txqueuelen', _('TX queue length'));
|
||||
o.placeholder = dev ? dev._devstate('qlen') : '';
|
||||
o.datatype = 'uinteger';
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Flag, 'promisc', _('Enable promiscuous mode'));
|
||||
o.default = o.disabled;
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.ListValue, 'rpfilter', _('Reverse path filter'));
|
||||
o.default = '';
|
||||
o.value('', _('disabled'));
|
||||
o.value('loose', _('Loose filtering'));
|
||||
o.value('strict', _('Strict filtering'));
|
||||
o.cfgvalue = function(section_id) {
|
||||
var val = form.ListValue.prototype.cfgvalue.apply(this, [section_id]);
|
||||
|
||||
switch (val || '') {
|
||||
case 'loose':
|
||||
case '1':
|
||||
return 'loose';
|
||||
|
||||
case 'strict':
|
||||
case '2':
|
||||
return 'strict';
|
||||
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Flag, 'acceptlocal', _('Accept local'), _('Accept packets with local source addresses'));
|
||||
o.default = o.disabled;
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Flag, 'sendredirects', _('Send ICMP redirects'));
|
||||
o.default = o.enabled;
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Value, 'neighreachabletime', _('Neighbour cache validity'), _('Time in milliseconds'));
|
||||
o.placeholder = '30000';
|
||||
o.datatype = 'uinteger';
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Value, 'neighgcstaletime', _('Stale neighbour cache timeout'), _('Timeout in seconds'));
|
||||
o.placeholder = '60';
|
||||
o.datatype = 'uinteger';
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Value, 'neighlocktime', _('Minimum ARP validity time'), _('Minimum required time in seconds before an ARP entry may be replaced. Prevents ARP cache thrashing.'));
|
||||
o.placeholder = '0';
|
||||
o.datatype = 'uinteger';
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Value, 'ttl', _('Force TTL'), _('Some LTE providers detect tethering by inspecting packet TTL values'));
|
||||
o.placeholder = '65';
|
||||
o.datatype = 'uinteger';
|
||||
|
||||
o = this.replaceOption(s, 'devgeneral', form.Flag, 'ipv6', _('Enable IPv6'));
|
||||
o.migrate = false;
|
||||
o.default = o.enabled;
|
||||
|
||||
o = this.replaceOption(s, 'devgeneral', form.Value, 'mtu6', _('IPv6 MTU'));
|
||||
o.datatype = 'max(9200)';
|
||||
o.depends('ipv6', '1');
|
||||
|
||||
o = this.replaceOption(s, 'devgeneral', form.Value, 'dadtransmits', _('DAD transmits'), _('Amount of Duplicate Address Detection probes to send'));
|
||||
o.placeholder = '1';
|
||||
o.datatype = 'uinteger';
|
||||
o.depends('ipv6', '1');
|
||||
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.Flag, 'multicast', _('Enable multicast support'));
|
||||
o.default = o.enabled;
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.ListValue, 'igmpversion', _('Force IGMP version'));
|
||||
o.value('', _('No enforcement'));
|
||||
o.value('1', _('Enforce IGMPv1'));
|
||||
o.value('2', _('Enforce IGMPv2'));
|
||||
o.value('3', _('Enforce IGMPv3'));
|
||||
o.depends('multicast', '1');
|
||||
|
||||
o = this.replaceOption(s, 'devadvanced', form.ListValue, 'mldversion', _('Force MLD version'));
|
||||
o.value('', _('No enforcement'));
|
||||
o.value('1', _('Enforce MLD version 1'));
|
||||
o.value('2', _('Enforce MLD version 2'));
|
||||
o.depends('multicast', '1');
|
||||
|
||||
if (isBridgePort(dev)) {
|
||||
o = this.replaceOption(s, 'brport', form.Flag, 'learning', _('Enable MAC address learning'));
|
||||
o.default = o.enabled;
|
||||
|
||||
o = this.replaceOption(s, 'brport', form.Flag, 'unicast_flood', _('Enable unicast flooding'));
|
||||
o.default = o.enabled;
|
||||
|
||||
o = this.replaceOption(s, 'brport', form.Flag, 'isolated', _('Port isolation'), _('Only allow communication with non-isolated bridge ports when enabled'));
|
||||
o.default = o.disabled;
|
||||
|
||||
o = this.replaceOption(s, 'brport', form.ListValue, 'multicast_router', _('Multicast routing'));
|
||||
o.value('', _('Never'));
|
||||
o.value('1', _('Learn'));
|
||||
o.value('2', _('Always'));
|
||||
o.depends('multicast', '1');
|
||||
|
||||
o = this.replaceOption(s, 'brport', form.Flag, 'multicast_to_unicast', _('Multicast to unicast'), _('Forward multicast packets as unicast packets on this device.'));
|
||||
o.default = o.disabled;
|
||||
o.depends('multicast', '1');
|
||||
|
||||
o = this.replaceOption(s, 'brport', form.Flag, 'multicast_fast_leave', _('Enable multicast fast leave'));
|
||||
o.default = o.disabled;
|
||||
o.depends('multicast', '1');
|
||||
}
|
||||
|
||||
o = this.replaceOption(s, 'bridgevlan', form.Flag, 'vlan_filtering', _('Enable VLAN filtering'));
|
||||
o.depends('type', 'bridge');
|
||||
o.updateDefaultValue = function(section_id) {
|
||||
var device = uci.get('network', s.section, 'name'),
|
||||
uielem = this.getUIElement(section_id),
|
||||
has_vlans = false;
|
||||
|
||||
uci.sections('network', 'bridge-vlan', function(bvs) {
|
||||
has_vlans = has_vlans || (bvs.device == device);
|
||||
});
|
||||
|
||||
this.default = has_vlans ? this.enabled : this.disabled;
|
||||
|
||||
if (uielem && !uielem.isChanged())
|
||||
uielem.setValue(this.default);
|
||||
};
|
||||
|
||||
o = this.replaceOption(s, 'bridgevlan', form.SectionValue, 'bridge-vlan', form.TableSection, 'bridge-vlan');
|
||||
o.depends('type', 'bridge');
|
||||
|
||||
ss = o.subsection;
|
||||
ss.addremove = true;
|
||||
ss.anonymous = true;
|
||||
|
||||
ss.renderHeaderRows = function(/* ... */) {
|
||||
var node = form.TableSection.prototype.renderHeaderRows.apply(this, arguments);
|
||||
|
||||
node.querySelectorAll('.th').forEach(function(th) {
|
||||
th.classList.add('left');
|
||||
th.classList.add('middle');
|
||||
});
|
||||
|
||||
return node;
|
||||
};
|
||||
|
||||
ss.filter = function(section_id) {
|
||||
var devname = uci.get('network', s.section, 'name');
|
||||
return (uci.get('network', section_id, 'device') == devname);
|
||||
};
|
||||
|
||||
ss.render = function(/* ... */) {
|
||||
return form.TableSection.prototype.render.apply(this, arguments).then(L.bind(function(node) {
|
||||
node.style.overflow = 'auto hidden';
|
||||
node.style.paddingTop = '1em';
|
||||
|
||||
if (this.node)
|
||||
this.node.parentNode.replaceChild(node, this.node);
|
||||
|
||||
this.node = node;
|
||||
|
||||
return node;
|
||||
}, this));
|
||||
};
|
||||
|
||||
ss.redraw = function() {
|
||||
return this.load().then(L.bind(this.render, this));
|
||||
};
|
||||
|
||||
ss.updatePorts = function(ports) {
|
||||
var devices = ports.map(function(port) {
|
||||
return network.instantiateDevice(port)
|
||||
}).filter(function(dev) {
|
||||
return dev.getType() != 'wifi' || dev.isUp();
|
||||
});
|
||||
|
||||
this.children = this.children.filter(function(opt) { return !opt.option.match(/^port_/) });
|
||||
|
||||
for (var i = 0; i < devices.length; i++) {
|
||||
o = ss.option(cbiTagValue, 'port_%s'.format(sfh(devices[i].getName())), renderDevBadge(devices[i]), renderPortStatus(devices[i]));
|
||||
o.port = devices[i].getName();
|
||||
}
|
||||
|
||||
var section_ids = this.cfgsections(),
|
||||
device_names = devices.reduce(function(names, dev) { names[dev.getName()] = true; return names }, {});
|
||||
|
||||
for (var i = 0; i < section_ids.length; i++) {
|
||||
var old_spec = L.toArray(uci.get('network', section_ids[i], 'ports')),
|
||||
new_spec = old_spec.filter(function(spec) { return device_names[spec.replace(/:[ut*]+$/, '')] });
|
||||
|
||||
if (old_spec.length != new_spec.length)
|
||||
uci.set('network', section_ids[i], 'ports', new_spec.length ? new_spec : null);
|
||||
}
|
||||
};
|
||||
|
||||
ss.handleAdd = function(ev) {
|
||||
return s.parse().then(L.bind(function() {
|
||||
var device = uci.get('network', s.section, 'name'),
|
||||
section_ids = this.cfgsections(),
|
||||
section_id = null,
|
||||
max_vlan_id = 0;
|
||||
|
||||
if (!device)
|
||||
return;
|
||||
|
||||
for (var i = 0; i < section_ids.length; i++) {
|
||||
var vid = +uci.get('network', section_ids[i], 'vlan');
|
||||
|
||||
if (vid > max_vlan_id)
|
||||
max_vlan_id = vid;
|
||||
}
|
||||
|
||||
section_id = uci.add('network', 'bridge-vlan');
|
||||
uci.set('network', section_id, 'device', device);
|
||||
uci.set('network', section_id, 'vlan', max_vlan_id + 1);
|
||||
|
||||
s.children.forEach(function(opt) {
|
||||
switch (opt.option) {
|
||||
case 'type':
|
||||
case 'name_complex':
|
||||
var input = opt.map.findElement('id', 'widget.%s'.format(opt.cbid(s.section)));
|
||||
if (input)
|
||||
input.disabled = true;
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
s.getOption('vlan_filtering').updateDefaultValue(s.section);
|
||||
|
||||
s.map.addedVLANs = s.map.addedVLANs || [];
|
||||
s.map.addedVLANs.push(section_id);
|
||||
|
||||
return this.redraw();
|
||||
}, this));
|
||||
};
|
||||
|
||||
o = ss.option(form.Value, 'vlan', _('VLAN ID'));
|
||||
o.datatype = 'range(1, 4094)';
|
||||
|
||||
o.renderWidget = function(/* ... */) {
|
||||
var node = form.Value.prototype.renderWidget.apply(this, arguments);
|
||||
|
||||
node.style.width = '5em';
|
||||
|
||||
return node;
|
||||
};
|
||||
|
||||
o.validate = function(section_id, value) {
|
||||
var section_ids = this.section.cfgsections();
|
||||
|
||||
for (var i = 0; i < section_ids.length; i++) {
|
||||
if (section_ids[i] == section_id)
|
||||
continue;
|
||||
|
||||
if (uci.get('network', section_ids[i], 'vlan') == value)
|
||||
return _('The VLAN ID must be unique');
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
o = ss.option(form.Flag, 'local', _('Local'));
|
||||
o.default = o.enabled;
|
||||
|
||||
var ports = [];
|
||||
|
||||
var seen_ports = {};
|
||||
|
||||
L.toArray(uci.get('network', s.section, 'ports')).forEach(function(port) {
|
||||
seen_ports[port] = true;
|
||||
});
|
||||
|
||||
uci.sections('network', 'bridge-vlan', function(bvs) {
|
||||
if (uci.get('network', s.section, 'name') != bvs.device)
|
||||
return;
|
||||
|
||||
L.toArray(bvs.ports).forEach(function(portspec) {
|
||||
var m = portspec.match(/^([^:]+)(?::[ut*]+)?$/);
|
||||
|
||||
if (m)
|
||||
seen_ports[m[1]] = true;
|
||||
});
|
||||
});
|
||||
|
||||
for (var port_name in seen_ports)
|
||||
ports.push(port_name);
|
||||
|
||||
ports.sort(function(a, b) {
|
||||
var m1 = a.match(/^(.+?)([0-9]*)$/),
|
||||
m2 = b.match(/^(.+?)([0-9]*)$/);
|
||||
|
||||
if (m1[1] < m2[1])
|
||||
return -1;
|
||||
else if (m1[1] > m2[1])
|
||||
return 1;
|
||||
else
|
||||
return +(m1[2] || 0) - +(m2[2] || 0);
|
||||
});
|
||||
|
||||
ss.updatePorts(ports);
|
||||
},
|
||||
|
||||
updateDevBadge: updateDevBadge,
|
||||
updatePortStatus: updatePortStatus
|
||||
});
|
|
@ -34,8 +34,8 @@ CBILeaseStatus = form.DummyValue.extend({
|
|||
E('table', { 'id': 'lease_status_table', 'class': 'table' }, [
|
||||
E('tr', { 'class': 'tr table-titles' }, [
|
||||
E('th', { 'class': 'th' }, _('Hostname')),
|
||||
E('th', { 'class': 'th' }, _('IPv4-Address')),
|
||||
E('th', { 'class': 'th' }, _('MAC-Address')),
|
||||
E('th', { 'class': 'th' }, _('IPv4 address')),
|
||||
E('th', { 'class': 'th' }, _('MAC address')),
|
||||
E('th', { 'class': 'th' }, _('Lease time remaining'))
|
||||
]),
|
||||
E('tr', { 'class': 'tr placeholder' }, [
|
||||
|
@ -53,7 +53,7 @@ CBILease6Status = form.DummyValue.extend({
|
|||
E('table', { 'id': 'lease6_status_table', 'class': 'table' }, [
|
||||
E('tr', { 'class': 'tr table-titles' }, [
|
||||
E('th', { 'class': 'th' }, _('Host')),
|
||||
E('th', { 'class': 'th' }, _('IPv6-Address')),
|
||||
E('th', { 'class': 'th' }, _('IPv6 address')),
|
||||
E('th', { 'class': 'th' }, _('DUID')),
|
||||
E('th', { 'class': 'th' }, _('Lease time remaining'))
|
||||
]),
|
||||
|
@ -279,7 +279,8 @@ return view.extend({
|
|||
|
||||
o.optional = true;
|
||||
o.placeholder = '/example.org/10.1.2.3';
|
||||
// o.validate = validateServerSpec;
|
||||
o.validate = validateServerSpec;
|
||||
|
||||
|
||||
o = s.taboption('general', form.DynamicList, 'address', _('Addresses'),
|
||||
_('List of domains to force to an IP address.'));
|
||||
|
@ -287,6 +288,7 @@ return view.extend({
|
|||
o.optional = true;
|
||||
o.placeholder = '/router.local/192.168.0.1';
|
||||
|
||||
|
||||
o = s.taboption('general', form.Flag, 'rebind_protection',
|
||||
_('Rebind protection'),
|
||||
_('Discard upstream RFC1918 responses'));
|
||||
|
@ -407,7 +409,7 @@ return view.extend({
|
|||
|
||||
o = s.taboption('leases', form.SectionValue, '__leases__', form.GridSection, 'host', null,
|
||||
_('Static leases are used to assign fixed IP addresses and symbolic hostnames to DHCP clients. They are also required for non-dynamic interface configurations where only hosts with a corresponding lease are served.') + '<br />' +
|
||||
_('Use the <em>Add</em> Button to add a new lease entry. The <em>MAC-Address</em> identifies the host, the <em>IPv4-Address</em> specifies the fixed address to use, and the <em>Hostname</em> is assigned as a symbolic name to the requesting host. The optional <em>Lease time</em> can be used to set non-standard host-specific lease time, e.g. 12h, 3d or infinite.'));
|
||||
_('Use the <em>Add</em> Button to add a new lease entry. The <em>MAC address</em> identifies the host, the <em>IPv4 address</em> specifies the fixed address to use, and the <em>Hostname</em> is assigned as a symbolic name to the requesting host. The optional <em>Lease time</em> can be used to set non-standard host-specific lease time, e.g. 12h, 3d or infinite.'));
|
||||
|
||||
ss = o.subsection;
|
||||
|
||||
|
@ -448,7 +450,11 @@ return view.extend({
|
|||
|
||||
node.addEventListener('cbi-dropdown-change', L.bind(function(ipopt, section_id, ev) {
|
||||
var mac = ev.detail.value.value;
|
||||
if (mac == null || mac == '' || !hosts[mac] || !hosts[mac].ipv4)
|
||||
if (mac == null || mac == '' || !hosts[mac])
|
||||
return;
|
||||
|
||||
var iphint = L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4)[0];
|
||||
if (iphint == null)
|
||||
return;
|
||||
|
||||
var ip = ipopt.formvalue(section_id);
|
||||
|
@ -457,16 +463,35 @@ return view.extend({
|
|||
|
||||
var node = ipopt.map.findElement('id', ipopt.cbid(section_id));
|
||||
if (node)
|
||||
dom.callClassMethod(node, 'setValue', hosts[mac].ipv4);
|
||||
dom.callClassMethod(node, 'setValue', iphint);
|
||||
}, this, ipopt, section_id));
|
||||
|
||||
return node;
|
||||
};
|
||||
Object.keys(hosts).forEach(function(mac) {
|
||||
var hint = hosts[mac].name || hosts[mac].ipv4;
|
||||
var hint = hosts[mac].name || L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4)[0];
|
||||
so.value(mac, hint ? '%s (%s)'.format(mac, hint) : mac);
|
||||
});
|
||||
|
||||
so.write = function(section, value) {
|
||||
var ip = this.map.lookupOption('ip', section)[0].formvalue(section);
|
||||
var hosts = uci.sections('dhcp', 'host');
|
||||
var section_removed = false;
|
||||
|
||||
for (var i = 0; i < hosts.length; i++) {
|
||||
if (ip == hosts[i].ip) {
|
||||
uci.set('dhcp', hosts[i]['.name'], 'mac', [hosts[i].mac, value].join(' '));
|
||||
uci.remove('dhcp', section);
|
||||
section_removed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!section_removed) {
|
||||
uci.set('dhcp', section, 'mac', value);
|
||||
}
|
||||
}
|
||||
|
||||
so = ss.option(form.Value, 'ip', _('<abbr title="Internet Protocol Version 4">IPv4</abbr>-Address'));
|
||||
so.datatype = 'or(ip4addr,"ignore")';
|
||||
so.validate = function(section, value) {
|
||||
|
@ -480,19 +505,21 @@ return view.extend({
|
|||
|
||||
return true;
|
||||
};
|
||||
|
||||
var ipaddrs = {};
|
||||
|
||||
Object.keys(hosts).forEach(function(mac) {
|
||||
if (hosts[mac].ipv4) {
|
||||
var hint = hosts[mac].name;
|
||||
so.value(hosts[mac].ipv4, hint ? '%s (%s)'.format(hosts[mac].ipv4, hint) : hosts[mac].ipv4);
|
||||
}
|
||||
var addrs = L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4);
|
||||
|
||||
for (var i = 0; i < addrs.length; i++)
|
||||
ipaddrs[addrs[i]] = hosts[mac].name;
|
||||
});
|
||||
|
||||
so = ss.option(form.Value, 'gw', _('Gateway'));
|
||||
so.datatype = 'or(ip4addr,"ignore")';
|
||||
so.rmempty = true;
|
||||
L.sortedKeys(ipaddrs, null, 'addr').forEach(function(ipv4) {
|
||||
so.value(ipv4, ipaddrs[ipv4] ? '%s (%s)'.format(ipv4, ipaddrs[ipv4]) : ipv4);
|
||||
});
|
||||
|
||||
so = ss.option(form.Value, 'leasetime', _('Lease time'), _('The lease time is in minutes (mini 2m), hours (eg 1h) or "infinite"'));
|
||||
so.placeholder = '12h';
|
||||
so = ss.option(form.Value, 'leasetime', _('Lease time'));
|
||||
so.rmempty = true;
|
||||
|
||||
so = ss.option(form.Value, 'duid', _('<abbr title="The DHCP Unique Identifier">DUID</abbr>'));
|
||||
|
@ -547,7 +574,7 @@ return view.extend({
|
|||
exp = '%t'.format(lease.expires);
|
||||
|
||||
var hint = lease.macaddr ? hosts[lease.macaddr] : null,
|
||||
name = hint ? (hint.name || hint.ipv4 || hint.ipv6) : null,
|
||||
name = hint ? (hint.name || L.toArray(hint.ipaddrs || hint.ipv4)[0] || L.toArray(hint.ip6addrs || hint.ipv6)[0]) : null,
|
||||
host = null;
|
||||
|
||||
if (name && lease.hostname && lease.hostname != name && lease.ip6addr != name)
|
||||
|
|
|
@ -31,11 +31,18 @@ return view.extend({
|
|||
o = s.option(form.Value, 'ip', _('IP address'));
|
||||
o.datatype = 'ipaddr';
|
||||
o.rmempty = true;
|
||||
L.sortedKeys(hosts, 'ipv4', 'addr').forEach(function(mac) {
|
||||
o.value(hosts[mac].ipv4, '%s (%s)'.format(
|
||||
hosts[mac].ipv4,
|
||||
hosts[mac].name || mac
|
||||
));
|
||||
|
||||
var ipaddrs = {};
|
||||
|
||||
Object.keys(hosts).forEach(function(mac) {
|
||||
var addrs = L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4);
|
||||
|
||||
for (var i = 0; i < addrs.length; i++)
|
||||
ipaddrs[addrs[i]] = hosts[mac].name || mac;
|
||||
});
|
||||
|
||||
L.sortedKeys(ipaddrs, null, 'addr').forEach(function(ipv4) {
|
||||
o.value(ipv4, '%s (%s)'.format(ipv4, ipaddrs[ipv4]));
|
||||
});
|
||||
|
||||
return m.render();
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -20,6 +20,7 @@ return view.extend({
|
|||
s.anonymous = true;
|
||||
s.addremove = true;
|
||||
s.sortable = true;
|
||||
s.nodescriptions = true;
|
||||
|
||||
s.tab('general', _('General Settings'));
|
||||
s.tab('advanced', _('Advanced Settings'));
|
||||
|
@ -28,6 +29,10 @@ return view.extend({
|
|||
o.rmempty = false;
|
||||
o.nocreate = true;
|
||||
|
||||
o = s.taboption('general', form.Flag, 'disabled', _('Disable'), _('Disable this route'));
|
||||
o.rmempty = true;
|
||||
o.default = o.disabled;
|
||||
|
||||
o = s.taboption('general', form.Value, 'target', _('Target'), (i == 4) ? _('Host-<abbr title="Internet Protocol Address">IP</abbr> or Network') : _('<abbr title="Internet Protocol Version 6">IPv6</abbr>-Address or Network (CIDR)'));
|
||||
o.datatype = (i == 4) ? 'ip4addr' : 'ip6addr';
|
||||
o.rmempty = false;
|
||||
|
|
|
@ -199,7 +199,9 @@ function format_wifirate(rate) {
|
|||
var s = '%.1f\xa0%s, %d\xa0%s'.format(rate.rate / 1000, _('Mbit/s'), rate.mhz, _('MHz')),
|
||||
ht = rate.ht, vht = rate.vht,
|
||||
mhz = rate.mhz, nss = rate.nss,
|
||||
mcs = rate.mcs, sgi = rate.short_gi;
|
||||
mcs = rate.mcs, sgi = rate.short_gi,
|
||||
he = rate.he, he_gi = rate.he_gi,
|
||||
he_dcm = rate.he_dcm;
|
||||
|
||||
if (ht || vht) {
|
||||
if (vht) s += ', VHT-MCS\xa0%d'.format(mcs);
|
||||
|
@ -208,6 +210,13 @@ function format_wifirate(rate) {
|
|||
if (sgi) s += ', ' + _('Short GI').replace(/ /g, '\xa0');
|
||||
}
|
||||
|
||||
if (he) {
|
||||
s += ', HE-MCS\xa0%d'.format(mcs);
|
||||
if (nss) s += ', HE-NSS\xa0%d'.format(nss);
|
||||
if (he_gi) s += ', HE-GI\xa0%d'.format(he_gi);
|
||||
if (he_dcm) s += ', HE-DCM\xa0%d'.format(he_dcm);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -303,16 +312,32 @@ var CBIWifiFrequencyValue = form.Value.extend({
|
|||
this.callFrequencyList(section_id)
|
||||
]).then(L.bind(function(data) {
|
||||
this.channels = {
|
||||
'11g': L.hasSystemFeature('hostapd', 'acs') ? [ 'auto', 'auto', true ] : [],
|
||||
'11a': L.hasSystemFeature('hostapd', 'acs') ? [ 'auto', 'auto', true ] : []
|
||||
'2g': L.hasSystemFeature('hostapd', 'acs') ? [ 'auto', 'auto', true ] : [],
|
||||
'5g': L.hasSystemFeature('hostapd', 'acs') ? [ 'auto', 'auto', true ] : [],
|
||||
'6g': [],
|
||||
'60g': []
|
||||
};
|
||||
|
||||
for (var i = 0; i < data[1].length; i++)
|
||||
this.channels[(data[1][i].mhz > 2484) ? '11a' : '11g'].push(
|
||||
for (var i = 0; i < data[1].length; i++) {
|
||||
var band;
|
||||
|
||||
if (data[1][i].mhz >= 2412 && data[1][i].mhz <= 2484)
|
||||
band = '2g';
|
||||
else if (data[1][i].mhz >= 5160 && data[1][i].mhz <= 5885)
|
||||
band = '5g';
|
||||
else if (data[1][i].mhz >= 5925 && data[1][i].mhz <= 7125)
|
||||
band = '6g';
|
||||
else if (data[1][i].mhz >= 58329 && data[1][i].mhz <= 69120)
|
||||
band = '60g';
|
||||
else
|
||||
continue;
|
||||
|
||||
this.channels[band].push(
|
||||
data[1][i].channel,
|
||||
'%d (%d Mhz)'.format(data[1][i].channel, data[1][i].mhz),
|
||||
!data[1][i].restricted
|
||||
);
|
||||
}
|
||||
|
||||
var hwmodelist = L.toArray(data[0] ? data[0].getHWModes() : null)
|
||||
.reduce(function(o, v) { o[v] = true; return o }, {});
|
||||
|
@ -320,7 +345,8 @@ var CBIWifiFrequencyValue = form.Value.extend({
|
|||
this.modes = [
|
||||
'', 'Legacy', true,
|
||||
'n', 'N', hwmodelist.n,
|
||||
'ac', 'AC', hwmodelist.ac
|
||||
'ac', 'AC', hwmodelist.ac,
|
||||
'ax', 'AX', hwmodelist.ax
|
||||
];
|
||||
|
||||
var htmodelist = L.toArray(data[0] ? data[0].getHTModes() : null)
|
||||
|
@ -337,20 +363,30 @@ var CBIWifiFrequencyValue = form.Value.extend({
|
|||
'VHT40', '40 MHz', htmodelist.VHT40,
|
||||
'VHT80', '80 MHz', htmodelist.VHT80,
|
||||
'VHT160', '160 MHz', htmodelist.VHT160
|
||||
],
|
||||
'ax': [
|
||||
'HE20', '20 MHz', htmodelist.HE20,
|
||||
'HE40', '40 MHz', htmodelist.HE40,
|
||||
'HE80', '80 MHz', htmodelist.HE80,
|
||||
'HE160', '160 MHz', htmodelist.HE160
|
||||
]
|
||||
};
|
||||
|
||||
this.bands = {
|
||||
'': [
|
||||
'11g', '2.4 GHz', this.channels['11g'].length > 3,
|
||||
'11a', '5 GHz', this.channels['11a'].length > 3
|
||||
'2g', '2.4 GHz', this.channels['2g'].length > 3,
|
||||
'5g', '5 GHz', this.channels['5g'].length > 3
|
||||
],
|
||||
'n': [
|
||||
'11g', '2.4 GHz', this.channels['11g'].length > 3,
|
||||
'11a', '5 GHz', this.channels['11a'].length > 3
|
||||
'2g', '2.4 GHz', this.channels['2g'].length > 3,
|
||||
'5g', '5 GHz', this.channels['5g'].length > 3
|
||||
],
|
||||
'ac': [
|
||||
'11a', '5 GHz', true
|
||||
'5g', '5 GHz', true
|
||||
],
|
||||
'ax': [
|
||||
'2g', '2.4 GHz', this.channels['2g'].length > 3,
|
||||
'5g', '5 GHz', this.channels['5g'].length > 3
|
||||
]
|
||||
};
|
||||
}, this));
|
||||
|
@ -392,6 +428,8 @@ var CBIWifiFrequencyValue = form.Value.extend({
|
|||
|
||||
this.setValues(band, this.bands[mode.value]);
|
||||
this.toggleWifiChannel(elem);
|
||||
|
||||
this.map.checkDepends();
|
||||
},
|
||||
|
||||
toggleWifiChannel: function(elem) {
|
||||
|
@ -408,11 +446,14 @@ var CBIWifiFrequencyValue = form.Value.extend({
|
|||
bwdt = elem.querySelector('.htmode'),
|
||||
htval = uci.get('wireless', section_id, 'htmode'),
|
||||
hwval = uci.get('wireless', section_id, 'hwmode'),
|
||||
chval = uci.get('wireless', section_id, 'channel');
|
||||
chval = uci.get('wireless', section_id, 'channel'),
|
||||
bandval = uci.get('wireless', section_id, 'band');
|
||||
|
||||
this.setValues(mode, this.modes);
|
||||
|
||||
if (/VHT20|VHT40|VHT80|VHT160/.test(htval))
|
||||
if (/HE20|HE40|HE80|HE160/.test(htval))
|
||||
mode.value = 'ax';
|
||||
else if (/VHT20|VHT40|VHT80|VHT160/.test(htval))
|
||||
mode.value = 'ac';
|
||||
else if (/HT20|HT40/.test(htval))
|
||||
mode.value = 'n';
|
||||
|
@ -421,15 +462,24 @@ var CBIWifiFrequencyValue = form.Value.extend({
|
|||
|
||||
this.toggleWifiMode(elem);
|
||||
|
||||
if (/a/.test(hwval))
|
||||
band.value = '11a';
|
||||
else
|
||||
band.value = '11g';
|
||||
if (hwval != null) {
|
||||
this.useBandOption = false;
|
||||
|
||||
if (/a/.test(hwval))
|
||||
band.value = '5g';
|
||||
else
|
||||
band.value = '2g';
|
||||
}
|
||||
else {
|
||||
this.useBandOption = true;
|
||||
|
||||
band.value = bandval;
|
||||
}
|
||||
|
||||
this.toggleWifiBand(elem);
|
||||
|
||||
bwdt.value = htval;
|
||||
chan.value = chval;
|
||||
chan.value = chval || chan.options[0].value;
|
||||
|
||||
return elem;
|
||||
},
|
||||
|
@ -461,6 +511,7 @@ var CBIWifiFrequencyValue = form.Value.extend({
|
|||
E('select', {
|
||||
'class': 'channel',
|
||||
'style': 'width:auto',
|
||||
'change': L.bind(this.map.checkDepends, this.map),
|
||||
'disabled': (this.disabled != null) ? this.disabled : this.map.readonly
|
||||
})
|
||||
]),
|
||||
|
@ -469,6 +520,7 @@ var CBIWifiFrequencyValue = form.Value.extend({
|
|||
E('select', {
|
||||
'class': 'htmode',
|
||||
'style': 'width:auto',
|
||||
'change': L.bind(this.map.checkDepends, this.map),
|
||||
'disabled': (this.disabled != null) ? this.disabled : this.map.readonly
|
||||
})
|
||||
]),
|
||||
|
@ -481,7 +533,7 @@ var CBIWifiFrequencyValue = form.Value.extend({
|
|||
cfgvalue: function(section_id) {
|
||||
return [
|
||||
uci.get('wireless', section_id, 'htmode'),
|
||||
uci.get('wireless', section_id, 'hwmode'),
|
||||
uci.get('wireless', section_id, 'hwmode') || uci.get('wireless', section_id, 'band'),
|
||||
uci.get('wireless', section_id, 'channel')
|
||||
];
|
||||
},
|
||||
|
@ -498,7 +550,12 @@ var CBIWifiFrequencyValue = form.Value.extend({
|
|||
|
||||
write: function(section_id, value) {
|
||||
uci.set('wireless', section_id, 'htmode', value[0] || null);
|
||||
uci.set('wireless', section_id, 'hwmode', value[1]);
|
||||
|
||||
if (this.useBandOption)
|
||||
uci.set('wireless', section_id, 'band', value[1]);
|
||||
else
|
||||
uci.set('wireless', section_id, 'hwmode', (value[1] == '2g') ? '11g' : '11a');
|
||||
|
||||
uci.set('wireless', section_id, 'channel', value[2]);
|
||||
}
|
||||
});
|
||||
|
@ -883,6 +940,9 @@ return view.extend({
|
|||
o.ucisection = s.section;
|
||||
|
||||
if (hwtype == 'mac80211') {
|
||||
o = ss.taboption('general', form.Flag, 'legacy_rates', _('Allow legacy 802.11b rates'), _('Legacy or badly behaving devices may require legacy 802.11b rates to interoperate. Airtime efficiency may be significantly reduced where these are used. It is recommended to not allow 802.11b rates where possible.'));
|
||||
o.depends({'_freq': '11g', '!contains': true});
|
||||
|
||||
o = ss.taboption('general', CBIWifiTxPowerValue, 'txpower', _('Maximum transmit power'), _('Specifies the maximum transmit power the wireless radio may use. Depending on regulatory requirements and wireless usage, the actual transmit power may be reduced by the driver.'));
|
||||
o.wifiNetwork = radioNet;
|
||||
|
||||
|
@ -895,9 +955,6 @@ return view.extend({
|
|||
o.value('2', _('High'));
|
||||
o.value('3', _('Very High'));
|
||||
|
||||
o = ss.taboption('advanced', form.Flag, 'legacy_rates', _('Allow legacy 802.11b rates'));
|
||||
o.default = o.enabled;
|
||||
|
||||
o = ss.taboption('advanced', form.Value, 'distance', _('Distance Optimization'), _('Distance to farthest network member in meters.'));
|
||||
o.datatype = 'or(range(0,114750),"auto")';
|
||||
o.placeholder = 'auto';
|
||||
|
@ -983,8 +1040,17 @@ return view.extend({
|
|||
return net || network.addNetwork(name, { proto: 'none' });
|
||||
}, this, values[i])).then(L.bind(function(dev, net) {
|
||||
if (net) {
|
||||
if (!net.isEmpty())
|
||||
net.set('type', 'bridge');
|
||||
if (!net.isEmpty()) {
|
||||
var target_dev = net.getDevice();
|
||||
|
||||
/* Resolve parent interface of vlan */
|
||||
while (target_dev && target_dev.getType() == 'vlan')
|
||||
target_dev = target_dev.getParent();
|
||||
|
||||
if (!target_dev || target_dev.getType() != 'bridge')
|
||||
net.set('type', 'bridge');
|
||||
}
|
||||
|
||||
net.addDevice(dev);
|
||||
}
|
||||
}, this, dev)));
|
||||
|
@ -1014,7 +1080,7 @@ return view.extend({
|
|||
bssid.depends('mode', 'sta');
|
||||
bssid.depends('mode', 'sta-wds');
|
||||
|
||||
o = ss.taboption('macfilter', form.ListValue, 'macfilter', _('MAC-Address Filter'));
|
||||
o = ss.taboption('macfilter', form.ListValue, 'macfilter', _('MAC Address Filter'));
|
||||
o.depends('mode', 'ap');
|
||||
o.depends('mode', 'ap-wds');
|
||||
o.value('', _('disable'));
|
||||
|
@ -1069,11 +1135,11 @@ return view.extend({
|
|||
return mode;
|
||||
};
|
||||
|
||||
o = ss.taboption('general', form.Flag, 'hidden', _('Hide <abbr title="Extended Service Set Identifier">ESSID</abbr>'));
|
||||
o = ss.taboption('general', form.Flag, 'hidden', _('Hide <abbr title="Extended Service Set Identifier">ESSID</abbr>'), _('Where the ESSID is hidden, clients may fail to roam and airtime efficiency may be significantly reduced.'));
|
||||
o.depends('mode', 'ap');
|
||||
o.depends('mode', 'ap-wds');
|
||||
|
||||
o = ss.taboption('general', form.Flag, 'wmm', _('WMM Mode'));
|
||||
o = ss.taboption('general', form.Flag, 'wmm', _('WMM Mode'), _('Where Wi-Fi Multimedia (WMM) Mode QoS is disabled, clients may be limited to 802.11a/802.11g rates.'));
|
||||
o.depends('mode', 'ap');
|
||||
o.depends('mode', 'ap-wds');
|
||||
o.default = o.enabled;
|
||||
|
@ -1609,34 +1675,32 @@ return view.extend({
|
|||
|
||||
if (hwtype == 'mac80211') {
|
||||
// ieee802.11w options
|
||||
if (L.hasSystemFeature('hostapd', '11w')) {
|
||||
o = ss.taboption('encryption', form.ListValue, 'ieee80211w', _('802.11w Management Frame Protection'), _("Requires the 'full' version of wpad/hostapd and support from the wifi driver <br />(as of Jan 2019: ath9k, ath10k, mwlwifi and mt76)"));
|
||||
o.value('', _('Disabled'));
|
||||
o.value('1', _('Optional'));
|
||||
o.value('2', _('Required'));
|
||||
add_dependency_permutations(o, { mode: ['ap', 'ap-wds', 'sta', 'sta-wds'], encryption: ['owe', 'psk2', 'psk-mixed', 'sae', 'sae-mixed', 'wpa2', 'wpa3', 'wpa3-mixed'] });
|
||||
o = ss.taboption('encryption', form.ListValue, 'ieee80211w', _('802.11w Management Frame Protection'), _("Note: Some wireless drivers do not fully support 802.11w. E.g. mwlwifi may have problems"));
|
||||
o.value('', _('Disabled'));
|
||||
o.value('1', _('Optional'));
|
||||
o.value('2', _('Required'));
|
||||
add_dependency_permutations(o, { mode: ['ap', 'ap-wds', 'sta', 'sta-wds'], encryption: ['owe', 'psk2', 'psk-mixed', 'sae', 'sae-mixed', 'wpa2', 'wpa3', 'wpa3-mixed'] });
|
||||
|
||||
o.defaults = {
|
||||
'2': [{ encryption: 'sae' }, { encryption: 'owe' }, { encryption: 'wpa3' }, { encryption: 'wpa3-mixed' }],
|
||||
'1': [{ encryption: 'sae-mixed'}],
|
||||
'': []
|
||||
};
|
||||
|
||||
o = ss.taboption('encryption', form.Value, 'ieee80211w_max_timeout', _('802.11w maximum timeout'), _('802.11w Association SA Query maximum timeout'));
|
||||
o.depends('ieee80211w', '1');
|
||||
o.depends('ieee80211w', '2');
|
||||
o.datatype = 'uinteger';
|
||||
o.placeholder = '1000';
|
||||
o.rmempty = true;
|
||||
|
||||
o = ss.taboption('encryption', form.Value, 'ieee80211w_retry_timeout', _('802.11w retry timeout'), _('802.11w Association SA Query retry timeout'));
|
||||
o.depends('ieee80211w', '1');
|
||||
o.depends('ieee80211w', '2');
|
||||
o.datatype = 'uinteger';
|
||||
o.placeholder = '201';
|
||||
o.rmempty = true;
|
||||
o.defaults = {
|
||||
'2': [{ encryption: 'sae' }, { encryption: 'owe' }, { encryption: 'wpa3' }, { encryption: 'wpa3-mixed' }],
|
||||
'1': [{ encryption: 'sae-mixed'}],
|
||||
'': []
|
||||
};
|
||||
|
||||
o = ss.taboption('encryption', form.Value, 'ieee80211w_max_timeout', _('802.11w maximum timeout'), _('802.11w Association SA Query maximum timeout'));
|
||||
o.depends('ieee80211w', '1');
|
||||
o.depends('ieee80211w', '2');
|
||||
o.datatype = 'uinteger';
|
||||
o.placeholder = '1000';
|
||||
o.rmempty = true;
|
||||
|
||||
o = ss.taboption('encryption', form.Value, 'ieee80211w_retry_timeout', _('802.11w retry timeout'), _('802.11w Association SA Query retry timeout'));
|
||||
o.depends('ieee80211w', '1');
|
||||
o.depends('ieee80211w', '2');
|
||||
o.datatype = 'uinteger';
|
||||
o.placeholder = '201';
|
||||
o.rmempty = true;
|
||||
|
||||
o = ss.taboption('encryption', form.Flag, 'wpa_disable_eapol_key_retries', _('Enable key reinstallation (KRACK) countermeasures'), _('Complicates key reinstallation attacks on the client side by disabling retransmission of EAPOL-Key frames that are used to install keys. This workaround might cause interoperability issues and reduced robustness of key negotiation especially in environments with heavy traffic load.'));
|
||||
add_dependency_permutations(o, { mode: ['ap', 'ap-wds'], encryption: ['psk2', 'psk-mixed', 'sae', 'sae-mixed', 'wpa2', 'wpa3', 'wpa3-mixed'] });
|
||||
|
||||
|
@ -2082,7 +2146,7 @@ return view.extend({
|
|||
var table = E('table', { 'class': 'table assoclist', 'id': 'wifi_assoclist_table' }, [
|
||||
E('tr', { 'class': 'tr table-titles' }, [
|
||||
E('th', { 'class': 'th nowrap' }, _('Network')),
|
||||
E('th', { 'class': 'th hide-xs' }, _('MAC-Address')),
|
||||
E('th', { 'class': 'th hide-xs' }, _('MAC address')),
|
||||
E('th', { 'class': 'th' }, _('Host')),
|
||||
E('th', { 'class': 'th' }, _('Signal / Noise')),
|
||||
E('th', { 'class': 'th' }, _('RX Rate / TX Rate'))
|
||||
|
|
|
@ -4,7 +4,11 @@
|
|||
"read": {
|
||||
"cgi-io": [ "exec" ],
|
||||
"file": {
|
||||
"/usr/libexec/luci-peeraddr": [ "exec" ]
|
||||
"/etc/iproute2/rt_tables": [ "read" ],
|
||||
"/proc/sys/net/ipv6/conf/*/mtu": [ "read" ],
|
||||
"/proc/sys/net/ipv6/conf/*/hop_limit": [ "read" ],
|
||||
"/usr/libexec/luci-peeraddr": [ "exec" ],
|
||||
"/usr/lib/opkg/info/netifd.control": [ "read" ]
|
||||
},
|
||||
"ubus": {
|
||||
"file": [ "exec" ],
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=Support for ModemManager
|
||||
LUCI_DEPENDS:=+modemmanager
|
||||
PKG_VERSION:=omr-202103
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
|
@ -1,121 +0,0 @@
|
|||
'use strict';
|
||||
'require fs';
|
||||
'require form';
|
||||
'require network';
|
||||
|
||||
function getModemList() {
|
||||
return fs.exec_direct('/usr/bin/mmcli', [ '-L' ]).then(function(res) {
|
||||
var lines = (res || '').split(/\n/),
|
||||
tasks = [];
|
||||
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
var m = lines[i].match(/\/Modem\/(\d+)/);
|
||||
if (m)
|
||||
tasks.push(fs.exec_direct('/usr/bin/mmcli', [ '-m', m[1] ]));
|
||||
}
|
||||
|
||||
return Promise.all(tasks).then(function(res) {
|
||||
var modems = [];
|
||||
|
||||
for (var i = 0; i < res.length; i++) {
|
||||
var man = res[i].match(/manufacturer: ([^\n]+)/),
|
||||
mod = res[i].match(/model: ([^\n]+)/),
|
||||
dev = res[i].match(/device: ([^\n]+)/);
|
||||
|
||||
if (dev) {
|
||||
modems.push({
|
||||
device: dev[1].trim(),
|
||||
manufacturer: (man ? man[1].trim() : '') || '?',
|
||||
model: (mod ? mod[1].trim() : '') || dev[1].trim()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return modems;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
network.registerPatternVirtual(/^mobiledata-.+$/);
|
||||
network.registerErrorCode('CALL_FAILED', _('Call failed'));
|
||||
network.registerErrorCode('NO_CID', _('Unable to obtain client ID'));
|
||||
network.registerErrorCode('PLMN_FAILED', _('Setting PLMN failed'));
|
||||
|
||||
return network.registerProtocol('modemmanager', {
|
||||
getI18n: function() {
|
||||
return _('ModemManager');
|
||||
},
|
||||
|
||||
getIfname: function() {
|
||||
return this._ubus('l3_device') || 'modemmanager-%s'.format(this.sid);
|
||||
},
|
||||
|
||||
getOpkgPackage: function() {
|
||||
return 'modemmanager';
|
||||
},
|
||||
|
||||
isFloating: function() {
|
||||
return true;
|
||||
},
|
||||
|
||||
isVirtual: function() {
|
||||
return true;
|
||||
},
|
||||
|
||||
getDevices: function() {
|
||||
return null;
|
||||
},
|
||||
|
||||
containsDevice: function(ifname) {
|
||||
return (network.getIfnameOf(ifname) == this.getIfname());
|
||||
},
|
||||
|
||||
renderFormOptions: function(s) {
|
||||
var dev = this.getL3Device() || this.getDevice(), o;
|
||||
|
||||
o = s.taboption('general', form.ListValue, 'device', _('Modem device'));
|
||||
o.rmempty = false;
|
||||
o.load = function(section_id) {
|
||||
return getModemList().then(L.bind(function(devices) {
|
||||
for (var i = 0; i < devices.length; i++)
|
||||
this.value(devices[i].device,
|
||||
'%s - %s (%s)'.format(devices[i].manufacturer, devices[i].model, devices[i].device));
|
||||
return form.Value.prototype.load.apply(this, [section_id]);
|
||||
}, this));
|
||||
};
|
||||
|
||||
s.taboption('general', form.Value, 'apn', _('APN'));
|
||||
s.taboption('general', form.Value, 'pincode', _('PIN'));
|
||||
|
||||
o = s.taboption('general', form.ListValue, 'auth', _('Authentication Type'));
|
||||
o.value('both', _('PAP/CHAP (both)'));
|
||||
o.value('pap', 'PAP');
|
||||
o.value('chap', 'CHAP');
|
||||
o.value('none', _('None'));
|
||||
o.default = 'none';
|
||||
|
||||
o = s.taboption('general', form.Value, 'username', _('PAP/CHAP username'));
|
||||
o.depends('auth', 'pap');
|
||||
o.depends('auth', 'chap');
|
||||
o.depends('auth', 'both');
|
||||
|
||||
o = s.taboption('general', form.Value, 'password', _('PAP/CHAP password'));
|
||||
o.depends('auth', 'pap');
|
||||
o.depends('auth', 'chap');
|
||||
o.depends('auth', 'both');
|
||||
o.password = true;
|
||||
|
||||
o = s.taboption('general', form.ListValue, 'iptype', _('IP Type'));
|
||||
o.value('ipv4v6', _('IPv4/IPv6 (both - defaults to IPv4)'))
|
||||
o.value('ipv4', _('IPv4 only'));
|
||||
o.value('ipv6', _('IPv6 only'));
|
||||
o.default = 'ipv4v6';
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'mtu', _('Override MTU'));
|
||||
o.placeholder = dev ? (dev.getMTU() || '1500') : '1500';
|
||||
o.datatype = 'max(9200)';
|
||||
|
||||
s.taboption('general', form.Value, 'metric', _('Gateway metric'));
|
||||
|
||||
}
|
||||
});
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"luci-proto-modemmanager": {
|
||||
"description": "Grant access to mmcli",
|
||||
"read": {
|
||||
"cgi-io": [ "exec" ],
|
||||
"file": {
|
||||
"/usr/bin/mmcli -L": [ "exec" ],
|
||||
"/usr/bin/mmcli -m [0-9]": [ "exec" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,6 +29,9 @@
|
|||
<meta charset="utf-8">
|
||||
<title><%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI</title>
|
||||
<meta name="viewport" content="initial-scale=1.0">
|
||||
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
|
||||
<meta http-equiv="Pragma" content="no-cache" />
|
||||
<meta http-equiv="Expires" content="0" />
|
||||
<link rel="stylesheet" href="<%=media%>/cascade.css">
|
||||
<link rel="stylesheet" media="only screen and (max-device-width: 854px)" href="<%=media%>/mobile.css" type="text/css" />
|
||||
<link rel="shortcut icon" type="image/png" href="<%=media%>/favicon.png">
|
||||
|
|
59
mc/Config.in
59
mc/Config.in
|
@ -1,59 +0,0 @@
|
|||
menu "Configuration"
|
||||
depends on PACKAGE_mc
|
||||
|
||||
config MC_DIFFVIEWER
|
||||
bool "Enable internal diff viewer"
|
||||
default n
|
||||
help
|
||||
This option enables the built-in diff viewer.
|
||||
Disabled by default.
|
||||
|
||||
config MC_EDITOR
|
||||
bool "Enable internal editor"
|
||||
default y
|
||||
help
|
||||
This option enables the built-in file editor.
|
||||
Enabled by default.
|
||||
|
||||
config MC_SUBSHELL
|
||||
bool "Enable concurrent subshell"
|
||||
default y
|
||||
help
|
||||
This option enables concurrent subshell support.
|
||||
Enabled by default.
|
||||
|
||||
config MC_LARGEFILE
|
||||
bool "Enable largefile support"
|
||||
default n
|
||||
help
|
||||
This option enables support for large files (> 2 GB).
|
||||
Disabled by default.
|
||||
|
||||
config MC_BACKGROUND
|
||||
bool "Enable background operations"
|
||||
default n
|
||||
help
|
||||
This option enables support for background operations which
|
||||
allow to perform some tasks such as copying files in a
|
||||
separate background process. Background code is known
|
||||
to be less stable than the rest of the code.
|
||||
Disabled by default.
|
||||
|
||||
config MC_CHARSET
|
||||
bool "Enable charset support"
|
||||
default y
|
||||
help
|
||||
This option adds support for selecting character set of the text in
|
||||
the internal viewer and editor and converting it on the fly.
|
||||
Enabled by default.
|
||||
|
||||
config MC_VFS
|
||||
bool "Enable virtual filesystem support"
|
||||
default y
|
||||
help
|
||||
This option enables the Virtual File System switch code to get
|
||||
transparent access to the following file systems:
|
||||
cpio, tar, fish, sfs, ftp, sftp, extfs.
|
||||
Enabled by default.
|
||||
|
||||
endmenu
|
128
mc/Makefile
128
mc/Makefile
|
@ -1,128 +0,0 @@
|
|||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mc
|
||||
PKG_VERSION:=4.8.25
|
||||
PKG_RELEASE:=2
|
||||
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
|
||||
PKG_LICENSE:=GPL-3.0-or-later
|
||||
PKG_CPE_ID:=cpe:/a:midnight_commander:midnight_commander
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=http://ftp.midnight-commander.org/
|
||||
PKG_HASH:=ffc19617f20ebb23330acd3998b7fd559a042d172fa55746d53d246697b2548a
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_FIXUP:=autoreconf gettext-version
|
||||
PKG_BUILD_DEPENDS:=MC_VFS:libtirpc
|
||||
|
||||
PKG_CONFIG_DEPENDS := \
|
||||
CONFIG_PACKAGE_MC \
|
||||
CONFIG_MC_DIFFVIEWER \
|
||||
CONFIG_MC_EDITOR \
|
||||
CONFIG_MC_SUBSHELL \
|
||||
CONFIG_MC_LARGEFILE \
|
||||
CONFIG_MC_BACKGROUND \
|
||||
CONFIG_MC_CHARSET \
|
||||
CONFIG_MC_VFS
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/nls.mk
|
||||
|
||||
define Package/mc
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=+glib2 +libncurses +libmount +MC_VFS:libssh2 $(ICONV_DEPENDS)
|
||||
TITLE:=Midnight Commander - a powerful visual file manager
|
||||
URL:=https://www.midnight-commander.org/
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/mc/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Package/mc/description
|
||||
GNU Midnight Commander is a visual file manager.
|
||||
It's a feature rich full-screen text mode application that allows you to copy,
|
||||
move and delete files and whole directory trees, search for files and run commands in the subshell.
|
||||
Internal viewer and editor are included as well.
|
||||
|
||||
endef
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-silent-rules \
|
||||
--disable-tests \
|
||||
--disable-doxygen-doc \
|
||||
--with-homedir=/etc/mc \
|
||||
--with-screen=ncurses \
|
||||
--without-x \
|
||||
|
||||
CONFIGURE_VARS += \
|
||||
ac_cv_search_addwstr=no \
|
||||
|
||||
ifeq ($(CONFIG_MC_DIFFVIEWER),)
|
||||
CONFIGURE_ARGS += --without-diff-viewer
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MC_EDITOR),)
|
||||
CONFIGURE_ARGS += --without-internal-edit
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MC_SUBSHELL),)
|
||||
CONFIGURE_ARGS += --without-subshell
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MC_LARGEFILE),)
|
||||
CONFIGURE_ARGS += --disable-largefile
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MC_BACKGROUND),)
|
||||
CONFIGURE_ARGS += --disable-background
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MC_CHARSET),)
|
||||
CONFIGURE_ARGS += --disable-charset
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MC_VFS),)
|
||||
CONFIGURE_ARGS += --disable-vfs
|
||||
else
|
||||
TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/tirpc
|
||||
endif
|
||||
|
||||
define Package/mc/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mc $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/etc/mc
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/misc/mc.charsets $(1)/etc/mc
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/misc/mc.ext $(1)/etc/mc
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/misc/mc.default.keymap $(1)/etc/mc/mc.keymap
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/misc/filehighlight.ini $(1)/etc/mc
|
||||
$(INSTALL_DIR) $(1)/usr/share/mc/help
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/doc/hlp/mc.hlp $(1)/usr/share/mc/help
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/misc/mc.menu $(1)/etc/mc
|
||||
$(INSTALL_DIR) $(1)/etc/mc/skins
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/misc/skins/default.ini $(1)/etc/mc/skins
|
||||
$(INSTALL_DIR) $(1)/etc/mc/mcedit/Syntax
|
||||
ifeq ($(CONFIG_MC_DIFFVIEWER),y)
|
||||
ln -sf mc $(1)/usr/bin/mcdiff
|
||||
endif
|
||||
ifeq ($(CONFIG_MC_EDITOR),y)
|
||||
ln -sf mc $(1)/usr/bin/mcedit
|
||||
endif
|
||||
ifeq ($(CONFIG_MC_VFS),y)
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/src/vfs/sfs/sfs.ini $(1)/etc/mc
|
||||
$(INSTALL_DIR) $(1)/usr/lib/mc/extfs.d
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/mc/conffiles
|
||||
/etc/mc/mc.menu
|
||||
/etc/mc/skins/default.ini
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,mc))
|
|
@ -1,11 +0,0 @@
|
|||
-- a/src/subshell/common.c
|
||||
+++ b/src/subshell/common.c
|
||||
@@ -836,7 +836,7 @@ init_subshell_precmd (char *precmd, size
|
||||
"else "
|
||||
"[ \"${PWD##$HOME/}\" = \"$PWD\" ] && MC_PWD=\"$PWD\" || MC_PWD=\"~/${PWD##$HOME/}\"; "
|
||||
"fi; "
|
||||
- "echo \"$USER@$(hostname -s):$MC_PWD\"; "
|
||||
+ "echo \"$USER@$HOSTNAME:$MC_PWD\"; "
|
||||
"pwd>&%d; "
|
||||
"kill -STOP $$; "
|
||||
"}; " "PRECMD=precmd; " "PS1='$($PRECMD)$ '\n", subshell_pipe[WRITE]);
|
|
@ -1,11 +0,0 @@
|
|||
--- a/lib/tty/tty.c
|
||||
+++ b/lib/tty/tty.c
|
||||
@@ -370,7 +370,7 @@ tty_init_xterm_support (gboolean is_xter
|
||||
if (xmouse_seq != NULL)
|
||||
{
|
||||
if (strcmp (xmouse_seq, ESC_STR "[<") == 0)
|
||||
- xmouse_seq = ESC_STR "[M";
|
||||
+ xmouse_seq = NULL;
|
||||
|
||||
xmouse_extended_seq = ESC_STR "[<";
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
--- a/po/Makefile.in.in 2020-07-13 04:16:44.000000000 +0800
|
||||
+++ b/po/Makefile.in.in 2021-02-17 18:04:44.881887192 +0800
|
||||
@@ -8,8 +8,8 @@
|
||||
# Please note that the actual code of GNU gettext is covered by the GNU
|
||||
# General Public License and is *not* in the public domain.
|
||||
#
|
||||
-# Origin: gettext-0.18
|
||||
-GETTEXT_MACRO_VERSION = 0.18
|
||||
+# Origin: gettext-0.20
|
||||
+GETTEXT_MACRO_VERSION = 0.20
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
|
@ -8,13 +8,13 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mlvpn
|
||||
PKG_VERSION:=2263bab
|
||||
PKG_VERSION:=8aa1b16
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/zehome/MLVPN.git
|
||||
PKG_SOURCE_VERSION:=2263bab7e5f983e1daa33887b53120c12646398f
|
||||
PKG_SOURCE_DATE:=2020-12-16
|
||||
PKG_SOURCE_VERSION:=ddafba3c0bd63e0d733d3d5a4532e275714991b3
|
||||
PKG_SOURCE_DATE:=2021-10-28
|
||||
#PKG_SOURCE_URL:=https://github.com/markfoodyburton/MLVPN.git
|
||||
#PKG_SOURCE_VERSION:=8f9720978b28c1954f9f229525333547283316d2
|
||||
#PKG_SOURCE_DATE:=2018-09-03
|
||||
|
|
|
@ -8,3 +8,5 @@ config mlvpn 'general'
|
|||
option host '128.128.128.128'
|
||||
option firstport '65201'
|
||||
option interface_name 'mlvpn0'
|
||||
option loss_tolerance '50'
|
||||
option latency_tolerance '300'
|
||||
|
|
|
@ -13,7 +13,8 @@ interface_multipath_settings() {
|
|||
mode="$(uci -q get openmptcprouter.$config.multipath)"
|
||||
}
|
||||
[ "$mode" = "off" ] || [ "$mode" = "" ] && return 1
|
||||
config_get ifname "$config" ifname
|
||||
config_get ifname "$config" device
|
||||
[ -z "$ifname" ] && config_get ifname "$config" ifname
|
||||
[ -z "$ifname" ] && ifname=$(ifstatus "$config" | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -n "$(echo $ifname | grep '@')" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["device"]')
|
||||
[ -z "$ifname" ] && return 1
|
||||
|
@ -32,21 +33,22 @@ interface_multipath_settings() {
|
|||
}
|
||||
|
||||
start() {
|
||||
local enable timeout mode password reorder_buffer_size interface_name host firstport loss_tolerence
|
||||
local enable timeout mode password reorder_buffer_size interface_name host firstport loss_tolerance latency_tolerance
|
||||
[ "$(uci -q get mlvpn.general.enable)" = "1" ] || return 1
|
||||
interface_name="$(uci -q get mlvpn.general.interface_name)"
|
||||
timeout="$(uci -q get mlvpn.general.timeout)"
|
||||
mode="$(uci -q get mlvpn.general.mode)"
|
||||
password="$(uci -q get mlvpn.general.password)"
|
||||
reorder_buffer_size="$(uci -q get mlvpn.general.reorder_buffer_size)"
|
||||
loss_tolerence="$(uci -q get mlvpn.general.loss_tolerence)"
|
||||
loss_tolerance="$(uci -q get mlvpn.general.loss_tolerance)"
|
||||
latency_tolerance="$(uci -q get mlvpn.general.latency_tolerance)"
|
||||
cleartext_data="$(uci -q get mlvpn.general.cleartext_data)"
|
||||
[ -z "$cleartext_data" ] && cleartext_data="0"
|
||||
host="$(uci -q get mlvpn.general.host)"
|
||||
firstport="$(uci -q get mlvpn.general.firstport)"
|
||||
|
||||
if [ "$(uci -q get network.omrvpn)" != "${interface_name}" ]; then
|
||||
uci -q set network.omrvpn.ifname=${interface_name}
|
||||
uci -q set network.omrvpn.device=${interface_name}
|
||||
uci -q commit
|
||||
fi
|
||||
|
||||
|
@ -58,7 +60,8 @@ start() {
|
|||
timeout = ${timeout}
|
||||
reorder_buffer = yes
|
||||
reorder_buffer_size = ${reorder_buffer_size}
|
||||
loss_tolerence = ${loss_tolerence}
|
||||
loss_tolerence = ${loss_tolerance}
|
||||
latency_tolerence = ${latency_tolerance}
|
||||
cleartext_data = ${cleartext_data}
|
||||
password = "${password}"
|
||||
mtu = 1452
|
||||
|
|
|
@ -11,7 +11,7 @@ if [ "$(uci -q get network.omrvpn)" = "" ] && [ "$(uci -q get network.mlvpn)" =
|
|||
uci -q batch <<-EOF >/dev/null
|
||||
delete network.mlvpn=interface
|
||||
set network.mlvpn=interface
|
||||
set network.mlvpn.ifname=mlvpn0
|
||||
set network.mlvpn.device=mlvpn0
|
||||
set network.mlvpn.proto=dhcp
|
||||
set network.mlvpn.ip4table=vpn
|
||||
set network.mlvpn.multipath=off
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
--- a/src/privsep.c
|
||||
+++ b/src/privsep.c
|
||||
@@ -778,7 +778,7 @@ sig_got_chld(int sig)
|
||||
pid_t pid;
|
||||
|
||||
do {
|
||||
- pid = waitpid(WAIT_ANY, NULL, WNOHANG);
|
||||
+ pid = waitpid(-1, NULL, WNOHANG);
|
||||
if (pid == child_pid && cur_state < STATE_QUIT)
|
||||
cur_state = STATE_QUIT;
|
||||
} while (pid > 0 || (pid == -1 && errno == EINTR));
|
33
mlvpn/patches/020-remove-cdefs.patch
Normal file
33
mlvpn/patches/020-remove-cdefs.patch
Normal file
|
@ -0,0 +1,33 @@
|
|||
--- a/src/vis.h.anc 2021-09-24 22:00:03.900321816 +0200
|
||||
+++ b/src/vis.h 2021-09-24 22:00:21.500028958 +0200
|
||||
@@ -79,7 +79,6 @@
|
||||
*/
|
||||
#define UNVIS_END 1 /* no more characters */
|
||||
|
||||
-#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
char *vis(char *, int, int, int);
|
||||
--- a/src/vis.h.anc 2021-09-24 22:05:19.543069573 +0200
|
||||
+++ b/src/vis.h 2021-09-24 22:06:00.430389216 +0200
|
||||
@@ -80,7 +80,9 @@
|
||||
#define UNVIS_END 1 /* no more characters */
|
||||
|
||||
|
||||
-__BEGIN_DECLS
|
||||
+#ifdef __cplusplus
|
||||
+extern "C" {
|
||||
+#endif
|
||||
char *vis(char *, int, int, int);
|
||||
int strvis(char *, const char *, int);
|
||||
int stravis(char **, const char *, int);
|
||||
@@ -93,6 +95,8 @@
|
||||
ssize_t strnunvis(char *, const char *, size_t)
|
||||
__attribute__ ((__bounded__(__string__,1,3)));
|
||||
|
||||
-__END_DECLS
|
||||
+#ifdef __cplusplus
|
||||
+}
|
||||
+#endif
|
||||
|
||||
#endif /* !HAVE_STRNVIS || BROKEN_STRNVIS */
|
|
@ -1,28 +1,25 @@
|
|||
#
|
||||
# Copyright (C) 2016 Velocloud Inc.
|
||||
# Copyright (C) 2016 Aleksander Morgado <aleksander@aleksander.es>
|
||||
# Copyright (C) 2021 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://gitlab.freedesktop.org/mobile-broadband/ModemManager.git
|
||||
PKG_SOURCE_VERSION:=d77d8dff420dc70d6191b67e172e1df5c4e009bf
|
||||
PKG_NAME:=modemmanager
|
||||
PKG_VERSION:=1.16.3-$(PKG_SOURCE_VERSION)
|
||||
PKG_RELEASE:=10
|
||||
PKG_VERSION:=1.18.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
#PKG_BUILD_DIR:=$(BUILD_DIR)/modemamanager-$
|
||||
PKG_SOURCE:=ModemManager-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=https://www.freedesktop.org/software/ModemManager
|
||||
PKG_HASH:=374be158ae1c1fb38a29eef1cc3cdf89ff3536b48ff1320d208ab204ea6c5f8a
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/ModemManager-$(PKG_VERSION)
|
||||
|
||||
PKG_MAINTAINER:=Nicholas Smith <nicholas.smith@telcoantennas.com.au>
|
||||
PKG_LICENSE:=GPL-2.0-or-later
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
|
@ -101,6 +98,7 @@ define Package/modemmanager/install
|
|||
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ModemManager $(1)/usr/sbin
|
||||
$(INSTALL_BIN) ./files/usr/sbin/ModemManager-wrapper $(1)/usr/sbin
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mmcli $(1)/usr/bin
|
||||
|
@ -134,6 +132,9 @@ define Package/modemmanager/install
|
|||
$(INSTALL_DIR) $(1)/etc/hotplug.d/tty
|
||||
$(INSTALL_DATA) ./files/25-modemmanager-tty $(1)/etc/hotplug.d/tty
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/wwan
|
||||
$(INSTALL_DATA) ./files/25-modemmanager-wwan $(1)/etc/hotplug.d/wwan
|
||||
|
||||
$(INSTALL_DIR) $(1)/lib/netifd/proto
|
||||
$(INSTALL_BIN) ./files/modemmanager.proto $(1)/lib/netifd/proto/modemmanager.sh
|
||||
endef
|
||||
|
|
|
@ -8,10 +8,6 @@
|
|||
# We require a interface name
|
||||
[ -n "${INTERFACE}" ] || exit
|
||||
|
||||
[ -n "$(echo ${INTERFACE} | grep -i sqm)" ] && exit
|
||||
[ -d /sys${DEVPATH} ] || exit
|
||||
[ -n "$(echo ${DEVPATH} | grep -i sqm)" ] && exit
|
||||
|
||||
# Always make sure the rundir exists
|
||||
mkdir -m 0755 -p "${MODEMMANAGER_RUNDIR}"
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
|
||||
# We require a device name
|
||||
[ -n "$DEVNAME" ] || exit
|
||||
[ -d /sys${DEVPATH} ] || exit
|
||||
[ -n "$(echo ${DEVPATH} | grep -i sqm)" ] && exit
|
||||
|
||||
# Always make sure the rundir exists
|
||||
mkdir -m 0755 -p "${MODEMMANAGER_RUNDIR}"
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
# want to process specific interface removal events.
|
||||
[ "$ACTION" = remove ] || exit
|
||||
[ -z "${INTERFACE}" ] || exit
|
||||
[ -d /sys${DEVPATH} ] || exit
|
||||
[ -n "$(echo ${DEVPATH} | grep -i sqm)" ] && exit
|
||||
|
||||
# Load common utilities
|
||||
. /usr/share/ModemManager/modemmanager.common
|
||||
|
|
15
modemmanager/files/25-modemmanager-wwan
Normal file
15
modemmanager/files/25-modemmanager-wwan
Normal file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
# Copyright (C) 2021 Aleksander Morgado <aleksander@aleksander.es>
|
||||
|
||||
# Load hotplug common utilities
|
||||
. /usr/share/ModemManager/modemmanager.common
|
||||
|
||||
# We require a device name
|
||||
[ -n "$DEVNAME" ] || exit
|
||||
|
||||
# Always make sure the rundir exists
|
||||
mkdir -m 0755 -p "${MODEMMANAGER_RUNDIR}"
|
||||
|
||||
# Report wwan
|
||||
mm_log "${ACTION} wwan control port ${DEVNAME}: event processed"
|
||||
mm_report_event "${ACTION}" "${DEVNAME}" "wwan" "/sys${DEVPATH}"
|
|
@ -4,10 +4,6 @@
|
|||
|
||||
################################################################################
|
||||
|
||||
# If there is no interface that use modemmanager, exit
|
||||
#[ -z "$(uci -q show network | grep modemmanager)" ] && exit
|
||||
[ "$(uci -q get openmptcprouter.settings.modemmanager)" = "0" ] && exit
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/netifd/netifd-proto.sh
|
||||
|
||||
|
@ -24,7 +20,7 @@ MODEMMANAGER_EVENTS_CACHE="${MODEMMANAGER_RUNDIR}/events.cache"
|
|||
# Common logging
|
||||
|
||||
mm_log() {
|
||||
logger -t "ModemManager" "hotplug: $*"
|
||||
[ "$(uci -q get openmptcprouter.settings.debug)" = "true" ] && logger -t "ModemManager" "hotplug: $*"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
|
@ -43,12 +39,21 @@ mm_find_physdev_sysfs_path() {
|
|||
# avoid infinite loops iterating
|
||||
[ -z "${tmp_path}" ] || [ "${tmp_path}" = "/" ] && return
|
||||
|
||||
# the physical device will be that with a idVendor and idProduct pair of files
|
||||
# for USB devices, the physical device will be that with a idVendor
|
||||
# and idProduct pair of files
|
||||
[ -f "${tmp_path}"/idVendor ] && [ -f "${tmp_path}"/idProduct ] && {
|
||||
tmp_path=$(readlink -f "$tmp_path")
|
||||
echo "${tmp_path}"
|
||||
return
|
||||
}
|
||||
|
||||
# For PCI devices, the physical device will be that with a vendor
|
||||
# and device pair of files
|
||||
[ -f "${tmp_path}"/vendor ] && [ -f "${tmp_path}"/device ] && {
|
||||
tmp_path=$(readlink -f "$tmp_path")
|
||||
echo "${tmp_path}"
|
||||
return
|
||||
}
|
||||
done
|
||||
}
|
||||
|
||||
|
|
10
modemmanager/files/modemmanager.init
Executable file → Normal file
10
modemmanager/files/modemmanager.init
Executable file → Normal file
|
@ -22,14 +22,12 @@ start_service() {
|
|||
# it starts.
|
||||
#
|
||||
# All these commands need to be executed on every MM start, even after
|
||||
# procd-triggered respawns, which is why they're all included as instance command
|
||||
# procd-triggered respawns, which is why this is wrapped in a startup
|
||||
# wrapper script called '/usr/sbin/ModemManager-wrapper'.
|
||||
#
|
||||
. /usr/share/ModemManager/modemmanager.common
|
||||
procd_open_instance
|
||||
procd_set_param command sh -c ". /usr/share/ModemManager/modemmanager.common; \
|
||||
mkdir -m 0755 -p ${MODEMMANAGER_RUNDIR}; \
|
||||
mm_cleanup_interfaces; \
|
||||
( mm_report_events_from_cache ) >/dev/null 2>&1 & \
|
||||
/usr/sbin/ModemManager"
|
||||
procd_set_param command /usr/sbin/ModemManager-wrapper
|
||||
procd_set_param respawn "${respawn_threshold:-3600}" "${respawn_timeout:-5}" "${respawn_retry:-5}"
|
||||
procd_set_param pidfile "${MODEMMANAGER_PID_FILE}"
|
||||
procd_close_instance
|
||||
|
|
|
@ -197,6 +197,7 @@ modemmanager_connected_method_dhcp_ipv4() {
|
|||
local interface="$1"
|
||||
local wwan="$2"
|
||||
local metric="$3"
|
||||
local defaultroute="$4"
|
||||
|
||||
proto_init_update "${wwan}" 1
|
||||
proto_set_keep 1
|
||||
|
@ -222,6 +223,7 @@ modemmanager_connected_method_static_ipv4() {
|
|||
local dns1="$7"
|
||||
local dns2="$8"
|
||||
local metric="$9"
|
||||
local defaultroute="$10"
|
||||
|
||||
local mask=""
|
||||
|
||||
|
@ -242,8 +244,9 @@ modemmanager_connected_method_static_ipv4() {
|
|||
proto_set_keep 1
|
||||
echo "adding IPv4 address ${address}, netmask ${mask}"
|
||||
proto_add_ipv4_address "${address}" "${mask}"
|
||||
[ -n "${gateway}" ] && {
|
||||
[ -n "${gateway}" ] && [ "${defaultroute}" != 0 ] && {
|
||||
echo "adding default IPv4 route via ${gateway}"
|
||||
logger -t "modemmanager.proto" "adding default IPv4 route via ${gateway} ${address}"
|
||||
proto_add_ipv4_route "0.0.0.0" "0" "${gateway}" "${address}"
|
||||
}
|
||||
[ -n "${dns1}" ] && {
|
||||
|
@ -262,6 +265,7 @@ modemmanager_connected_method_dhcp_ipv6() {
|
|||
local interface="$1"
|
||||
local wwan="$2"
|
||||
local metric="$3"
|
||||
local defaultroute="$4"
|
||||
|
||||
proto_init_update "${wwan}" 1
|
||||
proto_set_keep 1
|
||||
|
@ -288,6 +292,7 @@ modemmanager_connected_method_static_ipv6() {
|
|||
local dns1="$7"
|
||||
local dns2="$8"
|
||||
local metric="$9"
|
||||
local defaultroute="$10"
|
||||
|
||||
[ -n "${address}" ] || {
|
||||
proto_notify_error "${interface}" ADDRESS_MISSING
|
||||
|
@ -306,7 +311,7 @@ modemmanager_connected_method_static_ipv6() {
|
|||
echo "adding IPv6 address ${address}, prefix ${prefix}"
|
||||
proto_add_ipv6_address "${address}" "128"
|
||||
proto_add_ipv6_prefix "${address}/${prefix}"
|
||||
[ -n "${gateway}" ] && {
|
||||
[ -n "${gateway}" ] && [ "$defaultroute" != 0 ] && {
|
||||
echo "adding default IPv6 route via ${gateway}"
|
||||
proto_add_ipv6_route "${gateway}" "128"
|
||||
proto_add_ipv6_route "::0" "0" "${gateway}" "" "" "${address}/${prefix}"
|
||||
|
@ -357,9 +362,9 @@ proto_modemmanager_setup() {
|
|||
|
||||
local device apn allowedauth username password pincode iptype metric signalrate
|
||||
|
||||
local address prefix gateway mtu dns1 dns2
|
||||
local address prefix gateway mtu dns1 dns2 defaultroute
|
||||
|
||||
json_get_vars device apn allowedauth username password pincode iptype metric signalrate
|
||||
json_get_vars device apn allowedauth username password pincode iptype metric signalrate defaultroute
|
||||
|
||||
# validate sysfs path given in config
|
||||
[ -n "${device}" ] || {
|
||||
|
@ -447,7 +452,7 @@ proto_modemmanager_setup() {
|
|||
echo "IPv4 connection setup required in interface ${interface}: ${bearermethod_ipv4}"
|
||||
case "${bearermethod_ipv4}" in
|
||||
"dhcp")
|
||||
modemmanager_connected_method_dhcp_ipv4 "${interface}" "${beareriface}" "${metric}"
|
||||
modemmanager_connected_method_dhcp_ipv4 "${interface}" "${beareriface}" "${metric}" "${defaultroute}"
|
||||
;;
|
||||
"static")
|
||||
address=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv4-config.address")
|
||||
|
@ -456,7 +461,7 @@ proto_modemmanager_setup() {
|
|||
mtu=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv4-config.mtu")
|
||||
dns1=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv4-config.dns.value\[1\]")
|
||||
dns2=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv4-config.dns.value\[2\]")
|
||||
modemmanager_connected_method_static_ipv4 "${interface}" "${beareriface}" "${address}" "${prefix}" "${gateway}" "${mtu}" "${dns1}" "${dns2}" "${metric}"
|
||||
modemmanager_connected_method_static_ipv4 "${interface}" "${beareriface}" "${address}" "${prefix}" "${gateway}" "${mtu}" "${dns1}" "${dns2}" "${metric}" "${defaultroute}"
|
||||
;;
|
||||
"ppp")
|
||||
modemmanager_connected_method_ppp_ipv4 "${interface}" "${beareriface}" "${username}" "${password}" "${allowedauth}"
|
||||
|
@ -474,7 +479,7 @@ proto_modemmanager_setup() {
|
|||
echo "IPv6 connection setup required in interface ${interface}: ${bearermethod_ipv6}"
|
||||
case "${bearermethod_ipv6}" in
|
||||
"dhcp")
|
||||
modemmanager_connected_method_dhcp_ipv6 "${interface}" "${beareriface}" "${metric}"
|
||||
modemmanager_connected_method_dhcp_ipv6 "${interface}" "${beareriface}" "${metric}" "${defaultroute}"
|
||||
;;
|
||||
"static")
|
||||
address=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv6-config.address")
|
||||
|
@ -483,7 +488,7 @@ proto_modemmanager_setup() {
|
|||
mtu=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv6-config.mtu")
|
||||
dns1=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv6-config.dns.value\[1\]")
|
||||
dns2=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv6-config.dns.value\[2\]")
|
||||
modemmanager_connected_method_static_ipv6 "${interface}" "${beareriface}" "${address}" "${prefix}" "${gateway}" "${mtu}" "${dns1}" "${dns2}" "${metric}"
|
||||
modemmanager_connected_method_static_ipv6 "${interface}" "${beareriface}" "${address}" "${prefix}" "${gateway}" "${mtu}" "${dns1}" "${dns2}" "${metric}" "${defaultroute}"
|
||||
;;
|
||||
"ppp")
|
||||
proto_notify_error "${interface}" "unsupported method"
|
||||
|
|
33
modemmanager/files/usr/sbin/ModemManager-wrapper
Executable file
33
modemmanager/files/usr/sbin/ModemManager-wrapper
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh
|
||||
|
||||
trap_with_arg() {
|
||||
func="$1" ; shift
|
||||
for sig ; do
|
||||
# shellcheck disable=SC2064
|
||||
trap "$func $sig" "$sig"
|
||||
done
|
||||
}
|
||||
|
||||
func_trap() {
|
||||
logger "ModemManager-wrapper[$$]" "Sending signal ${1}..."
|
||||
kill "-${1}" "$CHILD" 2>/dev/null
|
||||
}
|
||||
|
||||
main() {
|
||||
. /usr/share/ModemManager/modemmanager.common
|
||||
|
||||
trap_with_arg func_trap INT TERM KILL
|
||||
|
||||
mkdir -p "${MODEMMANAGER_RUNDIR}"
|
||||
chmod 0755 "${MODEMMANAGER_RUNDIR}"
|
||||
mm_cleanup_interfaces
|
||||
|
||||
/usr/sbin/ModemManager "$@" 1>/dev/null 2>/dev/null &
|
||||
CHILD="$!"
|
||||
|
||||
mm_report_events_from_cache
|
||||
|
||||
wait "$CHILD"
|
||||
}
|
||||
|
||||
main "$@"
|
|
@ -24,6 +24,7 @@ define Package/mptcp
|
|||
DEPENDS:=+ip +iptables +ethtool +ipcalc
|
||||
KCONFIG:=\
|
||||
CONFIG_MPTCP=y \
|
||||
CONFIG_MPTCP_IPV6=y \
|
||||
CONFIG_MPTCP_BINDER=y \
|
||||
CONFIG_MPTCP_FULLMESH=y \
|
||||
CONFIG_MPTCP_NDIFFPORTS=y \
|
||||
|
|
|
@ -16,6 +16,9 @@ global_multipath_settings() {
|
|||
config_get multipath globals multipath
|
||||
config_get mptcp_path_manager globals mptcp_path_manager
|
||||
config_get mptcp_scheduler globals mptcp_scheduler
|
||||
config_get mptcp_subflows globals mptcp_subflows "3"
|
||||
config_get mptcp_add_addr_accepted globals mptcp_add_addr_accepted "1"
|
||||
config_get mptcp_add_addr_timeout globals mptcp_add_addr_timeout "120"
|
||||
config_get mptcp_debug globals mptcp_debug
|
||||
config_get congestion globals congestion
|
||||
config_get mptcp_checksum globals mptcp_checksum
|
||||
|
@ -29,18 +32,25 @@ global_multipath_settings() {
|
|||
[ "$multipath" = "enable" ] && multipath_status=1
|
||||
|
||||
# Global MPTCP configuration
|
||||
sysctl -qw net.mptcp.mptcp_enabled="$multipath_status"
|
||||
[ -z "$mptcp_path_manager" ] || sysctl -qw net.mptcp.mptcp_path_manager="$mptcp_path_manager"
|
||||
[ -z "$mptcp_scheduler" ] || sysctl -qw net.mptcp.mptcp_scheduler="$mptcp_scheduler"
|
||||
[ -z "$congestion" ] || sysctl -qw net.ipv4.tcp_congestion_control="$congestion"
|
||||
[ -z "$mptcp_checksum" ] || sysctl -qw net.mptcp.mptcp_checksum="$mptcp_checksum"
|
||||
[ -z "$mptcp_debug" ] || sysctl -qw net.mptcp.mptcp_debug="$mptcp_debug"
|
||||
[ -z "$mptcp_syn_retries" ] || sysctl -qw net.mptcp.mptcp_syn_retries="$mptcp_syn_retries"
|
||||
[ -z "$mptcp_fullmesh_num_subflows" ] || sysctl -qw /sys/module/mptcp_fullmesh/parameters/num_subflows="$mptcp_fullmesh_num_subflows"
|
||||
[ -z "$mptcp_fullmesh_create_on_err" ] || sysctl -qw /sys/module/mptcp_fullmesh/parameters/create_on_err="$mptcp_fullmesh_create_on_err"
|
||||
[ -z "$mptcp_ndiffports_num_subflows" ] || sysctl -qw /sys/module/mptcp_ndiffports/parameters/num_subflows="$mptcp_ndiffports_num_subflows"
|
||||
[ -z "$mptcp_rr_cwnd_limited" ] || sysctl -qw /sys/module/mptcp_rr/parameters/cwnd_limited="$mptcp_rr_cwnd_limited"
|
||||
[ -z "$mptcp_rr_num_segments" ] || sysctl -qw /sys/module/mptcp_rr/parameters/num_segments="$mptcp_rr_num_segments"
|
||||
if [ -f /proc/sys/net/mptcp/mptcp_enabled ]; then
|
||||
sysctl -qew net.mptcp.mptcp_enabled="$multipath_status"
|
||||
[ -z "$mptcp_path_manager" ] || sysctl -qew net.mptcp.mptcp_path_manager="$mptcp_path_manager"
|
||||
[ -z "$mptcp_scheduler" ] || sysctl -qew net.mptcp.mptcp_scheduler="$mptcp_scheduler"
|
||||
[ -z "$mptcp_checksum" ] || sysctl -qew net.mptcp.mptcp_checksum="$mptcp_checksum"
|
||||
[ -z "$mptcp_debug" ] || sysctl -qew net.mptcp.mptcp_debug="$mptcp_debug"
|
||||
[ -z "$mptcp_syn_retries" ] || sysctl -qew net.mptcp.mptcp_syn_retries="$mptcp_syn_retries"
|
||||
[ -z "$mptcp_fullmesh_num_subflows" ] || sysctl -qew /sys/module/mptcp_fullmesh/parameters/num_subflows="$mptcp_fullmesh_num_subflows"
|
||||
[ -z "$mptcp_fullmesh_create_on_err" ] || sysctl -qew /sys/module/mptcp_fullmesh/parameters/create_on_err="$mptcp_fullmesh_create_on_err"
|
||||
[ -z "$mptcp_ndiffports_num_subflows" ] || sysctl -qew /sys/module/mptcp_ndiffports/parameters/num_subflows="$mptcp_ndiffports_num_subflows"
|
||||
[ -z "$mptcp_rr_cwnd_limited" ] || sysctl -qew /sys/module/mptcp_rr/parameters/cwnd_limited="$mptcp_rr_cwnd_limited"
|
||||
[ -z "$mptcp_rr_num_segments" ] || sysctl -qew /sys/module/mptcp_rr/parameters/num_segments="$mptcp_rr_num_segments"
|
||||
else
|
||||
sysctl -qew net.mptcp.enabled="$multipath_status"
|
||||
ip mptcp limits set add_addr_accepted $mptcp_add_addr_accepted subflows $mptcp_subflows 2>&1 >/dev/null
|
||||
[ -z "$mptcp_add_addr_timeout" ] || sysctl -qew net.mptcp.add_addr_timeout="$mptcp_add_addr_timeout"
|
||||
[ -z "$mptcp_checksum" ] || sysctl -qew net.mptcp.checksum_enabled="$mptcp_checksum"
|
||||
fi
|
||||
[ -z "$congestion" ] || sysctl -qew net.ipv4.tcp_congestion_control="$congestion"
|
||||
}
|
||||
|
||||
interface_macaddr_count() {
|
||||
|
@ -202,6 +212,7 @@ interface_multipath_settings() {
|
|||
[ -n "$netmask" ] && [ "$(echo $netmask | grep '/')" != "" ] && netmask=""
|
||||
[ -z "$netmask" ] && netmask=$(ip -4 addr show dev $iface | grep peer | awk '{print $4}' | cut -d/ -f2 | tr -d "\n")
|
||||
[ -z "$netmask" ] && netmask=$(ip -4 addr show dev $iface | grep inet | awk '{print $2}' | cut -d/ -f2 | tr -d "\n")
|
||||
[ -n "$ipaddr" ] && ipaddr=$(echo $ipaddr | cut -d/ -f1 | tr -d "\n")
|
||||
[ -n "$ipaddr" ] && [ -n "$netmask" ] && netmask=`ipcalc.sh $ipaddr $netmask | sed -n '/PREFIX=/{;s/.*=//;s/ .*//;p;}'`
|
||||
[ -n "$ipaddr" ] && [ -n "$netmask" ] && network=`ipcalc.sh $ipaddr $netmask | sed -n '/NETWORK=/{;s/.*=//;s/ .*//;p;}'`
|
||||
fi
|
||||
|
@ -255,10 +266,10 @@ interface_multipath_settings() {
|
|||
|
||||
#config_get mode "$config" multipath ""
|
||||
#[ "$mode" = "" ] && mode="$(uci -q get openmptcprouter.${config}.multipath)"
|
||||
[ "$mode" = "master" ] && {
|
||||
#echo "ip route replace default via $gateway dev $iface"
|
||||
ip route replace default via $gateway dev $iface 2>&1 >/dev/null
|
||||
}
|
||||
#[ "$mode" = "master" ] && {
|
||||
# #echo "ip route replace default via $gateway dev $iface"
|
||||
# ip route replace default via $gateway dev $iface 2>&1 >/dev/null
|
||||
#}
|
||||
if [ "$txqueuelen" != "" ]; then
|
||||
ifconfig $iface txqueuelen $txqueuelen > /dev/null 2>&1
|
||||
else
|
||||
|
@ -278,20 +289,20 @@ interface_multipath_settings() {
|
|||
ip6addr=`echo $ip6addr | cut -d/ -f1`
|
||||
netmask6=`ipcalc $ipaddr6 | sed -n '/PREFIX=/{;s/.*=//;s/ .*//;p;}'`
|
||||
network6=`ipcalc $ip6addr | sed -n '/NETWORK=/{;s/.*=//;s/ .*//;p;}'`
|
||||
if [ -z "$ip6addr" ] || [ -z "$network6" ]; then
|
||||
ip6addr=$(ip -6 addr show dev $iface | grep -v 'scope link' | grep inet6 | awk '{print $2}' | cut -d/ -f1 | tr -d "\n")
|
||||
gateway6=$(ip -6 r list dev $iface | grep -v default | awk '/proto static/ {print $1}' | tr -d "\n")
|
||||
[ -z "$gateway6" ] && gateway6=$(uci -q get "network.$config.ip6gw")
|
||||
[ -z "$gateway6" ] && gateway6=$(ubus call network.interface.$config status | jsonfilter -q -l 1 -e '@.inactive.route[@.target="::"].nexthop' | tr -d "\n")
|
||||
if [ -z "$gateway6" ] || [ "$( valid_subnet6 $gateway6 )" != "ok" ]; then
|
||||
gateway6=$(ubus call network.interface.$config status | jsonfilter -q -l 1 -e '@.route[@.target="::"].nexthop' | tr -d "\n")
|
||||
fi
|
||||
if [ -z "$gateway6" ] || [ "$( valid_subnet6 $gateway6 )" != "ok" ]; then
|
||||
gateway6=$(ubus call network.interface.${config}_6 status 2>/dev/null | jsonfilter -q -l 1 -e '@.inactive.route[@.target="::"].nexthop' | tr -d "\n")
|
||||
fi
|
||||
netmask6=$(ip -6 addr show dev $iface | grep -v 'scope link' | grep inet6 | awk '{print $2}' | cut -d/ -f2 | tr -d "\n")
|
||||
network6=`ipcalc $ip6addr | sed -n '/NETWORK=/{;s/.*=//;s/ .*//;p;}'`
|
||||
fi
|
||||
if [ -z "$ip6addr" ] || [ -z "$network6" ]; then
|
||||
ip6addr=$(ip -6 addr show dev $iface | grep -v 'scope link' | grep inet6 | awk '{print $2}' | cut -d/ -f1 | tr -d "\n")
|
||||
gateway6=$(ip -6 r list dev $iface | grep -v default | awk '/proto static/ {print $1}' | tr -d "\n")
|
||||
[ -z "$gateway6" ] && gateway6=$(uci -q get "network.$config.ip6gw")
|
||||
[ -z "$gateway6" ] && gateway6=$(ubus call network.interface.$config status | jsonfilter -q -l 1 -e '@.inactive.route[@.target="::"].nexthop' | tr -d "\n")
|
||||
if [ -z "$gateway6" ] || [ "$( valid_subnet6 $gateway6 )" != "ok" ]; then
|
||||
gateway6=$(ubus call network.interface.$config status | jsonfilter -q -l 1 -e '@.route[@.target="::"].nexthop' | tr -d "\n")
|
||||
fi
|
||||
if [ -z "$gateway6" ] || [ "$( valid_subnet6 $gateway6 )" != "ok" ]; then
|
||||
gateway6=$(ubus call network.interface.${config}_6 status 2>/dev/null | jsonfilter -q -l 1 -e '@.inactive.route[@.target="::"].nexthop' | tr -d "\n")
|
||||
fi
|
||||
netmask6=$(ip -6 addr show dev $iface | grep -v 'scope link' | grep inet6 | awk '{print $2}' | cut -d/ -f2 | tr -d "\n")
|
||||
network6=`ipcalc $ip6addr | sed -n '/NETWORK=/{;s/.*=//;s/ .*//;p;}'`
|
||||
fi
|
||||
if [ "$(uci -q get openmptcprouter.settings.uci_route)" = "1" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
|
@ -304,7 +315,7 @@ interface_multipath_settings() {
|
|||
[ -n "$(ip -6 rule list | grep 6$id)" ] && ip -6 rule del table 6$id > /dev/null 2>&1
|
||||
ip -6 route flush 6$id > /dev/null 2>&1
|
||||
fi
|
||||
if [ -n "$ip6addr" ] && [ -n "$gateway6" ] && [ -n "$network6" ]; then
|
||||
if [ -n "$gateway6" ] && [ -n "$network6" ]; then
|
||||
if [ "$(uci -q get openmptcprouter.settings.uci_route)" = "1" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete network.${config}_rule6
|
||||
|
@ -329,18 +340,18 @@ interface_multipath_settings() {
|
|||
commit network
|
||||
EOF
|
||||
else
|
||||
ip -6 rule add from $ip6addr table 6$id pref 0 2>&1 >/dev/null
|
||||
[ -n "$ip6addr" ] && ip -6 rule add from $ip6addr table 6$id pref 0 2>&1 >/dev/null
|
||||
ip -6 route replace $network6/$netmask6 dev $iface scope link metric 6$id 2>&1 >/dev/null
|
||||
ip -6 route replace $network6/$netmask6 dev $iface scope link table 6$id 2>&1 >/dev/null
|
||||
ip -6 route replace default via $gateway6 dev $iface table 6$id 2>&1 >/dev/null
|
||||
ip -6 route replace default via $gateway6 dev $iface metric 6$id 2>&1 >/dev/null
|
||||
ip -6 route flush 6$id 2>&1 >/dev/null
|
||||
#ip -6 route flush 6$id 2>&1 >/dev/null
|
||||
fi
|
||||
|
||||
#config_get mode "$config" multipath "off"
|
||||
[ "$mode" = "master" ] && {
|
||||
ip -6 route replace default via $gateway6 dev $iface 2>&1 >/dev/null
|
||||
}
|
||||
#[ "$mode" = "master" ] && {
|
||||
# ip -6 route replace default via $gateway6 dev $iface 2>&1 >/dev/null
|
||||
#}
|
||||
#[ "$mode" = "off" ] && {
|
||||
# ifconfig $iface txqueuelen 50 > /dev/null 2>&1
|
||||
#} || {
|
||||
|
@ -351,7 +362,9 @@ interface_multipath_settings() {
|
|||
}
|
||||
|
||||
load_interfaces() {
|
||||
ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
|
||||
network_get_device ifname $1
|
||||
[ -z "$ifname" ] && network_get_physdev ifname $1
|
||||
[ -z "$ifname" ] && config_get ifname "$1" device
|
||||
[ -z "$ifname" ] && config_get ifname "$1" ifname
|
||||
config_get multipath "$1" multipath ""
|
||||
[ -z "$multipath" ] && multipath="$(uci -q get openmptcprouter.$1.multipath)"
|
||||
|
@ -476,6 +489,10 @@ start_service() {
|
|||
[ -n "$(ubus call system board | jsonfilter -e '@.board_name' | grep raspberry)" ] && [ -z "$(ubus call system board | jsonfilter -e '@.board_name' | grep '4-model-b')" ] && {
|
||||
ethtool --offload eth0 rx off tx off > /dev/null 2>&1
|
||||
}
|
||||
[ -n "$(ubus call system board | jsonfilter -e '@.board_name' | grep -i r2s)" ] && {
|
||||
ethtool -K eth0 rx off tx off > /dev/null 2>&1
|
||||
ethtool -K eth1 rx off tx off > /dev/null 2>&1
|
||||
}
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
|
|
|
@ -8,6 +8,9 @@ if [ "$(uci -q get network.globals.mptcp_path_manager)" = "" ]; then
|
|||
set network.globals.mptcp_checksum=0
|
||||
set network.globals.mptcp_debug=0
|
||||
set network.globals.mptcp_syn_retries=2
|
||||
set network.globals.mptcp_subflows=3
|
||||
set network.globals.mptcp_add_addr_accepted=1
|
||||
set network.globals.mptcp_add_addr_timeout=120
|
||||
commit network
|
||||
EOF
|
||||
fi
|
||||
|
@ -53,6 +56,15 @@ if [ "$(uci -q show network.globals | grep mptcp_fullmesh)" = "" ]; then
|
|||
commit network
|
||||
EOF
|
||||
fi
|
||||
if [ "$(uci -q get network.globals.mptcp_subflows)" = "" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set network.globals.mptcp_subflows=3
|
||||
set network.globals.mptcp_add_addr_accepted=1
|
||||
set network.globals.mptcp_add_addr_timeout=120
|
||||
commit network
|
||||
EOF
|
||||
fi
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@mptcp[-1]
|
||||
add ucitrack mptcp
|
||||
|
|
|
@ -6,15 +6,12 @@
|
|||
# Released under GPL 3 or later
|
||||
|
||||
if [ -d "/proc/sys/net/mptcp" ]; then
|
||||
if [ `cat /proc/sys/net/mptcp/mptcp_enabled` = 0 ]; then
|
||||
if ([ -f /proc/sys/net/mptcp/mptcp_enabled ] && [ `cat /proc/sys/net/mptcp/mptcp_enabled` = 0 ]) || ([ -f /proc/sys/net/mptcp/enabled ] && [ `cat /proc/sys/net/mptcp/enabled` = 0 ]); then
|
||||
echo "MPTCP is disabled!"
|
||||
echo "Please set net.mptcp.mptcp_enabled = 1"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Your device don't support multipath-TCP."
|
||||
echo "You have to install the pached kernel to use MPTCP."
|
||||
echo "See http://multipath-tcp.org/ for details"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -23,7 +20,11 @@ case $1 in
|
|||
echo " Multipath-TCP configuration tool"
|
||||
echo "show/update flags:"
|
||||
echo " multipath [device]"
|
||||
echo " multipath device {on | off | backup | handover}"
|
||||
if [ -f /proc/sys/net/mptcp/mptcp_enabled ]; then
|
||||
echo " multipath device {on | off | backup }"
|
||||
else
|
||||
echo " multipath device {on | off | signal | backup }"
|
||||
fi
|
||||
echo
|
||||
echo "show established conections: -c"
|
||||
echo "show fullmesh info: -f"
|
||||
|
@ -33,24 +34,46 @@ case $1 in
|
|||
echo "will allow a subflow to be established across this interface, but only be used"
|
||||
echo "as backup. Handover-flag indicates that his interface is not used at all (even "
|
||||
echo "no subflow being established), as long as there are other interfaces available."
|
||||
echo "See http://multipath-tcp.org/ for details"
|
||||
echo
|
||||
exit 0 ;;
|
||||
"-c")
|
||||
cat /proc/net/mptcp_net/mptcp
|
||||
if [ -f /proc/net/mptcp_net/mptcp ]; then
|
||||
cat /proc/net/mptcp_net/mptcp
|
||||
else
|
||||
ss -M
|
||||
fi
|
||||
exit 0;;
|
||||
"-f")
|
||||
cat /proc/net/mptcp_fullmesh
|
||||
if [ -f /proc/net/mptcp_fullmesh ]; then
|
||||
cat /proc/net/mptcp_fullmesh
|
||||
else
|
||||
ip mptcp endpoint | grep fullmesh
|
||||
fi
|
||||
exit 0;;
|
||||
"-k")
|
||||
echo Enabled: `cat /proc/sys/net/mptcp/mptcp_enabled`
|
||||
echo Path Manager: `cat /proc/sys/net/mptcp/mptcp_path_manager`
|
||||
echo Use checksum: `cat /proc/sys/net/mptcp/mptcp_checksum`
|
||||
echo Scheduler: `cat /proc/sys/net/mptcp/mptcp_scheduler`
|
||||
echo Syn retries: `cat /proc/sys/net/mptcp/mptcp_syn_retries`
|
||||
echo Debugmode: `cat /proc/sys/net/mptcp/mptcp_debug`
|
||||
if [ -f /proc/sys/net/mptcp/mptcp_enabled ]; then
|
||||
echo Enabled: `cat /proc/sys/net/mptcp/mptcp_enabled`
|
||||
elif [ -f /proc/sys/net/mptcp/enabled ]; then
|
||||
echo Enabled: `cat /proc/sys/net/mptcp/enabled`
|
||||
fi
|
||||
if [ -f /proc/sys/net/mptcp/mptcp_path_manager ]; then
|
||||
echo Path Manager: `cat /proc/sys/net/mptcp/mptcp_path_manager`
|
||||
fi
|
||||
if [ -f /proc/sys/net/mptcp/mptcp_checksum ]; then
|
||||
echo Use checksum: `cat /proc/sys/net/mptcp/mptcp_checksum`
|
||||
else
|
||||
echo Use checksum: `cat /proc/sys/net/mptcp/checksum_enabled`
|
||||
fi
|
||||
if [ -f /proc/sys/net/mptcp/mptcp_scheduler ]; then
|
||||
echo Scheduler: `cat /proc/sys/net/mptcp/mptcp_scheduler`
|
||||
fi
|
||||
if [ -f /proc/sys/net/mptcp/mptcp_syn_retries ]; then
|
||||
echo Syn retries: `cat /proc/sys/net/mptcp/mptcp_syn_retries`
|
||||
fi
|
||||
if [ -f /proc/sys/net/mptcp/mptcp_debug ]; then
|
||||
echo Debugmode: `cat /proc/sys/net/mptcp/mptcp_debug`
|
||||
fi
|
||||
echo
|
||||
echo See http://multipath-tcp.org/ for details
|
||||
exit 0 ;;
|
||||
"")
|
||||
for ifpath in /sys/class/net/*; do
|
||||
|
@ -70,33 +93,68 @@ TYPE="$2"
|
|||
exit 1
|
||||
}
|
||||
|
||||
FLAG_PATH="/sys/class/net/$DEVICE/flags"
|
||||
IFF=`cat $FLAG_PATH`
|
||||
if [ -f /proc/sys/net/mptcp/mptcp_enabled ]; then
|
||||
FLAG_PATH="/sys/class/net/$DEVICE/flags"
|
||||
IFF=`cat $FLAG_PATH`
|
||||
|
||||
IFF_OFF="0x80000"
|
||||
IFF_ON="0x00"
|
||||
IFF_BACKUP="0x100000"
|
||||
IFF_HANDOVER="0x200000"
|
||||
IFF_MASK="0x380000"
|
||||
IFF_OFF="0x80000"
|
||||
IFF_ON="0x00"
|
||||
IFF_BACKUP="0x100000"
|
||||
IFF_HANDOVER="0x200000"
|
||||
IFF_MASK="0x380000"
|
||||
|
||||
case $TYPE in
|
||||
"off") FLAG=$IFF_OFF;;
|
||||
"on") FLAG=$IFF_ON;;
|
||||
"backup") FLAG=$IFF_BACKUP;;
|
||||
"handover") FLAG=$IFF_HANDOVER;;
|
||||
"")
|
||||
IFF=`printf "0x%02x" $(($IFF&$IFF_MASK))`
|
||||
case "$IFF" in
|
||||
$IFF_OFF) echo $DEVICE is deactivated;;
|
||||
$IFF_ON) echo $DEVICE is in default mode;;
|
||||
$IFF_BACKUP) echo $DEVICE is in backup mode;;
|
||||
$IFF_HANDOVER) echo $DEVICE is in handover mode;;
|
||||
*) echo "Unkown state!" && exit 1;;
|
||||
esac
|
||||
exit 0;;
|
||||
*) echo "Unkown flag! Use 'multipath -h' for help" && exit 1;;
|
||||
esac
|
||||
case $TYPE in
|
||||
"off") FLAG=$IFF_OFF;;
|
||||
"on") FLAG=$IFF_ON;;
|
||||
"backup") FLAG=$IFF_BACKUP;;
|
||||
"handover") FLAG=$IFF_HANDOVER;;
|
||||
"")
|
||||
IFF=`printf "0x%02x" $(($IFF&$IFF_MASK))`
|
||||
case "$IFF" in
|
||||
$IFF_OFF) echo $DEVICE is deactivated;;
|
||||
$IFF_ON) echo $DEVICE is in default mode;;
|
||||
$IFF_BACKUP) echo $DEVICE is in backup mode;;
|
||||
$IFF_HANDOVER) echo $DEVICE is in handover mode;;
|
||||
*) echo "Unkown state!" && exit 1;;
|
||||
esac
|
||||
exit 0;;
|
||||
*) echo "Unkown flag! Use 'multipath -h' for help" && exit 1;;
|
||||
esac
|
||||
|
||||
printf "0x%02x" $(($(($IFF^$(($IFF&$IFF_MASK))))|$FLAG)) > $FLAG_PATH
|
||||
printf "0x%02x" $(($(($IFF^$(($IFF&$IFF_MASK))))|$FLAG)) > $FLAG_PATH
|
||||
else
|
||||
ID=$(ip mptcp endpoint show | grep "dev $DEVICE" | awk '{print $3}')
|
||||
IFF=$(ip mptcp endpoint show | grep "dev $DEVICE" | awk '{print $4}')
|
||||
IP=$(ifconfig $DEVICE | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
|
||||
case $TYPE in
|
||||
"off")
|
||||
[ -n "$ID" ] && ip mptcp endpoint delete id $ID 2>&1 >/dev/null
|
||||
exit 0;;
|
||||
"on")
|
||||
[ -n "$ID" ] && ip mptcp endpoint delete id $ID 2>&1 >/dev/null
|
||||
ip mptcp endpoint add $IP dev $DEVICE subflow fullmesh
|
||||
exit 0;;
|
||||
"signal")
|
||||
[ -n "$ID" ] && ip mptcp endpoint delete id $ID 2>&1 >/dev/null
|
||||
#ip mptcp endpoint add $IP dev $DEVICE signal subflow fullmesh
|
||||
ip mptcp endpoint add $IP dev $DEVICE signal
|
||||
exit 0;;
|
||||
"backup")
|
||||
[ -n "$ID" ] && ip mptcp endpoint delete id $ID 2>&1 >/dev/null
|
||||
ip mptcp endpoint add $IP dev $DEVICE backup fullmesh
|
||||
exit 0;;
|
||||
"")
|
||||
case "$IFF" in
|
||||
"") echo $DEVICE is deactivated;;
|
||||
"subflow") echo $DEVICE is in default mode;;
|
||||
"backup") echo $DEVICE is in backup mode;;
|
||||
"signal") echo $DEVICE is in signal mode;;
|
||||
"fullmesh") echo $DEVICE is in fullmesh mode;;
|
||||
*) echo "$DEVICE Unkown state!" && exit 1;;
|
||||
esac
|
||||
exit 0;;
|
||||
*) echo "Unkown flag! Use 'multipath -h' for help" && exit 1;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,20 +1,45 @@
|
|||
SETROUTE=false
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
||||
find_network_device() {
|
||||
local device="${1}"
|
||||
local device_section=""
|
||||
|
||||
check_device() {
|
||||
local cfg="${1}"
|
||||
local device="${2}"
|
||||
|
||||
local type name
|
||||
config_get name "${cfg}" name
|
||||
|
||||
[ "${name}" = "${device}" ] && device_section="${cfg}"
|
||||
}
|
||||
if [ ! -z "$device" ]; then
|
||||
config_load network
|
||||
config_foreach check_device device "$(uci -q network.${device}.device)"
|
||||
fi
|
||||
echo "${device_section}"
|
||||
}
|
||||
|
||||
set_route() {
|
||||
local multipath_config_route interface_gw interface_if
|
||||
INTERFACE=$1
|
||||
PREVINTERFACE=$2
|
||||
SETDEFAULT=$3
|
||||
[ -z "$SETDEFAULT" ] && SETDEFAULT="yes"
|
||||
[ -z "$INTERFACE" ] && return
|
||||
multipath_config_route=$(uci -q get openmptcprouter.$INTERFACE.multipath)
|
||||
[ -z "$multipath_config_route" ] && multipath_config_route=$(uci -q get network.$INTERFACE.multipath || echo "off")
|
||||
[ "$(uci -q get openmptcprouter.$INTERFACE.multipathvpn)" = "1" ] && {
|
||||
[ "$(uci -q get openmptcprouter.settings.mptcpovervpn)" = "openvpn" ] && multipath_config_route="$(uci -q get openmptcprouter.ovpn${INTERFACE}.multipath || echo "off")"
|
||||
[ "$(uci -q get openmptcprouter.settings.mptcpovervpn)" = "wireguard" ] && multipath_config_route="$(uci -q get openmptcprouter.wg${INTERFACE}.multipath || echo "off")"
|
||||
}
|
||||
interface_if=$(ifstatus "$INTERFACE" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
network_get_device interface_if $INTERFACE
|
||||
interface_up=$(ifstatus "$INTERFACE" 2>/dev/null | jsonfilter -q -e '@["up"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "$INTERFACE" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "${INTERFACE}_4" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(uci -q get network.$INTERFACE.device)
|
||||
[ -z "$interface_if" ] && interface_if=$(uci -q get network.$INTERFACE.ifname)
|
||||
[ -n "$(echo $interface_if | grep '@')" ] && interface_if=$(ifstatus "${INTERFACE}" | jsonfilter -q -e '@["device"]')
|
||||
interface_current_config=$(uci -q get openmptcprouter.$INTERFACE.state || echo "up")
|
||||
|
@ -30,7 +55,8 @@ set_route() {
|
|||
interface_gw=$(ubus call network.interface.${INTERFACE}_4 status 2>/dev/null | jsonfilter -q -l 1 -e '@.inactive.route[@.target="0.0.0.0"].nexthop' | tr -d "\n")
|
||||
fi
|
||||
if [ "$interface_gw" != "" ] && [ "$interface_if" != "" ]; then
|
||||
[ "$(uci -q get openmptcprouter.settings.debug)" = "true" ] && _log "$PREVINTERFACE down. Replace default route by $interface_gw dev $interface_if"
|
||||
[ "$(uci -q get openmptcprouter.settings.debug)" = "true" ] && [ "$SETDEFAULT" = "yes" ] && _log "$PREVINTERFACE down. Replace default route by $interface_gw dev $interface_if"
|
||||
[ "$(uci -q get openmptcprouter.settings.debug)" = "true" ] && [ "$SETDEFAULT" != "yes" ] && _log "$PREVINTERFACE down. Replace default in table 991337 route by $interface_gw dev $interface_if"
|
||||
[ "$SETDEFAULT" = "yes" ] && ip route replace default scope global nexthop via $interface_gw dev $interface_if 2>&1 >/dev/null
|
||||
ip route replace default via $interface_gw dev $interface_if table 991337 2>&1 >/dev/null && SETROUTE=true
|
||||
fi
|
||||
|
@ -43,15 +69,18 @@ set_route6() {
|
|||
PREVINTERFACE=$2
|
||||
SETDEFAULT=$3
|
||||
[ -z "$SETDEFAULT" ] && SETDEFAULT="yes"
|
||||
[ -z "$INTERFACE" ] && return
|
||||
multipath_config_route=$(uci -q get openmptcprouter.$INTERFACE.multipath)
|
||||
[ -z "$multipath_config_route" ] && multipath_config_route=$(uci -q get network.$INTERFACE.multipath || echo "off")
|
||||
[ "$(uci -q get openmptcprouter.$INTERFACE.multipathvpn)" = "1" ] && {
|
||||
[ "$(uci -q get openmptcprouter.settings.mptcpovervpn)" = "openvpn" ] && multipath_config_route="$(uci -q get openmptcprouter.ovpn${INTERFACE}.multipath || echo "off")"
|
||||
[ "$(uci -q get openmptcprouter.settings.mptcpovervpn)" = "wireguard" ] && multipath_config_route="$(uci -q get openmptcprouter.wg${INTERFACE}.multipath || echo "off")"
|
||||
}
|
||||
interface_if=$(ifstatus "$INTERFACE" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
network_get_device interface_if $INTERFACE
|
||||
interface_up=$(ifstatus "$INTERFACE" 2>/dev/null | jsonfilter -q -e '@["up"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "$INTERFACE" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "${INTERFACE}_4" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(uci -q get network.$INTERFACE.device)
|
||||
[ -z "$interface_if" ] && interface_if=$(uci -q get network.$INTERFACE.ifname)
|
||||
[ -n "$(echo $interface_if | grep '@')" ] && interface_if=$(ifstatus "$INTERFACE" | jsonfilter -q -e '@["device"]')
|
||||
interface_current_config=$(uci -q get openmptcprouter.$INTERFACE.state || echo "up")
|
||||
|
@ -82,6 +111,7 @@ set_server_default_route() {
|
|||
[ -n "$serverip" ] && serverip="$(resolveip -4 -t 5 $serverip | head -n 1 | tr -d '\n')"
|
||||
config_get disabled $server disabled
|
||||
[ "$disabled" = "1" ] && return
|
||||
[ -z "$OMR_TRACKER_INTERFACE" ] && return
|
||||
multipath_config_route=$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipath)
|
||||
[ -z "$multipath_config_route" ] && multipath_config_route=$(uci -q get network.$OMR_TRACKER_INTERFACE.multipath || echo "off")
|
||||
[ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipathvpn)" = "1" ] && {
|
||||
|
@ -107,6 +137,7 @@ set_server_default_route6() {
|
|||
[ -n "$serverip" ] && serverip="$(resolveip -6 -t 5 $serverip | head -n 1 | tr -d '\n')"
|
||||
config_get disabled $server disabled
|
||||
[ "$disabled" = "1" ] && return
|
||||
[ -z "$OMR_TRACKER_INTERFACE" ] && return
|
||||
multipath_config_route=$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipath)
|
||||
[ -z "$multipath_config_route" ] && multipath_config_route=$(uci -q get network.$OMR_TRACKER_INTERFACE.multipath || echo "off")
|
||||
[ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipathvpn)" = "1" ] && {
|
||||
|
@ -157,14 +188,17 @@ delete_server_default_route6() {
|
|||
set_routes_intf() {
|
||||
local multipath_config_route
|
||||
local INTERFACE=$1
|
||||
[ -z "$INTERFACE" ] && return
|
||||
multipath_config_route=$(uci -q get openmptcprouter.$INTERFACE.multipath)
|
||||
[ -z "$multipath_config_route" ] && multipath_config_route=$(uci -q get network.$INTERFACE.multipath || echo "off")
|
||||
[ "$(uci -q get openmptcprouter.$INTERFACE.multipathvpn)" = "1" ] && {
|
||||
[ "$(uci -q get openmptcprouter.settings.mptcpovervpn)" = "openvpn" ] && multipath_config_route="$(uci -q get openmptcprouter.ovpn${INTERFACE}.multipath || echo "off")"
|
||||
[ "$(uci -q get openmptcprouter.settings.mptcpovervpn)" = "wireguard" ] && multipath_config_route="$(uci -q get openmptcprouter.wg${INTERFACE}.multipath || echo "off")"
|
||||
}
|
||||
interface_if=$(ifstatus "$INTERFACE" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
network_get_device interface_if $INTERFACE
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "$INTERFACE" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "${INTERFACE}_4" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(uci -q get network.$INTERFACE.device)
|
||||
[ -z "$interface_if" ] && interface_if=$(uci -q get network.$INTERFACE.ifname)
|
||||
[ -n "$(echo $interface_if | grep '@')" ] && ifname=$(ifstatus "$INTERFACE" | jsonfilter -q -e '@["device"]')
|
||||
interface_up=$(ifstatus "$INTERFACE" 2>/dev/null | jsonfilter -q -e '@["up"]')
|
||||
|
@ -211,14 +245,17 @@ set_routes_intf() {
|
|||
set_routes_intf6() {
|
||||
local multipath_config_route
|
||||
local INTERFACE=$1
|
||||
[ -z "$INTERFACE" ] && return
|
||||
multipath_config_route=$(uci -q get openmptcprouter.$INTERFACE.multipath)
|
||||
[ -z "$multipath_config_route" ] && multipath_config_route=$(uci -q get network.$INTERFACE.multipath || echo "off")
|
||||
[ "$(uci -q get openmptcprouter.$INTERFACE.multipathvpn)" = "1" ] && {
|
||||
[ "$(uci -q get openmptcprouter.settings.mptcpovervpn)" = "openvpn" ] && multipath_config_route="$(uci -q get openmptcprouter.ovpn${INTERFACE}.multipath || echo "off")"
|
||||
[ "$(uci -q get openmptcprouter.settings.mptcpovervpn)" = "wireguard" ] && multipath_config_route="$(uci -q get openmptcprouter.wg${INTERFACE}.multipath || echo "off")"
|
||||
}
|
||||
interface_if=$(ifstatus "$INTERFACE" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
network_get_device interface_if $INTERFACE
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "$INTERFACE" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "${INTERFACE}_6" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(uci -q get network.$INTERFACE.device)
|
||||
[ -z "$interface_if" ] && interface_if=$(uci -q get network.$INTERFACE.ifname)
|
||||
[ -n "$(echo $interface_if | grep '@')" ] && interface_if=$(ifstatus "$INTERFACE" | jsonfilter -q -e '@["device"]')
|
||||
interface_up=$(ifstatus "$INTERFACE" 2>/dev/null | jsonfilter -q -e '@["up"]')
|
||||
|
@ -281,14 +318,17 @@ set_routes_intf6() {
|
|||
set_route_balancing() {
|
||||
local multipath_config_route interface_gw interface_if
|
||||
INTERFACE=$1
|
||||
[ -z "$INTERFACE" ] && return
|
||||
multipath_config_route=$(uci -q get openmptcprouter.$INTERFACE.multipath)
|
||||
[ -z "$multipath_config_route" ] && multipath_config_route=$(uci -q get network.$INTERFACE.multipath || echo "off")
|
||||
[ "$(uci -q get openmptcprouter.$INTERFACE.multipathvpn)" = "1" ] && {
|
||||
[ "$(uci -q get openmptcprouter.settings.mptcpovervpn)" = "openvpn" ] && multipath_config_route="$(uci -q get openmptcprouter.ovpn${INTERFACE}.multipath || echo "off")"
|
||||
[ "$(uci -q get openmptcprouter.settings.mptcpovervpn)" = "wireguard" ] && multipath_config_route="$(uci -q get openmptcprouter.wg${INTERFACE}.multipath || echo "off")"
|
||||
}
|
||||
interface_if=$(ifstatus "$INTERFACE" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
network_get_device interface_if $INTERFACE
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "$INTERFACE" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "${INTERFACE}_4" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(uci -q get network.$INTERFACE.device)
|
||||
[ -z "$interface_if" ] && interface_if=$(uci -q get network.$INTERFACE.ifname)
|
||||
[ -n "$(echo $interface_if | grep '@')" ] && interface_if=$(ifstatus "$INTERFACE" | jsonfilter -q -e '@["device"]')
|
||||
interface_up=$(ifstatus "$INTERFACE" 2>/dev/null | jsonfilter -q -e '@["up"]')
|
||||
|
@ -329,14 +369,17 @@ set_route_balancing() {
|
|||
set_route_balancing6() {
|
||||
local multipath_config_route interface_gw interface_if
|
||||
INTERFACE=$1
|
||||
[ -z "$INTERFACE" ] && return
|
||||
multipath_config_route=$(uci -q get openmptcprouter.$INTERFACE.multipath)
|
||||
[ -z "$multipath_config_route" ] && multipath_config_route=$(uci -q get network.$INTERFACE.multipath || echo "off")
|
||||
[ "$(uci -q get openmptcprouter.$INTERFACE.multipathvpn)" = "1" ] && {
|
||||
[ "$(uci -q get openmptcprouter.settings.mptcpovervpn)" = "openvpn" ] && multipath_config_route="$(uci -q get openmptcprouter.ovpn${INTERFACE}.multipath || echo "off")"
|
||||
[ "$(uci -q get openmptcprouter.settings.mptcpovervpn)" = "wireguard" ] && multipath_config_route="$(uci -q get openmptcprouter.wg${INTERFACE}.multipath || echo "off")"
|
||||
}
|
||||
interface_if=$(ifstatus "$INTERFACE" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
network_get_device interface_if $INTERFACE
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "$INTERFACE" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "${INTERFACE}_4" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(uci -q get network.$INTERFACE.device)
|
||||
[ -z "$interface_if" ] && interface_if=$(uci -q get network.$INTERFACE.ifname)
|
||||
[ -n "$(echo $interface_if | grep '@')" ] && interface_if=$(ifstatus "$INTERFACE" | jsonfilter -q -e '@["device"]')
|
||||
interface_up=$(ifstatus "$INTERFACE" 2>/dev/null | jsonfilter -q -e '@["up"]')
|
||||
|
@ -392,16 +435,19 @@ set_route_balancing6() {
|
|||
|
||||
set_server_all_routes() {
|
||||
local server=$1
|
||||
[ -z "$OMR_TRACKER_INTERFACE" ] && return
|
||||
server_route() {
|
||||
local serverip multipath_config_route
|
||||
serverip=$1
|
||||
[ -n "$serverip" ] && serverip="$(resolveip -4 -t 5 $serverip | head -n 1 | tr -d '\n')"
|
||||
config_get disabled $server disabled
|
||||
[ "$disabled" = "1" ] && return
|
||||
interface_if=$(uci -q get network.$OMR_TRACKER_INTERFACE.ifname)
|
||||
network_get_device interface_if $OMR_TRACKER_INTERFACE
|
||||
[ -z "$interface_if" ] && interface_if=$(uci -q get network.$OMR_TRACKER_INTERFACE.device)
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "${OMR_TRACKER_INTERFACE}_4" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "$OMR_TRACKER_INTERFACE" | jsonfilter -q -e '@["device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(uci -q get network.$OMR_TRACKER_INTERFACE.ifname)
|
||||
interface_up=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["up"]')
|
||||
multipath_config_route=$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipath || echo "off")
|
||||
[ "$multipath_config_route" ] && multipath_config_route=$(uci -q get network.$OMR_TRACKER_INTERFACE.multipath || echo 'off')
|
||||
|
@ -418,7 +464,7 @@ set_server_all_routes() {
|
|||
config_foreach set_routes_intf interface
|
||||
uintf="$(echo $routesintf | awk '{print $5}')"
|
||||
uintfb="$(echo $routesintfbackup | awk '{print $5}')"
|
||||
if [ -n "$routesintf" ] && ([ "$nbintf" -gt "1" ] && [ "$(ip r show $serverip metric 1 | tr -d '\t' | tr -d '\n')" != "$serverip $routesintf " ]) || ([ "$nbintf" = "1" ] && [ -n "$uintf" ] && [ "$(ip r show $serverip metric 1 | grep $uintf)" = "" ]); then
|
||||
if [ -n "$routesintf" ] && ([ "$nbintf" -gt "1" ] && [ "$(ip r show $serverip metric 1 | tr -d '\t' | tr -d '\n' | sed 's/ *$//' | tr ' ' '\n' | sort | tr -d '\n')" != "$(echo $serverip $routesintf | sed 's/ *$//' | tr ' ' '\n' | sort | tr -d '\n')" ]) || ([ "$nbintf" = "1" ] && [ -n "$uintf" ] && [ "$(ip r show $serverip metric 1 | grep $uintf)" = "" ]); then
|
||||
while [ "$(ip r show $serverip | grep -v nexthop | sed 's/ //g' | tr -d '\n')" != "$serverip" ] && [ "$(ip r show $serverip | grep -v nexthop | sed 's/ //g' | tr -d '\n')" != "" ]; do
|
||||
ip r del $serverip
|
||||
done
|
||||
|
@ -426,7 +472,7 @@ set_server_all_routes() {
|
|||
ip route replace $serverip scope global metric 1 $routesintf 2>&1 >/dev/null
|
||||
[ "$(uci -q get openmptcprouter.settings.debug)" = "true" ] && _log "New server route is $(ip r show $serverip metric 1 | tr -d '\t' | tr -d '\n')"
|
||||
fi
|
||||
if [ -n "$routesintfbackup" ] && ([ "$nbintfb" -gt "1" ] && [ "$(ip r show $serverip metric 999 | tr -d '\t' | tr -d '\n')" != "$serverip $routesintfbackup " ]) || ([ "$nbintfb" = "1" ] && [ -n "$uintfb" ] && [ "$(ip r show $serverip metric 999 | grep $uintfb)" = "" ]); then
|
||||
if [ -n "$routesintfbackup" ] && ([ "$nbintfb" -gt "1" ] && [ "$(ip r show $serverip metric 999 | tr -d '\t' | tr -d '\n' | sed 's/ *$//' | tr ' ' '\n' | sort | tr -d '\n')" != "$(echo $serverip $routesintfbackup | sed 's/ *$//' | tr ' ' '\n' | sort | tr -d '\n')" ]) || ([ "$nbintfb" = "1" ] && [ -n "$uintfb" ] && [ "$(ip r show $serverip metric 999 | grep $uintfb)" = "" ]); then
|
||||
[ "$(uci -q get openmptcprouter.settings.debug)" = "true" ] && _log "Set server $server ($serverip) backup default route $serverip $routesintfbackup nbintfb $nbintfb $OMR_TRACKER_DEVICE"
|
||||
ip route replace $serverip scope global metric 999 $routesintfbackup 2>&1 >/dev/null
|
||||
fi
|
||||
|
@ -437,16 +483,19 @@ set_server_all_routes() {
|
|||
|
||||
set_server_all_routes6() {
|
||||
local server=$1
|
||||
[ -z "$OMR_TRACKER_INTERFACE" ] && return
|
||||
server_route() {
|
||||
local serverip multipath_config_route
|
||||
serverip=$1
|
||||
[ -n "$serverip" ] && serverip="$(resolveip -6 -t 5 $serverip | head -n 1 | tr -d '\n')"
|
||||
config_get disabled $server disabled
|
||||
[ "$disabled" = "1" ] && return
|
||||
interface_if=$(uci -q get network.$OMR_TRACKER_INTERFACE.ifname)
|
||||
network_get_device interface_if $OMR_TRACKER_INTERFACE
|
||||
[ -z "$interface_if" ] && interface_if=$(uci -q get network.$OMR_TRACKER_INTERFACE.device)
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "${OMR_TRACKER_INTERFACE}_6" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "$OMR_TRACKER_INTERFACE" | jsonfilter -q -e '@["device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(uci -q get network.$OMR_TRACKER_INTERFACE.ifname)
|
||||
interface_up=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["up"]')
|
||||
multipath_config_route=$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipath || echo "off")
|
||||
[ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipathvpn)" = "1" ] && {
|
||||
|
@ -462,7 +511,7 @@ set_server_all_routes6() {
|
|||
config_foreach set_routes_intf6 interface
|
||||
uintf="$(echo $routesintf6 | awk '{print $5}')"
|
||||
uintfb="$(echo $routesintfbackup6 | awk '{print $5}')"
|
||||
if [ -n "$routesintf6" ] && ([ "$nbintf6" -gt "1" ] && [ "$(ip -6 r show $serverip metric 1 | tr -d '\t' | tr -d '\n')" != "$serverip $routesintf6 " ]) || ([ "$nbintf6" = "1" ] && [ -n "$uintf" ] && [ "$(ip -6 r show $serverip metric 1 | grep $uintf)" = "" ]); then
|
||||
if [ -n "$routesintf6" ] && ([ "$nbintf6" -gt "1" ] && [ "$(ip -6 r show $serverip metric 1 | tr -d '\t' | sort | tr -d '\n' | sed 's/ *$//')" != "$(echo $serverip $routesintf6 | sort | sed 's/ *$//')" ]) || ([ "$nbintf6" = "1" ] && [ -n "$uintf" ] && [ "$(ip -6 r show $serverip metric 1 | grep $uintf)" = "" ]); then
|
||||
while [ "$(ip -6 r show $serverip | grep -v nexthop | sed 's/ //g' | tr -d '\n')" != "$serverip" ] && [ "$(ip -6 r show $serverip | grep -v nexthop | sed 's/ //g' | tr -d '\n')" != "" ]; do
|
||||
ip -6 r del $serverip
|
||||
done
|
||||
|
@ -483,6 +532,7 @@ set_server_all_routes6() {
|
|||
|
||||
set_server_route() {
|
||||
local server=$1
|
||||
[ -z "$OMR_TRACKER_INTERFACE" ] && return
|
||||
server_route() {
|
||||
local serverip multipath_config_route
|
||||
serverip=$1
|
||||
|
@ -497,10 +547,12 @@ set_server_route() {
|
|||
[ "$(uci -q get openmptcprouter.settings.mptcpovervpn)" = "openvpn" ] && multipath_config_route="$(uci -q get openmptcprouter.ovpn${OMR_TRACKER_INTERFACE}.multipath || echo "off")"
|
||||
[ "$(uci -q get openmptcprouter.settings.mptcpovervpn)" = "wireguard" ] && multipath_config_route="$(uci -q get openmptcprouter.wg${OMR_TRACKER_INTERFACE}.multipath || echo "off")"
|
||||
}
|
||||
interface_if=$(uci -q get network.$OMR_TRACKER_INTERFACE.ifname)
|
||||
network_get_device interface_if $OMR_TRACKER_INTERFACE
|
||||
[ -z "$interface_if" ] && interface_if=$(uci -q get network.$OMR_TRACKER_INTERFACE.device)
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "${OMR_TRACKER_INTERFACE}_4" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "$OMR_TRACKER_INTERFACE" | jsonfilter -q -e '@["device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(uci -q get network.$OMR_TRACKER_INTERFACE.ifname)
|
||||
interface_up=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["up"]')
|
||||
#multipath_current_config=$(multipath $interface_if | grep "deactivated")
|
||||
interface_current_config=$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.state || echo "up")
|
||||
|
@ -518,6 +570,7 @@ set_server_route() {
|
|||
|
||||
set_server_route6() {
|
||||
local server=$1
|
||||
[ -z "$OMR_TRACKER_INTERFACE" ] && return
|
||||
server_route() {
|
||||
local serverip multipath_config_route
|
||||
serverip=$1
|
||||
|
@ -532,10 +585,12 @@ set_server_route6() {
|
|||
[ "$(uci -q get openmptcprouter.settings.mptcpovervpn)" = "openvpn" ] && multipath_config_route="$(uci -q get openmptcprouter.ovpn${OMR_TRACKER_INTERFACE}.multipath || echo "off")"
|
||||
[ "$(uci -q get openmptcprouter.settings.mptcpovervpn)" = "wireguard" ] && multipath_config_route="$(uci -q get openmptcprouter.wg${OMR_TRACKER_INTERFACE}.multipath || echo "off")"
|
||||
}
|
||||
interface_if=$(uci -q get network.$OMR_TRACKER_INTERFACE.ifname)
|
||||
network_get_device interface_if $OMR_TRACKER_INTERFACE
|
||||
[ -z "$interface_if" ] && interface_if=$(uci -q get network.$OMR_TRACKER_INTERFACE.device)
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "${OMR_TRACKER_INTERFACE}_6" 2>/dev/null | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(ifstatus "$OMR_TRACKER_INTERFACE" | jsonfilter -q -e '@["device"]')
|
||||
[ -z "$interface_if" ] && interface_if=$(uci -q get network.$OMR_TRACKER_INTERFACE.ifname)
|
||||
interface_up=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["up"]')
|
||||
#multipath_current_config=$(multipath $interface_if | grep "deactivated")
|
||||
interface_current_config=$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.state || echo "up")
|
||||
|
@ -556,9 +611,13 @@ del_server_route() {
|
|||
remove_route() {
|
||||
local serverip="$1"
|
||||
[ -n "$serverip" ] && serverip="$(resolveip -4 -t 5 $serverip | head -n 1 | tr -d '\n')"
|
||||
[ -n "$serverip" ] && _log "Delete default route via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE"
|
||||
[ -n "$serverip" ] && _log "Delete default route to $serverip via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE"
|
||||
local metric
|
||||
metric=$(uci -q get network.$OMR_TRACKER_INTERFACE.metric)
|
||||
if [ -z "$OMR_TRACKER_INTERFACE" ]; then
|
||||
metric=0
|
||||
else
|
||||
metric=$(uci -q get network.$OMR_TRACKER_INTERFACE.metric)
|
||||
fi
|
||||
[ -n "$metric" ] && [ -n "$OMR_TRACKER_DEVICE" ] && [ -n "$serverip" ] && [ -n "$(ip route show $serverip dev $OMR_TRACKER_DEVICE metric $metric)" ] && ip route del $serverip dev $OMR_TRACKER_DEVICE metric $metric >/dev/null 2>&1
|
||||
[ -n "$OMR_TRACKER_DEVICE" ] && [ -n "$serverip" ] && [ -n "$(ip route show $serverip dev $OMR_TRACKER_DEVICE)" ] && ip route del $serverip dev $OMR_TRACKER_DEVICE >/dev/null 2>&1
|
||||
[ -n "$OMR_TRACKER_DEVICE" ] && [ -n "$serverip" ] && [ -n "$(ip route show $serverip | grep $OMR_TRACKER_DEVICE)" ] && ip route del $serverip dev $OMR_TRACKER_DEVICE >/dev/null 2>&1
|
||||
|
@ -576,11 +635,15 @@ del_server_route6() {
|
|||
remove_route() {
|
||||
local serverip="$1"
|
||||
[ -n "$serverip" ] && serverip="$(resolveip -6 -t 5 $serverip | head -n 1 | tr -d '\n')"
|
||||
[ -n "$serverip" ] && _log "Delete default route via $OMR_TRACKER_DEVICE_GATEWAY6 dev $OMR_TRACKER_DEVICE"
|
||||
[ -n "$serverip" ] && _log "Delete default route to $serverip via $OMR_TRACKER_DEVICE_GATEWAY6 dev $OMR_TRACKER_DEVICE"
|
||||
local metric
|
||||
metric=$(uci -q get network.$OMR_TRACKER_INTERFACE.metric)
|
||||
[ -n "$OMR_TRACKER_DEVICE" ] && [ -n "$metric" ] && [ -n "$(ip -6 route show $serverip dev $OMR_TRACKER_DEVICE metric $metric)" ] && ip -6 route del $serverip dev $OMR_TRACKER_DEVICE metric $metric >/dev/null 2>&1
|
||||
[ -n "$OMR_TRACKER_DEVICE" ] && [ -n "$metric" ] && [ -n "$(ip -6 route show $serverip dev $OMR_TRACKER_DEVICE)" ] && ip -6 route del $serverip dev $OMR_TRACKER_DEVICE >/dev/null 2>&1
|
||||
if [ -z "$OMR_TRACKER_INTERFACE" ]; then
|
||||
metric=0
|
||||
else
|
||||
metric=$(uci -q get network.$OMR_TRACKER_INTERFACE.metric)
|
||||
fi
|
||||
[ -n "$OMR_TRACKER_DEVICE" ] && [ -n "$metric" ] && [ -n "$serverip"] && [ -n "$(ip -6 route show $serverip dev $OMR_TRACKER_DEVICE metric $metric)" ] && ip -6 route del $serverip dev $OMR_TRACKER_DEVICE metric $metric >/dev/null 2>&1
|
||||
[ -n "$OMR_TRACKER_DEVICE" ] && [ -n "$metric" ] && [ -n "$serverip" ] && [ -n "$(ip -6 route show $serverip dev $OMR_TRACKER_DEVICE)" ] && ip -6 route del $serverip dev $OMR_TRACKER_DEVICE >/dev/null 2>&1
|
||||
}
|
||||
config_list_foreach $server ip remove_route
|
||||
if [ -n "$OMR_TRACKER_DEVICE_GATEWAY6" ] && [ -n "$OMR_TRACKER_DEVICE" ]; then
|
||||
|
@ -608,7 +671,7 @@ disable_pihole() {
|
|||
enable_pihole() {
|
||||
local server=$1
|
||||
nbserver=$((nbserver+1))
|
||||
if [ "$(uci -q get openmptcprouter.${server}.pihole)" = "1" ] && [ "$(uci -q get dhcp.@dnsmasq[0].server | grep '127.0.0.1#5353')" != "" ]; then
|
||||
if [ -n "$server" ] && [ "$(uci -q get openmptcprouter.${server}.pihole)" = "1" ] && [ "$(uci -q get dhcp.@dnsmasq[0].server | grep '127.0.0.1#5353')" != "" ]; then
|
||||
piholeenabled=$((piholeenabled+1))
|
||||
fi
|
||||
}
|
||||
|
@ -643,20 +706,20 @@ interface_up=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e
|
|||
|
||||
# An interface in error will never be used in MPTCP
|
||||
if [ "$OMR_TRACKER_STATUS" = "ERROR" ] || [ "$interface_up" != "true" ]; then
|
||||
if [ "$interface_up" = "true" ] && ([ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "modemmanager" ] || [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "wireguard" ]); then
|
||||
if [ "$interface_up" = "true" ] && [ -n "$OMR_TRACKER_INTERFACE" ] && ([ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "modemmanager" ] || [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "wireguard" ]); then
|
||||
_log "No answer from $OMR_TRACKER_INTERFACE ($OMR_TRACKER_DEVICE), restart interface"
|
||||
_log "Set $OMR_TRACKER_INTERFACE down"
|
||||
ifdown $OMR_TRACKER_INTERFACE
|
||||
sleep 5
|
||||
_log "Set $OMR_TRACKER_INTERFACE up"
|
||||
ifup $OMR_TRACKER_INTERFACE
|
||||
sleep 10
|
||||
sleep 20
|
||||
fi
|
||||
|
||||
if [ "$OMR_TRACKER_PREV_STATUS" = "$OMR_TRACKER_STATUS" ]; then
|
||||
exit 0
|
||||
fi
|
||||
if [ "$multipath_status" != "off" ] || [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipathvpn)" = "1" ]; then
|
||||
if [ "$multipath_status" != "off" ] || ([ -n "$OMR_TRACKER_INTERFACE" ] && [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipathvpn)" = "1" ]); then
|
||||
if [ "$OMR_TRACKER_STATUS_MSG" = "" ]; then
|
||||
_log "$OMR_TRACKER_INTERFACE ($OMR_TRACKER_DEVICE) switched off"
|
||||
else
|
||||
|
@ -672,7 +735,7 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ] || [ "$interface_up" != "true" ]; then
|
|||
if [ -n "$OMR_TRACKER_DEVICE_IP6" ]; then
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP6 dev tun0 set down > /dev/null 2>&1
|
||||
fi
|
||||
if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" = "1" ] && [ "$(uci -q get openmptcprouter.settings.mptcpovervpn)" = "openvpn" ]; then
|
||||
if [ -n "$OMR_TRACKER_INTERFACE" ] && [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" = "1" ] && [ "$(uci -q get openmptcprouter.settings.mptcpovervpn)" = "openvpn" ]; then
|
||||
VPN_BASE_INTF="$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.baseintf)"
|
||||
VPN_BASE_INTF_IP=$(ubus call network.interface.$VPN_BASE_INTF status | jsonfilter -e '@["ipv4-address"][0].address' | tr -d "\n")
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
|
@ -686,19 +749,25 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ] || [ "$interface_up" != "true" ]; then
|
|||
config_foreach del_server_route6 server
|
||||
#if [ "$(uci -q get openmptcprouter.settings.master)" = "balancing" ] && [ "$(uci -q get openmptcprouter.settings.vpn)" != "mlvpn" ]; then
|
||||
if [ "$(uci -q get openmptcprouter.settings.master)" = "balancing" ]; then
|
||||
[ "$(uci -q get openmptcprouter.settings.debug)" = "true" ] && _log "Set balancing route (current: $(ip r) )"
|
||||
config_foreach set_server_all_routes server
|
||||
config_foreach set_server_all_routes6 server
|
||||
[ "$(uci -q get openmptcprouter.settings.debug)" = "true" ] && _log "Set balancing route done (new: $(ip r) )"
|
||||
fi
|
||||
fi
|
||||
|
||||
if ([ "$default_gw" = "$OMR_TRACKER_DEVICE_GATEWAY" ] || [ "$default_gw" = "" ] || [ "$default_gw6" != "$OMR_TRACKER_DEVICE_GATEWAY6" ]) && [ "$(uci -q get openmptcprouter.settings.defaultgw)" != "0" ]; then
|
||||
config_load network
|
||||
config_foreach set_route interface $OMR_TRACKER_INTERFACE
|
||||
config_foreach set_route6 interface $OMR_TRACKER_INTERFACE
|
||||
elif [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.multipath)" = "master" ]; then
|
||||
config_load network
|
||||
config_foreach set_route interface $OMR_TRACKER_INTERFACE "no"
|
||||
config_foreach set_route6 interface $OMR_TRACKER_INTERFACE "no"
|
||||
if [ -n "$OMR_TRACKER_INTERFACE" ]; then
|
||||
if ([ "$default_gw" = "$OMR_TRACKER_DEVICE_GATEWAY" ] || [ "$default_gw" = "" ] || [ "$default_gw6" != "$OMR_TRACKER_DEVICE_GATEWAY6" ]) && [ "$(uci -q get openmptcprouter.settings.defaultgw)" != "0" ]; then
|
||||
[ "$(uci -q get openmptcprouter.settings.debug)" = "true" ] && _log "Default gw: $default_gw - Set routes (current: $(ip r) )"
|
||||
config_load network
|
||||
config_foreach set_route interface $OMR_TRACKER_INTERFACE
|
||||
config_foreach set_route6 interface $OMR_TRACKER_INTERFACE
|
||||
[ "$(uci -q get openmptcprouter.settings.debug)" = "true" ] && _log "New routes $(ip r)"
|
||||
elif [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.multipath)" = "master" ]; then
|
||||
config_load network
|
||||
config_foreach set_route interface $OMR_TRACKER_INTERFACE "no"
|
||||
config_foreach set_route6 interface $OMR_TRACKER_INTERFACE "no"
|
||||
fi
|
||||
fi
|
||||
mail_alert="$(uci -q get omr-tracker.$OMR_TRACKER_INTERFACE.mail_alert)"
|
||||
[ -z "$mail_alert" ] && mail_alert="$(uci -q get omr-tracker.defaults.mail_alert)"
|
||||
|
@ -795,15 +864,17 @@ if [ "$OMR_TRACKER_INTERFACE" = "glorytun" ] || [ "$OMR_TRACKER_INTERFACE" = "om
|
|||
fi
|
||||
if ([ "$default_gw" != "$OMR_TRACKER_DEVICE_GATEWAY" ] || [ "$default_gw" = "" ]) && [ "$OMR_TRACKER_DEVICE_GATEWAY" != "" ]; then
|
||||
_log "Tunnel up : Replace default route by $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE"
|
||||
[ "$(uci -q get openmptcprouter.settings.debug)" = "true" ] && _log "Current route: $(ip r)"
|
||||
ip route replace default scope global nexthop via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE 2>&1 >/dev/null
|
||||
if [ "$(pgrep openmptcprouter-vps)" = "" ]; then
|
||||
/etc/init.d/openmptcprouter-vps restart >/dev/null 2>&1
|
||||
fi
|
||||
[ "$(uci -q get shadowsocks-libev.sss0.disabled)" != "1" ] && conntrack -D -p udp 2>&1 >/dev/null
|
||||
[ "$(uci -q get openmptcprouter.settings.debug)" = "true" ] && _log "New route: $(ip r)"
|
||||
fi
|
||||
|
||||
# Set VPN MTU
|
||||
if [ -n "$OMR_TRACKER_LATENCY" ] && ([ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($(date +"%s") - $(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc))) -gt 3600 ]); then
|
||||
if [ -n "$OMR_TRACKER_LATENCY" ] && [ -n "$OMR_TRACKER_INTERFACE" ] && ([ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($(date +"%s") - $(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc))) -gt 3600 ]); then
|
||||
local serverip=$(uci -q get shadowsocks-libev.sss0.server)
|
||||
[ -n "$serverip" ] && serverip="$(resolveip -4 -t 5 $serverip | head -n 1 | tr -d '\n')"
|
||||
if [ "$serverip" = "192.168.1.3" ] || [ "$serverip" = "127.0.0.1" ]; then
|
||||
|
@ -812,17 +883,18 @@ if [ "$OMR_TRACKER_INTERFACE" = "glorytun" ] || [ "$OMR_TRACKER_INTERFACE" = "om
|
|||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE="interface"
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.latency="$OMR_TRACKER_LATENCY"
|
||||
if [ "$(uci -q get glorytun.vpn.enable)" != "1" ] || [ "$(uci -q get glorytun-udp.vpn.enable)" != "1" ]; then
|
||||
if [ -n "$(uci -q get network.$OMR_TRACKER_INTERFACE.mtu)" ] && [ -n "$OMR_TRACKER_DEVICE" ]; then
|
||||
mtu=$(uci -q get network.$OMR_TRACKER_INTERFACE.mtu)
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.mtu=$mtu
|
||||
OMR_NETWORK_DEVICE=$(find_network_device ${OMR_TRACKER_INTERFACE})
|
||||
if [ -n "$OMR_NETWORK_DEVICE" ] && [ -n "$(uci -q get network.$OMR_NETWORK_DEVICE.mtu)" ] && [ -n "$OMR_TRACKER_DEVICE" ]; then
|
||||
mtu=$(uci -q get network.$OMR_NETWORK_DEVICE.mtu)
|
||||
uci -q set openmptcprouter.${OMR_TRACKER_INTERFACE}.mtu=$mtu
|
||||
[ -n "$mtu" ] && ip link set dev $OMR_TRACKER_DEVICE mtu $mtu > /dev/null 2>&1
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.lc=$(date +"%s")
|
||||
elif [ -z "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.mtu)" ] && [ -n "$OMR_TRACKER_DEVICE_IP" ] && [ -n "$OMR_TRACKER_DEVICE" ]; then
|
||||
elif [ -z "$(uci -q get openmptcprouter.${OMR_TRACKER_INTERFACE}.mtu)" ] && [ -n "$OMR_TRACKER_DEVICE_IP" ] && [ -n "$OMR_TRACKER_DEVICE" ]; then
|
||||
if [ -n "$serverip" ] && [ "$serverip" != "127.0.0.1" ]; then
|
||||
local mtu=$(omr-mtu $OMR_TRACKER_DEVICE_IP $serverip)
|
||||
#local mtu=$(omr-mtu $OMR_TRACKER_DEVICE_IP 8.8.8.8)
|
||||
[ -n "$mtu" ] && {
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.mtu=$mtu
|
||||
uci -q set openmptcprouter.${OMR_TRACKER_INTERFACE}.mtu=$mtu
|
||||
ip link set dev $OMR_TRACKER_DEVICE mtu $mtu > /dev/null 2>&1
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.lc=$(date +"%s")
|
||||
}
|
||||
|
@ -895,8 +967,9 @@ multipath_config=$(uci -q get "openmtpcprouter.$OMR_TRACKER_INTERFACE.multipath"
|
|||
if [ "$multipath_config" = "master" ]; then
|
||||
#if ([ "$default_gw" != "$OMR_TRACKER_DEVICE_GATEWAY" ] || [ "$default_gw" = "" ]) && [ "$OMR_TRACKER_DEVICE_GATEWAY" != "" ] && ([ "$(uci -q get openmptcprouter.settings.master)" != "balancing" ] || [ "$(uci -q get openmptcprouter.settings.vpn)" = "mlvpn" ]); then
|
||||
if ([ "$default_gw" != "$OMR_TRACKER_DEVICE_GATEWAY" ] || [ "$default_gw" = "" ]) && [ "$OMR_TRACKER_DEVICE_GATEWAY" != "" ] && [ "$(uci -q get openmptcprouter.settings.master)" != "balancing" ]; then
|
||||
omrvpn_intf=$(uci -q get "network.omrvpn.ifname" || echo "tun")
|
||||
if [ -n "$omrvpn_intf" ] && [ "$(ip route show default | awk '/default/ {print $5}' | grep $omrvpn_intf)" = "" ] && [ "$(uci -q get openmptcprouter.settings.defaultgw)" != "0" ]; then
|
||||
omrvpn_intf=$(uci -q get "network.omrvpn.device" || echo "tun0")
|
||||
[ -z "$omrvpn_intf" ] && omrvpn_intf=$(uci -q get "network.omrvpn.ifname" || echo "tun0")
|
||||
if [ -n "$omrvpn_intf" ] && [ "$(ip route show default | grep -v metric | awk '/default/ {print $5}' | grep $omrvpn_intf)" = "" ] && [ "$(uci -q get openmptcprouter.settings.defaultgw)" != "0" ]; then
|
||||
_log "Master up : Replace default route by $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE"
|
||||
ip route replace default scope global nexthop via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE 2>&1 >/dev/null
|
||||
fi
|
||||
|
@ -908,7 +981,8 @@ if [ "$multipath_config" = "master" ]; then
|
|||
fi
|
||||
fi
|
||||
if ([ "$default_gw6" != "$OMR_TRACKER_DEVICE_GATEWAY6" ] || [ "$default_gw6" = "" ]) && [ "$OMR_TRACKER_DEVICE_GATEWAY6" != "" ] && [ "$(uci -q get openmptcprouter.settings.master)" != "balancing" ]; then
|
||||
omrvpn_intf=$(uci -q get "network.omrvpn.ifname" || echo "tun")
|
||||
omrvpn_intf=$(uci -q get "network.omrvpn.device" || echo "tun0")
|
||||
[ -z "$omrvpn_intf" ] && omrvpn_intf=$(uci -q get "network.omrvpn.ifname" || echo "tun0")
|
||||
if [ -n "$omrvpn_intf" ] && [ "$(ip route show default | awk '/default/ {print $5}' | grep $omrvpn_intf)" = "" ] && [ "$(uci -q get openmptcprouter.settings.defaultgw)" != "0" ]; then
|
||||
_log "Master up : Replace default route by $OMR_TRACKER_DEVICE_GATEWAY6 dev $OMR_TRACKER_DEVICE"
|
||||
ip -6 route replace default scope global nexthop via $OMR_TRACKER_DEVICE_GATEWAY6 dev $OMR_TRACKER_DEVICE 2>&1 >/dev/null
|
||||
|
@ -923,8 +997,9 @@ if [ "$multipath_config" = "master" ]; then
|
|||
fi
|
||||
#if [ "$(uci -q get openmptcprouter.settings.master)" = "balancing" ] && [ "$(ip route show default | grep weight)" = "" ] && [ "$(uci -q get openmptcprouter.settings.defaultgw)" != "0" ] && [ "$(uci -q get openmptcprouter.settings.vpn)" != "mlvpn" ]; then
|
||||
if [ "$(uci -q get openmptcprouter.settings.master)" = "balancing" ] && [ "$(ip route show default | grep weight)" = "" ] && [ "$(uci -q get openmptcprouter.settings.defaultgw)" != "0" ]; then
|
||||
omrvpn_intf=$(uci -q get "network.omrvpn.ifname" || echo "tun")
|
||||
if [ -n "$omrvpn_intf" ] && [ "$(ip route show default | awk '/default/ {print $5}' | grep $omrvpn_intf)" = "" ]; then
|
||||
omrvpn_intf=$(uci -q get "network.omrvpn.device" || echo "tun0")
|
||||
[ -z "$omrvpn_intf" ] && omrvpn_intf=$(uci -q get "network.omrvpn.ifname" || echo "tun0")
|
||||
if [ -n "$omrvpn_intf" ] && [ "$(ip route show default | grep -v metric | awk '/default/ {print $5}' | grep $omrvpn_intf)" = "" ]; then
|
||||
routesbalancing=""
|
||||
routesbalancingbackup=""
|
||||
nbintf=0
|
||||
|
@ -936,8 +1011,10 @@ if [ "$multipath_config" = "master" ]; then
|
|||
config_foreach set_route_balancing6 interface
|
||||
[ -n "$routesbalancing" ] && {
|
||||
([ "$nbintf" -gt "1" ] && [ "$(ip r show default metric 1 | tr -d '\t' | tr -d '\n')" != "default via $routesbalancing " ]) || ([ "$nbintf" = "1" ] && ([ "$(ip r show default metric 1 | grep $OMR_TRACKER_DEVICE)" = "" ] || [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" = "1" ]) && [ -n "$OMR_TRACKER_DEVICE_IP" ]) && {
|
||||
_log "Set ip route replace default scope global $routesbalancing"
|
||||
_log "Change in routes, set ip route replace default scope global $routesbalancing (omrvpn_intf: $omrvpn_intf)"
|
||||
[ "$(uci -q get openmptcprouter.settings.debug)" = "true" ] && _log "Current route: $(ip r)"
|
||||
ip route replace default scope global metric 1 $routesbalancing 2>&1 >/dev/null
|
||||
[ "$(uci -q get openmptcprouter.settings.debug)" = "true" ] && _log "New route: $(ip r)"
|
||||
}
|
||||
}
|
||||
[ -n "$routesbalancing6" ] && {
|
||||
|
@ -948,7 +1025,7 @@ if [ "$multipath_config" = "master" ]; then
|
|||
}
|
||||
[ -n "$routesbalancingbackup" ] && {
|
||||
([ "$nbintfb" -gt "1" ] && [ "$(ip r show default metric 999 | tr -d '\t' | tr -d '\n')" != "default via $routesbalancingbackup " ]) || ([ "$nbintf" = "1" ] && ([ "$(ip r show default metric 999 | grep $OMR_TRACKER_DEVICE)" = "" ] || [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" = "1" ]) && [ -n "$OMR_TRACKER_DEVICE_IP" ]) && {
|
||||
_log "Set backup ip route replace default scope global $routesbalancingbackup"
|
||||
_log "Set backup ip route replace default scope global metric 999 $routesbalancingbackup"
|
||||
ip route replace default scope global metric 999 $routesbalancingbackup 2>&1 >/dev/null
|
||||
}
|
||||
}
|
||||
|
@ -981,7 +1058,8 @@ if [ -n "$OMR_TRACKER_DEVICE_IP" ] && [ -n "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
|
|||
config_foreach set_server_route server
|
||||
fi
|
||||
if [ -n "$OMR_TRACKER_DEVICE_GATEWAY" ] && [ -n "$OMR_TRACKER_DEVICE" ] && [ "$(ip r show dev $OMR_TRACKER_DEVICE | grep default)" = "" ] && [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.metric)" != "" ]; then
|
||||
ip r replace default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE metric $(uci -q get network.$OMR_TRACKER_INTERFACE.metric) >/dev/null 2>&1
|
||||
_log "Interface route not yet set, set route ip r add default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE metric $(uci -q get network.$OMR_TRACKER_INTERFACE.metric)"
|
||||
ip r add default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE metric $(uci -q get network.$OMR_TRACKER_INTERFACE.metric) >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
if [ -n "$OMR_TRACKER_DEVICE_IP6" ] && [ -n "$OMR_TRACKER_DEVICE_GATEWAY6" ]; then
|
||||
|
@ -1012,7 +1090,7 @@ if [ "$multipath_config" = "on" ] || [ "$multipath_config" = "backup" ]; then
|
|||
serverip=$1
|
||||
#gtudpst="up"
|
||||
#[ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipathvpn)" != "1" ] && [ "$multipath_config" = "backup" ] && [ "$(pgrep glorytun-udp)" != "" ] && gtudpst="backup"
|
||||
if [ "$OMR_TRACKER_DEVICE_IP" != "" ] && [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" != "1" ] && [ "$(pgrep glorytun-udp)" != "" ] && [ "$(glorytun-udp path | grep $OMR_TRACKER_DEVICE_IP)" = "" ] && [ -n "$(resolveip -4 $serverip)" ]; then
|
||||
if [ "$OMR_TRACKER_DEVICE_IP" != "" ] && [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" != "1" ] && [ "$(pgrep glorytun-udp)" != "" ] && [ "$(glorytun-udp path | grep $OMR_TRACKER_DEVICE_IP | grep running)" = "" ] && [ -n "$(resolveip -4 $serverip)" ]; then
|
||||
if [ "$download" != "0" ] && [ "$download" != "" ] && [ "$upload" != "0" ] && [ "$upload" != "" ]; then
|
||||
if [ "$(uci -q get glorytun-udp.vpn.rateauto)" = "1" ]; then
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP to addr $serverip port ${gtudp_port} dev ${gtudp_dev} set up rate auto tx $((upload*1000/8)) rx $((download*1000/8)) pref 1 > /dev/null 2>&1
|
||||
|
@ -1027,7 +1105,7 @@ if [ "$multipath_config" = "on" ] || [ "$multipath_config" = "backup" ]; then
|
|||
fi
|
||||
fi
|
||||
fi
|
||||
if [ "$OMR_TRACKER_DEVICE_IP6" != "" ] && [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" != "1" ] && [ "$(pgrep glorytun-udp)" != "" ] && [ "$(glorytun-udp path | grep $OMR_TRACKER_DEVICE_IP6)" = "" ] && [ -n "$(resolveip -6 $serverip)" ]; then
|
||||
if [ "$OMR_TRACKER_DEVICE_IP6" != "" ] && [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" != "1" ] && [ "$(pgrep glorytun-udp)" != "" ] && [ "$(glorytun-udp path | grep $OMR_TRACKER_DEVICE_IP6 | grep running)" = "" ] && [ -n "$(resolveip -6 $serverip)" ]; then
|
||||
if [ "$download" != "0" ] && [ "$download" != "" ] && [ "$upload" != "0" ] && [ "$upload" != "" ]; then
|
||||
if [ "$(uci -q get glorytun-udp.vpn.rateauto)" = "1" ]; then
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP6 to addr $serverip port ${gtudp_port} dev ${gtudp_dev} set up rate auto tx $((upload*1000/8)) rx $((download*1000/8)) pref 1 > /dev/null 2>&1
|
||||
|
@ -1057,7 +1135,7 @@ if [ "$multipath_config" = "on" ] || [ "$multipath_config" = "backup" ]; then
|
|||
fi
|
||||
[ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipathvpn)" != "1" ] && {
|
||||
[ "$multipath_status" = "$multipath_config" ] || {
|
||||
if [ "$(sysctl -n net.mptcp.mptcp_enabled | tr -d '\n')" = "1" ]; then
|
||||
if [ "$(sysctl -qen net.mptcp.mptcp_enabled | tr -d '\n')" = "1" ] || [ "$(sysctl -qen net.mptcp.enabled | tr -d '\n')" = "1" ]; then
|
||||
_log "Multipath $OMR_TRACKER_DEVICE switched to $multipath_config"
|
||||
multipath "$OMR_TRACKER_DEVICE" "$multipath_config"
|
||||
fi
|
||||
|
@ -1083,7 +1161,7 @@ if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($(
|
|||
#[ -z "$check_ipv6_website" ] && check_ipv6_website="http://ipv6.openmptcprouter.com/"
|
||||
#local ip6addr="$(curl -s -6 -m 2 $check_ipv6_website)"
|
||||
#[ -z "$ip6addr" ] && {
|
||||
# local ip6addr="$(curl -s -6 -m 2 http://ifconfig.co/)"
|
||||
# local ip6addr="$(curl -s -6 -m 2 http://ifconfig.me/)"
|
||||
#}
|
||||
#if [ "$(uci -q get openmptcprouter.settings.ipv6_disable)" = "0" ]; then
|
||||
# if [ -n "$ip6addr" ] && [ "$(uci -q get dhcp.lan.ra_default)" != 1 ]; then
|
||||
|
@ -1104,7 +1182,7 @@ if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($(
|
|||
if [ "$(uci -q get openmptcprouter.settings.external_check)" != "0" ]; then
|
||||
#local asn="$(wget -4 -qO- -T 4 http://api.iptoasn.com/v1/as/ip/$ipaddr | jsonfilter -q -e '@.as_description')"
|
||||
#[ -z "$asn" ] && {
|
||||
local asn="$(whois $ipaddr 2>/dev/null | grep -m 1 -i 'netname' | awk '{print $2}')"
|
||||
local asn="$(timeout 2 whois $ipaddr 2>/dev/null | grep -m 1 -i 'netname' | awk '{print $2}')"
|
||||
#}
|
||||
fi
|
||||
[ -z "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE)" ] && {
|
||||
|
@ -1119,9 +1197,16 @@ if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($(
|
|||
uci -q set openmptcprouter.latest_versions.lc=$(date +"%s")
|
||||
}
|
||||
fi
|
||||
[ -n "$ipaddr" ] && uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.publicip="$ipaddr"
|
||||
[ -n "$ipaddr" ] && [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.publicip)" != "$ipaddr" ] && {
|
||||
_log "New public ip detected for $OMR_TRACKER_INTERFACE ($OMR_TRACKER_DEVICE): $ipaddr"
|
||||
/etc/init.d/mptcp enabled && {
|
||||
_log "Reload MPTCP for $OMR_TRACKER_DEVICE"
|
||||
/etc/init.d/mptcp reload "$OMR_TRACKER_DEVICE" >/dev/null
|
||||
}
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.publicip="$ipaddr"
|
||||
}
|
||||
[ -n "$OMR_TRACKER_LATENCY" ] && uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.latency="$OMR_TRACKER_LATENCY"
|
||||
[ -n "$asn" ] && {
|
||||
[ -n "$asn" ] && [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.asn)" != "$asn" ] && {
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.asn="$asn"
|
||||
}
|
||||
|
||||
|
@ -1163,8 +1248,8 @@ if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($(
|
|||
[ -n "$omrtracebox" ] && [ -z "$(echo $omrtracebox | grep error)" ] && uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.mptcp_status="$omrtracebox"
|
||||
}
|
||||
if [ "$OMR_TRACKER_INTERFACE" != "omrvpn" ] && [ "$(uci -q get glorytun.vpn.enable)" != "1" ] && [ "$(uci -q get glorytun-udp.vpn.enable)" != "1" ] && [ -n "$OMR_TRACKER_DEVICE" ]; then
|
||||
if [ -n "$(uci -q get network.$OMR_TRACKER_INTERFACE.mtu)" ]; then
|
||||
mtu=$(uci -q get network.$OMR_TRACKER_INTERFACE.mtu)
|
||||
if [ -n "$(uci -q get network.$(find_network_device ${OMR_TRACKER_INTERFACE}).mtu)" ]; then
|
||||
mtu=$(uci -q get network.$(find_network_device ${OMR_TRACKER_INTERFACE}).mtu)
|
||||
[ -n "$mtu" ] && {
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.mtu=$mtu
|
||||
ip link set dev $OMR_TRACKER_DEVICE mtu $mtu > /dev/null 2>&1
|
||||
|
@ -1213,7 +1298,14 @@ if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($(
|
|||
uci -q set openmptcprouter.latest_versions.lc=$(date +"%s")
|
||||
}
|
||||
fi
|
||||
[ -n "$ipaddr" ] && uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.publicip6="$ip6addr"
|
||||
[ -n "$ip6addr" ] && [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.publicip)" != "$ip6addr" ] && {
|
||||
_log "New public ip detected for $OMR_TRACKER_INTERFACE ($OMR_TRACKER_DEVICE): $ip6addr"
|
||||
/etc/init.d/mptcp enabled && {
|
||||
_log "Reload MPTCP for $OMR_TRACKER_DEVICE"
|
||||
/etc/init.d/mptcp reload "$OMR_TRACKER_DEVICE" >/dev/null
|
||||
}
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.publicip="$ip6addr"
|
||||
}
|
||||
[ -n "$OMR_TRACKER_LATENCY" ] && uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.latency="$OMR_TRACKER_LATENCY"
|
||||
[ -n "$asn" ] && {
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.asn="$asn"
|
||||
|
@ -1227,10 +1319,10 @@ if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($(
|
|||
[ -n "$omrtracebox" ] && [ -z "$(echo $omrtracebox | grep error)" ] && uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.mptcp_status="$omrtracebox"
|
||||
}
|
||||
if [ "$OMR_TRACKER_INTERFACE" != "omrvpn" ] && [ "$(uci -q get glorytun.vpn.enable)" != "1" ] && [ "$(uci -q get glorytun-udp.vpn.enable)" != "1" ] && [ -n "$OMR_TRACKER_DEVICE" ]; then
|
||||
if [ -n "$(uci -q get network.$OMR_TRACKER_INTERFACE.mtu)" ]; then
|
||||
mtu=$(uci -q get network.$OMR_TRACKER_INTERFACE.mtu)
|
||||
if [ -n "$(uci -q get network.$(find_network_device ${OMR_TRACKER_INTERFACE}).mtu)" ]; then
|
||||
mtu=$(uci -q get network.$(find_network_device ${OMR_TRACKER_INTERFACE}).mtu)
|
||||
[ -n "$mtu" ] && {
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.mtu=$mtu
|
||||
uci -q set openmptcprouter.${OMR_TRACKER_INTERFACE}.mtu=$mtu
|
||||
ip link set dev $OMR_TRACKER_DEVICE mtu $mtu > /dev/null 2>&1
|
||||
}
|
||||
elif [ -n "$OMR_TRACKER_DEVICE_IP" ]; then
|
||||
|
@ -1395,6 +1487,12 @@ if [ "$(pgrep rpcd)" = "" ] && [ -f /etc/init.d/rpcd ]; then
|
|||
sleep 5
|
||||
fi
|
||||
|
||||
if [ "$(pgrep uhttpd)" = "" ] && [ -f /etc/init.d/uhttpd ]; then
|
||||
_log "Can't find uhttpd, restart it..."
|
||||
/etc/init.d/uhttpd restart
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
#if [ "$(pgrep ModemManager)" = "" ] && [ -f /etc/init.d/modemmanager ] && [ -n "$(uci -q show network | grep modemmanager)" ] && [ "$(uci -q get openmptcprouter.settings.modemmanager)" != "0" ]; then
|
||||
# _log "Can't find ModemManager, restart it..."
|
||||
# /etc/init.d/modemmanager restart
|
||||
|
@ -1456,7 +1554,8 @@ if [ "$(pgrep openmptcprouter-vps)" = "" ] && ([ "$(uci -q show openmptcprouter
|
|||
sleep 5
|
||||
fi
|
||||
|
||||
if [ "$(pgrep openmptcprouter-vps)" = "" ] && ([ "$(uci -q show openmptcprouter | grep set_firewall=\'1\')" != "" ] || [ -z "$(iptables-save | grep omr_dst_bypass_${OMR_TRACKER_DEVICE})" ]); then
|
||||
|
||||
if [ "$(uci -q show openmptcprouter | grep server)" != "" ] && [ "$(pgrep openmptcprouter-vps)" = "" ] && [ "$(uci -q show openmptcprouter | grep admin_error=\'1\')" = "" ] && ([ "$(uci -q show openmptcprouter | grep set_firewall=\'1\')" != "" ] || [ -z "$(iptables-save | grep omr_dst_bypass_${OMR_TRACKER_DEVICE})" ]); then
|
||||
_log "Set firewall on server"
|
||||
/etc/init.d/openmptcprouter-vps set_vps_firewall >/dev/null 2>&1
|
||||
|
||||
|
|
|
@ -8,13 +8,15 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mptcpd
|
||||
PKG_VERSION:=0.5.1
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/intel/mptcpd/releases/download/v$(PKG_VERSION)
|
||||
PKG_HASH:=0ee4418880f20a1a2eff5c54c26185a75092cb44cbabe0fa3f25a2c5886459e7
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/intel/mptcpd.git
|
||||
PKG_SOURCE_VERSION:=0e7175adf721c95a3bd742be77cb85e0b47138cd
|
||||
PKG_VERSION:=0.7-$(PKG_SOURCE_VERSION)
|
||||
PKG_RELEASE:=1
|
||||
PKG_MAINTAINER:=Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
PKG_FORTIFY_SOURCE:=2
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
@ -43,6 +45,7 @@ endef
|
|||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/mptcpd $(1)/usr/bin/mptcpd
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/mptcpize $(1)/usr/bin/mptcpize
|
||||
$(INSTALL_DIR) $(1)/usr/include/mptcpd
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/mptcpd/*.h $(1)/usr/include/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/mptcpd
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
--- a/src/configuration.c 2020-04-14 21:31:22.057292953 +0200
|
||||
+++ b/src/configuration.c 2020-04-14 21:32:13.712364449 +0200
|
||||
@@ -35,10 +35,10 @@
|
||||
*/
|
||||
//@{
|
||||
/// Underlying string concatenation macro.
|
||||
-#define MPTCPD_CONCAT_IMPL(x, ...) x ## __VA_ARGS__
|
||||
+//#define MPTCPD_CONCAT_IMPL(x, ...) x ## __VA_ARGS__
|
||||
|
||||
/// Concatenate strings using the preprocessor.
|
||||
-#define MPTCPD_CONCAT(x, ...) MPTCPD_CONCAT_IMPL(x, __VA_ARGS__)
|
||||
+//#define MPTCPD_CONCAT(x, ...) MPTCPD_CONCAT_IMPL(x, __VA_ARGS__)
|
||||
//@}
|
||||
|
||||
// Compile-time default logging choice
|
||||
@@ -47,7 +47,7 @@
|
||||
# error Problem configuring default log message destination.
|
||||
#endif
|
||||
/// Name of the default logging function determined at compile-time.
|
||||
-#define MPTCPD_SET_LOG_FUNCTION MPTCPD_CONCAT(l_log_set_, MPTCPD_LOGGER)
|
||||
+#define MPTCPD_SET_LOG_FUNCTION l_log_set_stderr
|
||||
|
||||
/**
|
||||
* @brief Get the function that sets the log message destination.
|
167
mptcpd/patches/remove_log.patch
Normal file
167
mptcpd/patches/remove_log.patch
Normal file
|
@ -0,0 +1,167 @@
|
|||
--- a/src/configuration.c 2021-06-29 17:44:20.481179981 +0200
|
||||
+++ b/src/configuration.c 2021-06-29 17:44:52.580655950 +0200
|
||||
@@ -37,21 +37,12 @@
|
||||
* Preprocessor concatenation that expands preprocessor tokens as
|
||||
* needed by leveraging the usual indirection technique.
|
||||
*/
|
||||
-///@{
|
||||
-/// Underlying string concatenation macro.
|
||||
-#define MPTCPD_CONCAT_IMPL(x, ...) x ## __VA_ARGS__
|
||||
-
|
||||
-/// Concatenate strings using the preprocessor.
|
||||
-#define MPTCPD_CONCAT(x, ...) MPTCPD_CONCAT_IMPL(x, __VA_ARGS__)
|
||||
-///@}
|
||||
|
||||
// Compile-time default logging choice
|
||||
#ifndef MPTCPD_LOGGER
|
||||
// This should never occur!
|
||||
# error Problem configuring default log message destination.
|
||||
#endif
|
||||
-/// Name of the default logging function determined at compile-time.
|
||||
-#define MPTCPD_SET_LOG_FUNCTION MPTCPD_CONCAT(l_log_set_, MPTCPD_LOGGER)
|
||||
|
||||
/**
|
||||
* @brief Get the function that sets the log message destination.
|
||||
@@ -474,7 +465,6 @@
|
||||
|
||||
struct mptcpd_config *mptcpd_config_create(int argc, char *argv[])
|
||||
{
|
||||
- MPTCPD_SET_LOG_FUNCTION(); // For early logging.
|
||||
|
||||
struct mptcpd_config *const config =
|
||||
l_new(struct mptcpd_config, 1);
|
||||
--- a/src/mptcpize.c 2021-06-29 19:29:57.810281053 +0200
|
||||
+++ b/src/mptcpize.c 2021-06-29 19:29:29.942701557 +0200
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <argp.h>
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
-#include <error.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -79,7 +78,7 @@
|
||||
nr++;
|
||||
envp = calloc(nr + 3, sizeof(char *));
|
||||
if (!envp)
|
||||
- error(1, errno, "can't allocate env list");
|
||||
+ fprintf(stderr, "can't allocate env list");
|
||||
|
||||
// ... filtering out any 'LD_PRELOAD' ...
|
||||
nr = 0;
|
||||
@@ -103,7 +102,7 @@
|
||||
// build the NULL terminated arg list
|
||||
argv = calloc(argc + 1, sizeof(char *));
|
||||
if (!argv)
|
||||
- error(1, errno, "can't allocate argument list");
|
||||
+ fprintf(stderr, "can't allocate argument list");
|
||||
|
||||
memcpy(argv, av, argc * sizeof(char*));
|
||||
return execvpe(argv[0], argv, envp);
|
||||
@@ -124,33 +123,33 @@
|
||||
len = strlen(name) + 1 + strlen(SYSTEMCTL_SHOW);
|
||||
cmd = malloc(len);
|
||||
if (!cmd)
|
||||
- error(1, 0, "can't allocate systemctl command string");
|
||||
+ fprintf(stderr, "can't allocate systemctl command string");
|
||||
|
||||
sprintf(cmd, SYSTEMCTL_SHOW"%s", name);
|
||||
systemctl = popen(cmd, "r");
|
||||
if (!systemctl)
|
||||
- error(1, errno, "can't execute %s", cmd);
|
||||
+ fprintf(stderr, "can't execute %s", cmd);
|
||||
|
||||
free(cmd);
|
||||
while ((read = getline(&line, &len, systemctl)) != -1) {
|
||||
if (strncmp(line, SYSTEMD_UNIT_VAR, strlen(SYSTEMD_UNIT_VAR)) == 0) {
|
||||
char *ret = strdup(&line[strlen(SYSTEMD_UNIT_VAR)]);
|
||||
if (!ret)
|
||||
- error(1, errno, "failed to duplicate string");
|
||||
+ fprintf(stderr, "failed to duplicate string");
|
||||
|
||||
// trim trailing newline, if any
|
||||
len = strlen(ret);
|
||||
if (len > 0 && ret[len - 1] == '\n')
|
||||
ret[--len] = 0;
|
||||
if (len == 0)
|
||||
- error(1, 0, "can't find unit file for service %s", name);
|
||||
+ fprintf(stderr, "can't find unit file for service %s", name);
|
||||
free(line);
|
||||
pclose(systemctl);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
- error(1, 0, "can't find FragmentPath attribute for unit %s", name);
|
||||
+ fprintf(stderr, "can't find FragmentPath attribute for unit %s", name);
|
||||
|
||||
// never reached: just silence gcc
|
||||
return NULL;
|
||||
@@ -175,12 +174,12 @@
|
||||
unit = locate_unit(argv[0]);
|
||||
src = fopen(unit, "r");
|
||||
if (!src)
|
||||
- error(1, errno, "can't open file %s", unit);
|
||||
+ fprintf(stderr, "can't open file %s", unit);
|
||||
|
||||
strcpy(dst_path, "/tmp/unit_XXXXXX");
|
||||
dst = mkstemp(dst_path);
|
||||
if (dst < 0)
|
||||
- error(1, errno, "can't create tmp file");
|
||||
+ fprintf(stderr, "can't create tmp file");
|
||||
|
||||
// reset any prior error, to allow later check on errno
|
||||
errno = 0;
|
||||
@@ -194,27 +193,27 @@
|
||||
|
||||
if (!is_env) {
|
||||
if (write(dst, line, read) < 0)
|
||||
- error(1, errno, "can't write '%s' into %s", line, dst_path);
|
||||
+ fprintf(stderr, "can't write '%s' into %s", line, dst_path);
|
||||
}
|
||||
|
||||
if (append_env &&
|
||||
(is_env || strncmp(line, SYSTEMD_SERVICE_TAG, strlen(SYSTEMD_SERVICE_TAG)) == 0)) {
|
||||
if (dprintf(dst, "%s%s\n", SYSTEMD_ENV_VAR, MPTCPWRAP_ENV) < 0)
|
||||
- error(1, errno, "can't write to env string into %s", dst_path);
|
||||
+ fprintf(stderr, "can't write to env string into %s", dst_path);
|
||||
append_env = 0;
|
||||
}
|
||||
}
|
||||
if (errno != 0)
|
||||
- error(1, errno, "can't read from %s", unit);
|
||||
+ fprintf(stderr, "can't read from %s", unit);
|
||||
free(line);
|
||||
fclose(src);
|
||||
close(dst);
|
||||
|
||||
if (rename(dst_path, unit) < 0)
|
||||
- error(1, errno, "can't rename %s to %s", dst_path, unit);
|
||||
+ fprintf(stderr, "can't rename %s to %s", dst_path, unit);
|
||||
|
||||
if (system("systemctl daemon-reload") != 0)
|
||||
- error(1, errno, "can't reload unit, manual 'systemctl daemon-reload' is required");
|
||||
+ fprintf(stderr, "can't reload unit, manual 'systemctl daemon-reload' is required");
|
||||
|
||||
printf("mptcp successfully %s on unit %s\n",
|
||||
enable ? "enabled" : "disabled", unit);
|
||||
@@ -239,7 +238,7 @@
|
||||
argp_program_version = "mptcpize "VERSION;
|
||||
argp_program_bug_address = "<" PACKAGE_BUGREPORT ">";
|
||||
if (argp_parse(&argp, argc, argv, ARGP_IN_ORDER, &idx, 0) < 0)
|
||||
- error(1, errno, "can't parse arguments");
|
||||
+ fprintf(stderr, "can't parse arguments");
|
||||
|
||||
argc -= idx;
|
||||
argv += idx;
|
||||
--- a/src/mptcpize.c 2021-07-05 20:06:07.035838944 +0200
|
||||
+++ b/src/mptcpize.c 2021-07-05 20:06:26.875505617 +0200
|
||||
@@ -7,8 +7,6 @@
|
||||
* Copyright (c) 2021, Red Hat, Inc.
|
||||
*/
|
||||
|
||||
-#define _GNU_SOURCE
|
||||
-
|
||||
#include <linux/limits.h>
|
||||
|
||||
#include <sys/types.h>
|
52
netifd/Makefile
Normal file
52
netifd/Makefile
Normal file
|
@ -0,0 +1,52 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=netifd
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
|
||||
PKG_SOURCE_DATE:=2021-07-26
|
||||
PKG_SOURCE_VERSION:=440eb0647708274cc8d7d9e7c2bb0cfdfba90023
|
||||
PKG_MIRROR_HASH:=eed957036ab608fdc49bdf801fc5b4405fcd2a3a5e5d3343ec39898e156c10e9
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/netifd
|
||||
SECTION:=base
|
||||
CATEGORY:=Base system
|
||||
DEPENDS:=+libuci +libnl-tiny +libubus +ubus +ubusd +jshn +libubox
|
||||
TITLE:=OpenWrt Network Interface Configuration Daemon
|
||||
endef
|
||||
|
||||
define Package/netifd/conffiles
|
||||
/etc/udhcpc.user
|
||||
/etc/udhcpc.user.d/
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include/libnl-tiny \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-flto
|
||||
|
||||
TARGET_LDFLAGS += -flto -fuse-linker-plugin
|
||||
|
||||
CMAKE_OPTIONS += \
|
||||
-DLIBNL_LIBS=-lnl-tiny \
|
||||
-DDEBUG=1
|
||||
|
||||
define Package/netifd/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/netifd $(1)/sbin/
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/etc/udhcpc.user.d/
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/* $(1)/lib/netifd/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,netifd))
|
6
netifd/files/etc/hotplug.d/iface/00-netstate
Normal file
6
netifd/files/etc/hotplug.d/iface/00-netstate
Normal file
|
@ -0,0 +1,6 @@
|
|||
[ ifup = "$ACTION" ] && {
|
||||
uci_toggle_state network "$INTERFACE" up 1
|
||||
[ -n "$DEVICE" ] && {
|
||||
uci_toggle_state network "$INTERFACE" ifname "$DEVICE"
|
||||
}
|
||||
}
|
67
netifd/files/etc/hotplug.d/net/20-smp-packet-steering
Normal file
67
netifd/files/etc/hotplug.d/net/20-smp-packet-steering
Normal file
|
@ -0,0 +1,67 @@
|
|||
#!/bin/sh
|
||||
[ "$ACTION" = add ] || exit
|
||||
|
||||
NPROCS="$(grep -c "^processor.*:" /proc/cpuinfo)"
|
||||
[ "$NPROCS" -gt 1 ] || exit
|
||||
|
||||
PROC_MASK="$(( (1 << $NPROCS) - 1 ))"
|
||||
|
||||
find_irq_cpu() {
|
||||
local dev="$1"
|
||||
local match="$(grep -m 1 "$dev\$" /proc/interrupts)"
|
||||
local cpu=0
|
||||
|
||||
[ -n "$match" ] && {
|
||||
set -- $match
|
||||
shift
|
||||
for cur in $(seq 1 $NPROCS); do
|
||||
[ "$1" -gt 0 ] && {
|
||||
cpu=$(($cur - 1))
|
||||
break
|
||||
}
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
echo "$cpu"
|
||||
}
|
||||
|
||||
set_hex_val() {
|
||||
local file="$1"
|
||||
local val="$2"
|
||||
val="$(printf %x "$val")"
|
||||
[ -n "$DEBUG" ] && echo "$file = $val"
|
||||
echo "$val" > "$file"
|
||||
}
|
||||
|
||||
packet_steering="$(uci get "network.@globals[0].packet_steering")"
|
||||
[ "$packet_steering" != 1 ] && exit 0
|
||||
|
||||
exec 512>/var/lock/smp_tune.lock
|
||||
flock 512 || exit 1
|
||||
|
||||
for dev in /sys/class/net/*; do
|
||||
[ -d "$dev" ] || continue
|
||||
|
||||
# ignore virtual interfaces
|
||||
[ -n "$(ls "${dev}/" | grep '^lower_')" ] && continue
|
||||
[ -d "${dev}/device" ] || continue
|
||||
|
||||
device="$(readlink "${dev}/device")"
|
||||
device="$(basename "$device")"
|
||||
irq_cpu="$(find_irq_cpu "$device")"
|
||||
irq_cpu_mask="$((1 << $irq_cpu))"
|
||||
|
||||
for q in ${dev}/queues/tx-*; do
|
||||
set_hex_val "$q/xps_cpus" "$PROC_MASK"
|
||||
done
|
||||
|
||||
# ignore dsa slave ports for RPS
|
||||
subsys="$(readlink "${dev}/device/subsystem")"
|
||||
subsys="$(basename "$subsys")"
|
||||
[ "$subsys" = "mdio_bus" ] && continue
|
||||
|
||||
for q in ${dev}/queues/rx-*; do
|
||||
set_hex_val "$q/rps_cpus" "$PROC_MASK"
|
||||
done
|
||||
done
|
144
netifd/files/etc/init.d/network
Executable file
144
netifd/files/etc/init.d/network
Executable file
|
@ -0,0 +1,144 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=20
|
||||
STOP=90
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
init_switch() {
|
||||
setup_switch() { return 0; }
|
||||
|
||||
include /lib/network
|
||||
setup_switch
|
||||
}
|
||||
|
||||
start_service() {
|
||||
init_switch
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command /sbin/netifd
|
||||
procd_set_param respawn
|
||||
procd_set_param watch network.interface
|
||||
[ -e /proc/sys/kernel/core_pattern ] && {
|
||||
procd_set_param limits core="unlimited"
|
||||
}
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
local rv=0
|
||||
|
||||
init_switch
|
||||
ubus call network reload || rv=1
|
||||
/sbin/wifi reload_legacy
|
||||
return $rv
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
/sbin/wifi down
|
||||
ifdown -a
|
||||
sleep 1
|
||||
}
|
||||
|
||||
validate_atm_bridge_section()
|
||||
{
|
||||
uci_validate_section network "atm-bridge" "${1}" \
|
||||
'unit:uinteger:0' \
|
||||
'vci:range(32, 65535):35' \
|
||||
'vpi:range(0, 255):8' \
|
||||
'atmdev:uinteger:0' \
|
||||
'encaps:or("llc", "vc"):llc' \
|
||||
'payload:or("bridged", "routed"):bridged'
|
||||
}
|
||||
|
||||
validate_route_section()
|
||||
{
|
||||
uci_validate_section network route "${1}" \
|
||||
'interface:string' \
|
||||
'target:cidr4' \
|
||||
'netmask:netmask4' \
|
||||
'gateway:ip4addr' \
|
||||
'metric:uinteger' \
|
||||
'mtu:uinteger' \
|
||||
'table:or(range(0,65535),string)'
|
||||
}
|
||||
|
||||
validate_route6_section()
|
||||
{
|
||||
uci_validate_section network route6 "${1}" \
|
||||
'interface:string' \
|
||||
'target:cidr6' \
|
||||
'gateway:ip6addr' \
|
||||
'metric:uinteger' \
|
||||
'mtu:uinteger' \
|
||||
'table:or(range(0,65535),string)'
|
||||
}
|
||||
|
||||
validate_rule_section()
|
||||
{
|
||||
uci_validate_section network rule "${1}" \
|
||||
'in:string' \
|
||||
'out:string' \
|
||||
'src:cidr4' \
|
||||
'dest:cidr4' \
|
||||
'tos:range(0,31)' \
|
||||
'mark:string' \
|
||||
'invert:bool' \
|
||||
'lookup:or(range(0,65535),string)' \
|
||||
'goto:range(0,65535)' \
|
||||
'action:or("prohibit", "unreachable", "blackhole", "throw")'
|
||||
}
|
||||
|
||||
validate_rule6_section()
|
||||
{
|
||||
uci_validate_section network rule6 "${1}" \
|
||||
'in:string' \
|
||||
'out:string' \
|
||||
'src:cidr6' \
|
||||
'dest:cidr6' \
|
||||
'tos:range(0,31)' \
|
||||
'mark:string' \
|
||||
'invert:bool' \
|
||||
'lookup:or(range(0,65535),string)' \
|
||||
'goto:range(0,65535)' \
|
||||
'action:or("prohibit", "unreachable", "blackhole", "throw")'
|
||||
}
|
||||
|
||||
validate_switch_section()
|
||||
{
|
||||
uci_validate_section network switch "${1}" \
|
||||
'name:string' \
|
||||
'enable:bool' \
|
||||
'enable_vlan:bool' \
|
||||
'reset:bool' \
|
||||
'ar8xxx_mib_poll_interval:uinteger' \
|
||||
'ar8xxx_mib_type:range(0,1)'
|
||||
}
|
||||
|
||||
validate_switch_vlan()
|
||||
{
|
||||
uci_validate_section network switch_vlan "${1}" \
|
||||
'device:string' \
|
||||
'vlan:uinteger' \
|
||||
'ports:list(ports)'
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger network wireless
|
||||
|
||||
procd_open_validate
|
||||
validate_atm_bridge_section
|
||||
validate_route_section
|
||||
[ -e /proc/sys/net/ipv6 ] && validate_route6_section
|
||||
validate_rule_section
|
||||
[ -e /proc/sys/net/ipv6 ] && validate_rule6_section
|
||||
validate_switch_section
|
||||
validate_switch_vlan
|
||||
procd_close_validate
|
||||
}
|
||||
|
||||
shutdown() {
|
||||
ifdown -a
|
||||
sleep 1
|
||||
}
|
23
netifd/files/etc/uci-defaults/14_migrate-dhcp-release
Normal file
23
netifd/files/etc/uci-defaults/14_migrate-dhcp-release
Normal file
|
@ -0,0 +1,23 @@
|
|||
. /lib/functions.sh
|
||||
|
||||
migrate_release() {
|
||||
local config="$1"
|
||||
local proto
|
||||
local release
|
||||
|
||||
config_get proto "$config" proto
|
||||
config_get release "$config" release
|
||||
|
||||
[ "$proto" = "dhcp" ] && [ -n "$release" ] && {
|
||||
norelease="$((!$release))"
|
||||
uci_set network "$config" norelease "$norelease"
|
||||
uci_remove network "$config" release
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
config_load network
|
||||
config_foreach migrate_release interface
|
||||
uci commit network
|
||||
|
||||
exit 0
|
1
netifd/files/etc/udhcpc.user
Normal file
1
netifd/files/etc/udhcpc.user
Normal file
|
@ -0,0 +1 @@
|
|||
# This script is sourced by udhcpc's dhcp.script at every DHCP event.
|
120
netifd/files/lib/netifd/dhcp.script
Executable file
120
netifd/files/lib/netifd/dhcp.script
Executable file
|
@ -0,0 +1,120 @@
|
|||
#!/bin/sh
|
||||
[ -z "$1" ] && echo "Error: should be run by udhcpc" && exit 1
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/netifd/netifd-proto.sh
|
||||
|
||||
set_classless_routes() {
|
||||
local max=128
|
||||
while [ -n "$1" -a -n "$2" -a $max -gt 0 ]; do
|
||||
proto_add_ipv4_route "${1%%/*}" "${1##*/}" "$2" "$ip"
|
||||
max=$(($max-1))
|
||||
shift 2
|
||||
done
|
||||
}
|
||||
|
||||
setup_interface() {
|
||||
proto_init_update "*" 1
|
||||
proto_add_ipv4_address "$ip" "${subnet:-255.255.255.0}"
|
||||
# TODO: apply $broadcast
|
||||
|
||||
local ip_net
|
||||
eval "$(ipcalc.sh "$ip/$mask")";ip_net="$NETWORK"
|
||||
|
||||
local i
|
||||
for i in $router; do
|
||||
local gw_net
|
||||
eval "$(ipcalc.sh "$i/$mask")";gw_net="$NETWORK"
|
||||
|
||||
[ "$ip_net" != "$gw_net" ] && proto_add_ipv4_route "$i" 32 "" "$ip"
|
||||
#[ "$DEFAULTROUTE" = 0 ] || proto_add_ipv4_route 0.0.0.0 0 "$i" "$ip"
|
||||
proto_add_ipv4_route 0.0.0.0 0 "$i" "$ip"
|
||||
|
||||
local r
|
||||
for r in $CUSTOMROUTES; do
|
||||
proto_add_ipv4_route "${r%%/*}" "${r##*/}" "$i" "$ip"
|
||||
done
|
||||
done
|
||||
|
||||
# CIDR STATIC ROUTES (rfc3442)
|
||||
[ -n "$staticroutes" ] && set_classless_routes $staticroutes
|
||||
[ -n "$msstaticroutes" ] && set_classless_routes $msstaticroutes
|
||||
|
||||
for i in $dns; do
|
||||
proto_add_dns_server "$i"
|
||||
done
|
||||
for i in $domain; do
|
||||
proto_add_dns_search "$i"
|
||||
done
|
||||
|
||||
# TODO: Deprecate timesvr in favor of timesrv
|
||||
if [ -n "$timesvr" -a -z "$timesrv" ]; then
|
||||
timesrv="$timesvr"
|
||||
echo "Environment variable 'timesvr' will be deprecated; use 'timesrv' instead."
|
||||
fi
|
||||
|
||||
proto_add_data
|
||||
[ -n "$ZONE" ] && json_add_string zone "$ZONE"
|
||||
[ -n "$ntpsrv" ] && json_add_string ntpserver "$ntpsrv"
|
||||
[ -n "$timesrv" ] && json_add_string timeserver "$timesrv"
|
||||
[ -n "$hostname" ] && json_add_string hostname "$hostname"
|
||||
[ -n "$message" ] && json_add_string message "$message"
|
||||
[ -n "$timezone" ] && json_add_int timezone "$timezone"
|
||||
[ -n "$lease" ] && json_add_int leasetime "$lease"
|
||||
proto_close_data
|
||||
|
||||
proto_send_update "$INTERFACE"
|
||||
|
||||
|
||||
if [ "$IFACE6RD" != 0 -a -n "$ip6rd" ]; then
|
||||
local v4mask="${ip6rd%% *}"
|
||||
ip6rd="${ip6rd#* }"
|
||||
local ip6rdprefixlen="${ip6rd%% *}"
|
||||
ip6rd="${ip6rd#* }"
|
||||
local ip6rdprefix="${ip6rd%% *}"
|
||||
ip6rd="${ip6rd#* }"
|
||||
local ip6rdbr="${ip6rd%% *}"
|
||||
|
||||
[ -n "$ZONE" ] || ZONE=$(fw3 -q network $INTERFACE 2>/dev/null)
|
||||
[ -z "$IFACE6RD" -o "$IFACE6RD" = 1 ] && IFACE6RD=${INTERFACE}_6
|
||||
|
||||
json_init
|
||||
json_add_string name "$IFACE6RD"
|
||||
json_add_string ifname "@$INTERFACE"
|
||||
json_add_string proto "6rd"
|
||||
json_add_string peeraddr "$ip6rdbr"
|
||||
json_add_int ip4prefixlen "$v4mask"
|
||||
json_add_string ip6prefix "$ip6rdprefix"
|
||||
json_add_int ip6prefixlen "$ip6rdprefixlen"
|
||||
json_add_string tunlink "$INTERFACE"
|
||||
[ -n "$IFACE6RD_DELEGATE" ] && json_add_boolean delegate "$IFACE6RD_DELEGATE"
|
||||
[ -n "$ZONE6RD" ] || ZONE6RD=$ZONE
|
||||
[ -n "$ZONE6RD" ] && json_add_string zone "$ZONE6RD"
|
||||
[ -n "$MTU6RD" ] && json_add_string mtu "$MTU6RD"
|
||||
json_close_object
|
||||
|
||||
ubus call network add_dynamic "$(json_dump)"
|
||||
fi
|
||||
}
|
||||
|
||||
deconfig_interface() {
|
||||
proto_init_update "*" 0
|
||||
proto_send_update "$INTERFACE"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
deconfig)
|
||||
deconfig_interface
|
||||
;;
|
||||
renew|bound)
|
||||
setup_interface
|
||||
;;
|
||||
esac
|
||||
|
||||
# user rules
|
||||
[ -f /etc/udhcpc.user ] && . /etc/udhcpc.user "$@"
|
||||
for f in /etc/udhcpc.user.d/*; do
|
||||
[ -f "$f" ] && (. "$f" "$@")
|
||||
done
|
||||
|
||||
exit 0
|
89
netifd/files/lib/netifd/proto/dhcp.sh
Executable file
89
netifd/files/lib/netifd/proto/dhcp.sh
Executable file
|
@ -0,0 +1,89 @@
|
|||
#!/bin/sh
|
||||
|
||||
[ -L /sbin/udhcpc ] || exit 0
|
||||
|
||||
. /lib/functions.sh
|
||||
. ../netifd-proto.sh
|
||||
init_proto "$@"
|
||||
|
||||
proto_dhcp_init_config() {
|
||||
renew_handler=1
|
||||
|
||||
proto_config_add_string 'ipaddr:ipaddr'
|
||||
proto_config_add_string 'hostname:hostname'
|
||||
proto_config_add_string clientid
|
||||
proto_config_add_string vendorid
|
||||
proto_config_add_boolean 'broadcast:bool'
|
||||
proto_config_add_boolean 'norelease:bool'
|
||||
proto_config_add_string 'reqopts:list(string)'
|
||||
proto_config_add_boolean 'defaultreqopts:bool'
|
||||
proto_config_add_string iface6rd
|
||||
proto_config_add_array 'sendopts:list(string)'
|
||||
proto_config_add_boolean delegate
|
||||
proto_config_add_string zone6rd
|
||||
proto_config_add_string zone
|
||||
proto_config_add_string mtu6rd
|
||||
proto_config_add_string customroutes
|
||||
proto_config_add_boolean classlessroute
|
||||
}
|
||||
|
||||
proto_dhcp_add_sendopts() {
|
||||
[ -n "$1" ] && append "$3" "-x $1"
|
||||
}
|
||||
|
||||
proto_dhcp_setup() {
|
||||
local config="$1"
|
||||
local iface="$2"
|
||||
|
||||
local ipaddr hostname clientid vendorid broadcast norelease reqopts defaultreqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes classlessroute defaultroute
|
||||
json_get_vars ipaddr hostname clientid vendorid broadcast norelease reqopts defaultreqopts iface6rd delegate zone6rd zone mtu6rd customroutes classlessroute defaultroute
|
||||
|
||||
local opt dhcpopts
|
||||
for opt in $reqopts; do
|
||||
append dhcpopts "-O $opt"
|
||||
done
|
||||
|
||||
json_for_each_item proto_dhcp_add_sendopts sendopts dhcpopts
|
||||
|
||||
[ -z "$hostname" ] && hostname="$(cat /proc/sys/kernel/hostname)"
|
||||
[ "$hostname" = "*" ] && hostname=
|
||||
|
||||
[ "$defaultreqopts" = 0 ] && defaultreqopts="-o" || defaultreqopts=
|
||||
[ "$broadcast" = 1 ] && broadcast="-B" || broadcast=
|
||||
[ "$norelease" = 1 ] && norelease="" || norelease="-R"
|
||||
[ -n "$clientid" ] && clientid="-x 0x3d:${clientid//:/}" || clientid="-C"
|
||||
[ -n "$iface6rd" ] && proto_export "IFACE6RD=$iface6rd"
|
||||
[ "$iface6rd" != 0 -a -f /lib/netifd/proto/6rd.sh ] && append dhcpopts "-O 212"
|
||||
[ -n "$zone6rd" ] && proto_export "ZONE6RD=$zone6rd"
|
||||
[ -n "$zone" ] && proto_export "ZONE=$zone"
|
||||
[ -n "$mtu6rd" ] && proto_export "MTU6RD=$mtu6rd"
|
||||
[ -n "$customroutes" ] && proto_export "CUSTOMROUTES=$customroutes"
|
||||
[ -n "$defaultroute" ] && proto_export "DEFAULTROUTE=$defaultroute"
|
||||
[ "$delegate" = "0" ] && proto_export "IFACE6RD_DELEGATE=0"
|
||||
# Request classless route option (see RFC 3442) by default
|
||||
[ "$classlessroute" = "0" ] || append dhcpopts "-O 121"
|
||||
|
||||
proto_export "INTERFACE=$config"
|
||||
proto_run_command "$config" udhcpc \
|
||||
-p /var/run/udhcpc-$iface.pid \
|
||||
-s /lib/netifd/dhcp.script \
|
||||
-f -t 0 -i "$iface" \
|
||||
${ipaddr:+-r $ipaddr} \
|
||||
${hostname:+-x "hostname:$hostname"} \
|
||||
${vendorid:+-V "$vendorid"} \
|
||||
$clientid $defaultreqopts $broadcast $norelease $dhcpopts
|
||||
}
|
||||
|
||||
proto_dhcp_renew() {
|
||||
local interface="$1"
|
||||
# SIGUSR1 forces udhcpc to renew its lease
|
||||
local sigusr1="$(kill -l SIGUSR1)"
|
||||
[ -n "$sigusr1" ] && proto_kill_command "$interface" $sigusr1
|
||||
}
|
||||
|
||||
proto_dhcp_teardown() {
|
||||
local interface="$1"
|
||||
proto_kill_command "$interface"
|
||||
}
|
||||
|
||||
add_protocol dhcp
|
76
netifd/files/lib/network/config.sh
Executable file
76
netifd/files/lib/network/config.sh
Executable file
|
@ -0,0 +1,76 @@
|
|||
#!/bin/sh
|
||||
# Copyright (C) 2011 OpenWrt.org
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
find_config() {
|
||||
local device="$1"
|
||||
local ifdev ifl3dev ifobj
|
||||
for ifobj in $(ubus list network.interface.\*); do
|
||||
interface="${ifobj##network.interface.}"
|
||||
(
|
||||
json_load "$(ifstatus $interface)"
|
||||
json_get_var ifdev device
|
||||
json_get_var ifl3dev l3_device
|
||||
if [ "$device" = "$ifdev" ] || [ "$device" = "$ifl3dev" ]; then
|
||||
echo "$interface"
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
) && return
|
||||
done
|
||||
}
|
||||
|
||||
unbridge() {
|
||||
return
|
||||
}
|
||||
|
||||
ubus_call() {
|
||||
json_init
|
||||
local _data="$(ubus -S call "$1" "$2")"
|
||||
[ -z "$_data" ] && return 1
|
||||
json_load "$_data"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
fixup_interface() {
|
||||
local config="$1"
|
||||
local ifname type device l3dev
|
||||
|
||||
config_get type "$config" type
|
||||
config_get ifname "$config" ifname
|
||||
[ "bridge" = "$type" ] && ifname="br-$config"
|
||||
ubus_call "network.interface.$config" status || return 0
|
||||
json_get_var l3dev l3_device
|
||||
[ -n "$l3dev" ] && ifname="$l3dev"
|
||||
json_init
|
||||
config_set "$config" ifname "$ifname"
|
||||
}
|
||||
|
||||
scan_interfaces() {
|
||||
config_load network
|
||||
config_foreach fixup_interface interface
|
||||
}
|
||||
|
||||
prepare_interface_bridge() {
|
||||
local config="$1"
|
||||
|
||||
[ -n "$config" ] || return 0
|
||||
ubus call network.interface."$config" prepare
|
||||
}
|
||||
|
||||
setup_interface() {
|
||||
local iface="$1"
|
||||
local config="$2"
|
||||
|
||||
[ -n "$config" ] || return 0
|
||||
ubus call network.interface."$config" add_device "{ \"name\": \"$iface\" }"
|
||||
}
|
||||
|
||||
do_sysctl() {
|
||||
[ -n "$2" ] && \
|
||||
sysctl -n -e -w "$1=$2" >/dev/null || \
|
||||
sysctl -n -e "$1"
|
||||
}
|
12
netifd/files/sbin/devstatus
Executable file
12
netifd/files/sbin/devstatus
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
DEVICE="$1"
|
||||
|
||||
[ -n "$DEVICE" ] || {
|
||||
echo "Usage: $0 <device>"
|
||||
exit 1
|
||||
}
|
||||
|
||||
json_init
|
||||
json_add_string name "$DEVICE"
|
||||
ubus call network.device status "$(json_dump)"
|
1
netifd/files/sbin/ifdown
Symbolic link
1
netifd/files/sbin/ifdown
Symbolic link
|
@ -0,0 +1 @@
|
|||
ifup
|
13
netifd/files/sbin/ifstatus
Executable file
13
netifd/files/sbin/ifstatus
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
INTERFACE="$1"
|
||||
|
||||
[ -n "$INTERFACE" ] || {
|
||||
echo "Usage: $0 <interface>"
|
||||
exit 1
|
||||
}
|
||||
|
||||
ubus -S list "network.interface.$INTERFACE" >/dev/null || {
|
||||
echo "Interface $INTERFACE not found"
|
||||
exit 1
|
||||
}
|
||||
ubus call network.interface status "{ \"interface\" : \"$INTERFACE\" }"
|
77
netifd/files/sbin/ifup
Executable file
77
netifd/files/sbin/ifup
Executable file
|
@ -0,0 +1,77 @@
|
|||
#!/bin/sh
|
||||
|
||||
ifup_all=
|
||||
setup_wifi=
|
||||
|
||||
if_call() {
|
||||
local interface="$1"
|
||||
for mode in $modes; do
|
||||
ubus call network.interface $mode "{ \"interface\" : \"$interface\" }"
|
||||
done
|
||||
}
|
||||
|
||||
case "$0" in
|
||||
*ifdown) modes=down;;
|
||||
*ifup)
|
||||
modes="down up"
|
||||
setup_wifi=1
|
||||
;;
|
||||
*) echo "Invalid command: $0";;
|
||||
esac
|
||||
|
||||
while :; do
|
||||
case "$1" in
|
||||
-a)
|
||||
ifup_all=1
|
||||
shift
|
||||
;;
|
||||
-w)
|
||||
setup_wifi=
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
[ "$modes" = "down up" ] && ubus call network reload
|
||||
if [ -n "$ifup_all" ]; then
|
||||
for interface in $(ubus -S list 'network.interface.*'); do
|
||||
if_call "${interface##network.interface.}"
|
||||
done
|
||||
[ -n "$setup_wifi" ] && /sbin/wifi up
|
||||
exit
|
||||
else
|
||||
ubus -S list "network.interface.$1" > /dev/null || {
|
||||
echo "Interface $1 not found"
|
||||
exit
|
||||
}
|
||||
if_call "$1"
|
||||
fi
|
||||
|
||||
if [ -n "$setup_wifi" ] && grep -sq config /etc/config/wireless; then
|
||||
. /lib/functions.sh
|
||||
|
||||
find_related_radios() {
|
||||
local wdev wnet
|
||||
config_get wdev "$1" device
|
||||
config_get wnet "$1" network
|
||||
|
||||
if [ -n "$wdev" ]; then
|
||||
for wnet in $wnet; do
|
||||
if [ "$wnet" = "$network" ]; then
|
||||
append radio_devs "$wdev" "$N"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
network="$1"
|
||||
config_load wireless
|
||||
config_foreach find_related_radios wifi-iface
|
||||
|
||||
for dev in $(echo "$radio_devs" | sort -u); do
|
||||
/sbin/wifi up "$dev"
|
||||
done
|
||||
fi
|
57
netifd/files/usr/share/udhcpc/default.script
Executable file
57
netifd/files/usr/share/udhcpc/default.script
Executable file
|
@ -0,0 +1,57 @@
|
|||
#!/bin/sh
|
||||
[ -z "$1" ] && echo "Error: should be run by udhcpc" && exit 1
|
||||
|
||||
set_classless_routes() {
|
||||
local max=128
|
||||
local type
|
||||
while [ -n "$1" -a -n "$2" -a $max -gt 0 ]; do
|
||||
[ ${1##*/} -eq 32 ] && type=host || type=net
|
||||
echo "udhcpc: adding route for $type $1 via $2"
|
||||
route add -$type "$1" gw "$2" dev "$interface"
|
||||
max=$(($max-1))
|
||||
shift 2
|
||||
done
|
||||
}
|
||||
|
||||
setup_interface() {
|
||||
echo "udhcpc: ip addr add $ip/${subnet:-255.255.255.0} broadcast ${broadcast:-+} dev $interface"
|
||||
ip addr add $ip/${subnet:-255.255.255.0} broadcast ${broadcast:-+} dev $interface
|
||||
|
||||
[ -n "$router" ] && [ "$router" != "0.0.0.0" ] && [ "$router" != "255.255.255.255" ] && {
|
||||
echo "udhcpc: setting default routers: $router"
|
||||
|
||||
local valid_gw=""
|
||||
for i in $router ; do
|
||||
route add default gw $i dev $interface
|
||||
valid_gw="${valid_gw:+$valid_gw|}$i"
|
||||
done
|
||||
|
||||
eval $(route -n | awk '
|
||||
/^0.0.0.0\W{9}('$valid_gw')\W/ {next}
|
||||
/^0.0.0.0/ {print "route del -net "$1" gw "$2";"}
|
||||
')
|
||||
}
|
||||
|
||||
# CIDR STATIC ROUTES (rfc3442)
|
||||
[ -n "$staticroutes" ] && set_classless_routes $staticroutes
|
||||
[ -n "$msstaticroutes" ] && set_classless_routes $msstaticroutes
|
||||
}
|
||||
|
||||
|
||||
applied=
|
||||
case "$1" in
|
||||
deconfig)
|
||||
ip -4 addr flush dev "$interface"
|
||||
;;
|
||||
renew)
|
||||
setup_interface update
|
||||
;;
|
||||
bound)
|
||||
setup_interface ifup
|
||||
;;
|
||||
esac
|
||||
|
||||
# user rules
|
||||
[ -f /etc/udhcpc.user ] && . /etc/udhcpc.user
|
||||
|
||||
exit 0
|
|
@ -10,8 +10,9 @@ shift
|
|||
|
||||
# main loop
|
||||
while true; do
|
||||
rx=`vnstat -i $OMR_QUOTA_INTERFACE --json | jsonfilter -q -e '@.interfaces[0].traffic.months[-1].rx' | tr -d "\n"`
|
||||
tx=`vnstat -i $OMR_QUOTA_INTERFACE --json | jsonfilter -q -e '@.interfaces[0].traffic.months[-1].tx' | tr -d "\n"`
|
||||
OMR_QUOTA_REAL_INTERFACE="$(ifstatus $OMR_QUOTA_INTERFACE | jsonfilter -e '@.l3_device')"
|
||||
rx=`vnstat -i $OMR_QUOTA_REAL_INTERFACE --json | jsonfilter -q -e '@.interfaces[0].traffic.months[-1].rx' | tr -d "\n"`
|
||||
tx=`vnstat -i $OMR_QUOTA_REAL_INTERFACE --json | jsonfilter -q -e '@.interfaces[0].traffic.months[-1].tx' | tr -d "\n"`
|
||||
tt=$((rx + tx))
|
||||
if [ -n "$OMR_QUOTA_RX" ] && [ "$OMR_QUOTA_RX" -gt 0 ] && [ -n "$rx" ] && [ "$OMR_QUOTA_RX" -le "$rx" ]; then
|
||||
if [ "$(ifstatus $OMR_QUOTA_INTERFACE | jsonfilter -e '@.up')" = "true" ]; then
|
||||
|
|
|
@ -23,7 +23,8 @@ _ping_server() {
|
|||
_ping_tunnel() {
|
||||
local name=$1
|
||||
config_get gateway $1 gateway
|
||||
config_get ifname $1 ifname
|
||||
config_get ifname $1 device
|
||||
[ -z "$ifname" ] && config_get ifname $1 ifname
|
||||
config_get disabled $1 disabled
|
||||
[ "$(echo $ifname | grep oip)" != "" ] && [ -n "$gateway" ] && [ "$disabled" != "1" ] && {
|
||||
_ping_server $gateway
|
||||
|
|
|
@ -23,9 +23,9 @@ config defaults 'defaults'
|
|||
option interval_tries '1'
|
||||
option type 'ping'
|
||||
option wait_test '0'
|
||||
option server_http_test '1'
|
||||
option server_http_test '0'
|
||||
option restart_down '0'
|
||||
option options ''
|
||||
option mail_alert '0'
|
||||
|
||||
config proxy 'proxy'
|
||||
option enabled '1'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# shellcheck disable=SC2039
|
||||
# vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 :
|
||||
# Copyright (C) 2018 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||
# Copyright (C) 2018-2021 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||
# Released under GPL 3. See LICENSE for the full terms.
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
|
@ -12,6 +12,7 @@
|
|||
}
|
||||
|
||||
. /usr/lib/unbound/iptools.sh
|
||||
. /lib/functions/network.sh
|
||||
|
||||
_validate_section() {
|
||||
local tmp_hosts=$hosts tmp_hosts6=$hosts6 tmp_timeout=$timeout tmp_tries=$tries
|
||||
|
@ -27,7 +28,7 @@ _validate_section() {
|
|||
'wait_test:uinteger' \
|
||||
'type:string:undef' \
|
||||
'enabled:bool:1' \
|
||||
'server_http_test:bool:1' \
|
||||
'server_http_test:bool:0' \
|
||||
'options:string'
|
||||
|
||||
[ -z "$hosts" ] && hosts=$tmp_hosts
|
||||
|
@ -53,9 +54,11 @@ _launch_tracker() {
|
|||
_validate_section "interface" "$1"
|
||||
|
||||
local ifname ip4table
|
||||
ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
|
||||
network_get_device ifname $1
|
||||
[ -z "$ifname" ] && network_get_physdev ifname $1
|
||||
[ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$ifname" ] && ifname=$(ifstatus "$1_4" | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -z "$ifname" ] && config_get ifname "$1" ifname
|
||||
[ -z "$ifname" ] && config_get ifname "$1" device
|
||||
[ -n "$(echo $ifname | grep '@')" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["device"]')
|
||||
|
||||
config_get multipath "$1" multipath
|
||||
|
|
|
@ -95,7 +95,7 @@ fi
|
|||
|
||||
if [ "$(uci -q get omr-tracker.defaults.server_http_test)" = "" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set omr-tracker.defaults.server_http_test=1
|
||||
set omr-tracker.defaults.server_http_test=0
|
||||
commit omr-tracker
|
||||
EOF
|
||||
fi
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue