Merge branch 'develop'
751
.circleci/config.yml
Normal file
|
@ -0,0 +1,751 @@
|
|||
version: 2
|
||||
jobs:
|
||||
prepare:
|
||||
machine:
|
||||
image: ubuntu-1604:201903-01
|
||||
|
||||
working_directory: ~/
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: Prepare
|
||||
command: |
|
||||
sudo rm -rf /var/lib/apt/lists/lock
|
||||
sudo apt-get update
|
||||
sudo rm -rf /var/lib/apt/lists/lock
|
||||
sudo apt-get install -yq build-essential git unzip ncurses-dev libz-dev libssl-dev python subversion gettext gawk wget curl rsync perl libelf-dev python3.5 libpython3.5-stdlib liblzma-dev
|
||||
pyenv global 3.5.2
|
||||
|
||||
build_x86_64:
|
||||
machine:
|
||||
image: ubuntu-1604:201903-01
|
||||
|
||||
environment:
|
||||
- OMR_VERSION: $CIRCLE_TAG
|
||||
- OMR_TARGET: x86_64
|
||||
- OMR_KERNEL: 5.4
|
||||
|
||||
working_directory: ~/
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: cache
|
||||
command: |
|
||||
echo "cache 107 $OMR_KERNEL $OMR_TARGET" > /tmp/cache-target
|
||||
echo "cache 108 $OMR_KERNEL $OMR_TARGET $OMR_VERSION" > /tmp/cache-version
|
||||
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "/tmp/cache-version" }}
|
||||
- cache-{{ checksum "/tmp/cache-target" }}
|
||||
|
||||
- run:
|
||||
name: Build toolchain
|
||||
no_output_timeout: 50m
|
||||
command: |
|
||||
git clone https://github.com/suyuan168/3grouter || true
|
||||
cd openmptcprouter
|
||||
git checkout ${CIRCLE_BRANCH:-$CIRCLE_TAG} || true
|
||||
git pull || true
|
||||
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
|
||||
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
sudo apt-get update
|
||||
sudo apt-get install -yq libelf-dev
|
||||
pyenv global 3.5.2
|
||||
sh build.sh prepare {tools,toolchain}/install -j2
|
||||
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build
|
||||
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build.pub
|
||||
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "/tmp/cache-target" }}
|
||||
paths:
|
||||
- openmptcprouter
|
||||
|
||||
- run:
|
||||
name: Build
|
||||
no_output_timeout: 50m
|
||||
command: make IGNORE_ERRORS=m -C ~/openmptcprouter/$OMR_TARGET/source package/{compile,install,index} target/install -j2
|
||||
|
||||
- run:
|
||||
name: Deploy
|
||||
command: |
|
||||
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
|
||||
rsync -av --delete-after ~/openmptcprouter/$OMR_TARGET/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
|
||||
rm -rf ~/openmptcprouter/$OMR_TARGET/source/bin
|
||||
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "/tmp/cache-version" }}
|
||||
paths:
|
||||
- openmptcprouter
|
||||
|
||||
build_x86:
|
||||
machine:
|
||||
image: ubuntu-1604:201903-01
|
||||
|
||||
environment:
|
||||
- OMR_VERSION: $CIRCLE_TAG
|
||||
- OMR_TARGET: x86
|
||||
- OMR_KERNEL: 5.4
|
||||
|
||||
working_directory: ~/
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: cache
|
||||
command: |
|
||||
echo "cache 107 $OMR_KERNEL $OMR_TARGET" > /tmp/cache-target
|
||||
echo "cache 108 $OMR_KERNEL $OMR_TARGET $OMR_VERSION" > /tmp/cache-version
|
||||
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "/tmp/cache-version" }}
|
||||
- cache-{{ checksum "/tmp/cache-target" }}
|
||||
|
||||
- run:
|
||||
name: Build toolchain
|
||||
no_output_timeout: 40m
|
||||
command: |
|
||||
git clone https://github.com/suyuan168/3grouter || true
|
||||
cd openmptcprouter
|
||||
git checkout ${CIRCLE_BRANCH:-$CIRCLE_TAG} || true
|
||||
git pull || true
|
||||
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
|
||||
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
pyenv global 3.5.2
|
||||
sh build.sh prepare {tools,toolchain}/install -j2
|
||||
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build
|
||||
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build.pub
|
||||
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "/tmp/cache-target" }}
|
||||
paths:
|
||||
- openmptcprouter
|
||||
|
||||
- run:
|
||||
name: Build
|
||||
no_output_timeout: 40m
|
||||
command: make IGNORE_ERRORS=m -C ~/openmptcprouter/$OMR_TARGET/source package/{compile,install,index} target/install -j2
|
||||
|
||||
- run:
|
||||
name: Deploy
|
||||
command: |
|
||||
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
|
||||
rsync -av --delete-after ~/openmptcprouter/$OMR_TARGET/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
|
||||
rm -rf ~/openmptcprouter/$OMR_TARGET/source/bin
|
||||
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "/tmp/cache-version" }}
|
||||
paths:
|
||||
- openmptcprouter
|
||||
|
||||
build_rpi3:
|
||||
machine:
|
||||
image: ubuntu-1604:201903-01
|
||||
|
||||
environment:
|
||||
- OMR_VERSION: $CIRCLE_TAG
|
||||
- OMR_TARGET: rpi3
|
||||
- OMR_KERNEL: 5.4
|
||||
|
||||
working_directory: ~/
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: cache
|
||||
command: |
|
||||
echo "cache 107 $OMR_KERNEL $OMR_TARGET" > /tmp/cache-target
|
||||
echo "cache 108 $OMR_KERNEL $OMR_TARGET $OMR_VERSION" > /tmp/cache-version
|
||||
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "/tmp/cache-version" }}
|
||||
- cache-{{ checksum "/tmp/cache-target" }}
|
||||
|
||||
- run:
|
||||
name: Build toolchain
|
||||
no_output_timeout: 40m
|
||||
command: |
|
||||
git clone https://github.com/suyuan168/3grouter || true
|
||||
cd openmptcprouter
|
||||
git checkout ${CIRCLE_BRANCH:-$CIRCLE_TAG} || true
|
||||
git pull || true
|
||||
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
|
||||
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
pyenv global 3.5.2
|
||||
sh build.sh prepare {tools,toolchain}/install -j2
|
||||
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build
|
||||
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build.pub
|
||||
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "/tmp/cache-target" }}
|
||||
paths:
|
||||
- openmptcprouter
|
||||
|
||||
- run:
|
||||
name: Build
|
||||
no_output_timeout: 40m
|
||||
command: make IGNORE_ERRORS=m -C ~/openmptcprouter/$OMR_TARGET/source package/{compile,install,index} target/compile -j2 package/compile -j2 target/install -j2
|
||||
|
||||
- run:
|
||||
name: Deploy
|
||||
command: |
|
||||
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
|
||||
rsync -av --delete-after ~/openmptcprouter/$OMR_TARGET/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
|
||||
rm -rf ~/openmptcprouter/$OMR_TARGET/source/bin
|
||||
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "/tmp/cache-version" }}
|
||||
paths:
|
||||
- openmptcprouter
|
||||
|
||||
build_espressobin:
|
||||
machine:
|
||||
image: ubuntu-1604:201903-01
|
||||
|
||||
environment:
|
||||
- OMR_VERSION: $CIRCLE_TAG
|
||||
- OMR_TARGET: espressobin
|
||||
- OMR_KERNEL: 5.4
|
||||
|
||||
working_directory: ~/
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: cache
|
||||
command: |
|
||||
echo "cache 107 $OMR_KERNEL $OMR_TARGET" > /tmp/cache-target
|
||||
echo "cache 108 $OMR_KERNEL $OMR_TARGET $OMR_VERSION" > /tmp/cache-version
|
||||
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "/tmp/cache-version" }}
|
||||
- cache-{{ checksum "/tmp/cache-target" }}
|
||||
|
||||
- run:
|
||||
name: Build toolchain
|
||||
no_output_timeout: 40m
|
||||
command: |
|
||||
git clone https://github.com/suyuan168/3grouter || true
|
||||
cd openmptcprouter
|
||||
git checkout ${CIRCLE_BRANCH:-$CIRCLE_TAG} || true
|
||||
git pull || true
|
||||
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
|
||||
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
pyenv global 3.5.2
|
||||
sh build.sh prepare {tools,toolchain}/install -j2
|
||||
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build
|
||||
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build.pub
|
||||
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "/tmp/cache-target" }}
|
||||
paths:
|
||||
- openmptcprouter
|
||||
|
||||
- run:
|
||||
name: Build
|
||||
no_output_timeout: 40m
|
||||
command: make IGNORE_ERRORS=m -C ~/openmptcprouter/$OMR_TARGET/source package/{compile,install,index} target/compile -j2 package/compile -j2 target/install -j2
|
||||
|
||||
- run:
|
||||
name: Deploy
|
||||
command: |
|
||||
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
|
||||
rsync -av --delete-after ~/openmptcprouter/$OMR_TARGET/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
|
||||
rm -rf ~/openmptcprouter/$OMR_TARGET/source/bin
|
||||
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "/tmp/cache-version" }}
|
||||
paths:
|
||||
- openmptcprouter
|
||||
|
||||
build_r2s:
|
||||
machine:
|
||||
image: ubuntu-1604:201903-01
|
||||
|
||||
environment:
|
||||
- OMR_VERSION: $CIRCLE_TAG
|
||||
- OMR_TARGET: r2s
|
||||
- OMR_KERNEL: 5.4
|
||||
|
||||
working_directory: ~/
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: cache
|
||||
command: |
|
||||
echo "cache 107 $OMR_KERNEL $OMR_TARGET" > /tmp/cache-target
|
||||
echo "cache 108 $OMR_KERNEL $OMR_TARGET $OMR_VERSION" > /tmp/cache-version
|
||||
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "/tmp/cache-version" }}
|
||||
- cache-{{ checksum "/tmp/cache-target" }}
|
||||
|
||||
- run:
|
||||
name: Build toolchain
|
||||
no_output_timeout: 40m
|
||||
command: |
|
||||
git clone https://github.com/suyuan168/3grouter || true
|
||||
cd openmptcprouter
|
||||
git checkout ${CIRCLE_BRANCH:-$CIRCLE_TAG} || true
|
||||
git pull || true
|
||||
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
|
||||
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
pyenv global 3.5.2
|
||||
sh build.sh prepare {tools,toolchain}/install -j2
|
||||
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build
|
||||
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build.pub
|
||||
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "/tmp/cache-target" }}
|
||||
paths:
|
||||
- openmptcprouter
|
||||
|
||||
- run:
|
||||
name: Build
|
||||
no_output_timeout: 40m
|
||||
command: make IGNORE_ERRORS=m -C ~/openmptcprouter/$OMR_TARGET/source package/{compile,install,index} target/compile -j2 package/compile -j2 target/install -j2
|
||||
|
||||
- run:
|
||||
name: Deploy
|
||||
command: |
|
||||
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
|
||||
rsync -av --delete-after ~/openmptcprouter/$OMR_TARGET/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
|
||||
rm -rf ~/openmptcprouter/$OMR_TARGET/source/bin
|
||||
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "/tmp/cache-version" }}
|
||||
paths:
|
||||
- openmptcprouter
|
||||
|
||||
build_rpi4:
|
||||
machine:
|
||||
image: ubuntu-1604:201903-01
|
||||
|
||||
environment:
|
||||
- OMR_VERSION: $CIRCLE_TAG
|
||||
- OMR_TARGET: rpi4
|
||||
- OMR_KERNEL: 5.4
|
||||
|
||||
working_directory: ~/
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: cache
|
||||
command: |
|
||||
echo "cache 107 $OMR_KERNEL $OMR_TARGET" > /tmp/cache-target
|
||||
echo "cache 108 $OMR_KERNEL $OMR_TARGET $OMR_VERSION" > /tmp/cache-version
|
||||
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "/tmp/cache-version" }}
|
||||
- cache-{{ checksum "/tmp/cache-target" }}
|
||||
|
||||
- run:
|
||||
name: Build toolchain
|
||||
no_output_timeout: 40m
|
||||
command: |
|
||||
git clone https://github.com/suyuan168/3grouter || true
|
||||
cd openmptcprouter
|
||||
git checkout ${CIRCLE_BRANCH:-$CIRCLE_TAG} || true
|
||||
git pull || true
|
||||
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
|
||||
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
pyenv global 3.5.2
|
||||
sh build.sh prepare {tools,toolchain}/install -j2
|
||||
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build
|
||||
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build.pub
|
||||
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "/tmp/cache-target" }}
|
||||
paths:
|
||||
- openmptcprouter
|
||||
|
||||
- run:
|
||||
name: Build
|
||||
no_output_timeout: 40m
|
||||
command: make IGNORE_ERRORS=m -C ~/openmptcprouter/$OMR_TARGET/source package/{compile,install,index} target/compile -j2 package/compile -j2 target/install -j2
|
||||
|
||||
- run:
|
||||
name: Deploy
|
||||
command: |
|
||||
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
|
||||
rsync -av --delete-after ~/openmptcprouter/$OMR_TARGET/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
|
||||
rm -rf ~/openmptcprouter/$OMR_TARGET/source/bin
|
||||
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "/tmp/cache-version" }}
|
||||
paths:
|
||||
- openmptcprouter
|
||||
|
||||
build_rpi2:
|
||||
machine:
|
||||
image: ubuntu-1604:201903-01
|
||||
|
||||
environment:
|
||||
- OMR_VERSION: $CIRCLE_TAG
|
||||
- OMR_TARGET: rpi2
|
||||
- OMR_KERNEL: 5.4
|
||||
|
||||
working_directory: ~/
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: cache
|
||||
command: |
|
||||
echo "cache 107 $OMR_KERNEL $OMR_TARGET" > /tmp/cache-target
|
||||
echo "cache 108 $OMR_KERNEL $OMR_TARGET $OMR_VERSION" > /tmp/cache-version
|
||||
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "/tmp/cache-version" }}
|
||||
- cache-{{ checksum "/tmp/cache-target" }}
|
||||
|
||||
- run:
|
||||
name: Build toolchain
|
||||
no_output_timeout: 40m
|
||||
command: |
|
||||
git clone https://github.com/suyuan168/3grouter || true
|
||||
cd openmptcprouter
|
||||
git checkout ${CIRCLE_BRANCH:-$CIRCLE_TAG} || true
|
||||
git pull || true
|
||||
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
|
||||
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
pyenv global 3.5.2
|
||||
sh build.sh prepare {tools,toolchain}/install -j2
|
||||
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build
|
||||
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build.pub
|
||||
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "/tmp/cache-target" }}
|
||||
paths:
|
||||
- openmptcprouter
|
||||
|
||||
- run:
|
||||
name: Build
|
||||
no_output_timeout: 40m
|
||||
command: make IGNORE_ERRORS=m -C ~/openmptcprouter/$OMR_TARGET/source package/{compile,install,index} target/compile package/compile target/install -j2
|
||||
|
||||
- run:
|
||||
name: Deploy
|
||||
command: |
|
||||
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
|
||||
rsync -av --delete-after ~/openmptcprouter/$OMR_TARGET/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
|
||||
rm -rf ~/openmptcprouter/$OMR_TARGET/source/bin
|
||||
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "/tmp/cache-version" }}
|
||||
paths:
|
||||
- openmptcprouter
|
||||
|
||||
build_bpi-r2:
|
||||
machine:
|
||||
image: ubuntu-1604:201903-01
|
||||
|
||||
environment:
|
||||
- OMR_VERSION: $CIRCLE_TAG
|
||||
- OMR_TARGET: bpi-r2
|
||||
- OMR_KERNEL: 5.4
|
||||
|
||||
working_directory: ~/
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: cache
|
||||
command: |
|
||||
echo "cache 107 $OMR_KERNEL $OMR_TARGET" > /tmp/cache-target
|
||||
echo "cache 108 $OMR_KERNEL $OMR_TARGET $OMR_VERSION" > /tmp/cache-version
|
||||
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "/tmp/cache-version" }}
|
||||
- cache-{{ checksum "/tmp/cache-target" }}
|
||||
|
||||
- run:
|
||||
name: Build toolchain
|
||||
no_output_timeout: 40m
|
||||
command: |
|
||||
git clone https://github.com/suyuan168/3grouter || true
|
||||
cd openmptcprouter
|
||||
git checkout ${CIRCLE_BRANCH:-$CIRCLE_TAG} || true
|
||||
git pull || true
|
||||
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
|
||||
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
pyenv global 3.5.2
|
||||
sh build.sh prepare {tools,toolchain}/install -j2
|
||||
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build
|
||||
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build.pub
|
||||
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "/tmp/cache-target" }}
|
||||
paths:
|
||||
- openmptcprouter
|
||||
|
||||
- run:
|
||||
name: Build
|
||||
no_output_timeout: 40m
|
||||
command: |
|
||||
sudo apt-get update
|
||||
sudo apt-get -yq install swig2.0
|
||||
make IGNORE_ERRORS=m -C ~/openmptcprouter/$OMR_TARGET/source package/{compile,install,index} target/compile -j2 package/compile -j2 target/install -j2
|
||||
|
||||
- run:
|
||||
name: Deploy
|
||||
command: |
|
||||
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
|
||||
rsync -av --delete-after ~/openmptcprouter/$OMR_TARGET/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
|
||||
rm -rf ~/openmptcprouter/$OMR_TARGET/source/bin
|
||||
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "/tmp/cache-version" }}
|
||||
paths:
|
||||
- openmptcprouter
|
||||
|
||||
build_wrt3200acm:
|
||||
machine:
|
||||
image: ubuntu-1604:201903-01
|
||||
|
||||
environment:
|
||||
- OMR_VERSION: $CIRCLE_TAG
|
||||
- OMR_TARGET: wrt3200acm
|
||||
- OMR_KERNEL: 5.4
|
||||
|
||||
working_directory: ~/
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: cache
|
||||
command: |
|
||||
echo "cache 107 $OMR_KERNEL $OMR_TARGET" > /tmp/cache-target
|
||||
echo "cache 108 $OMR_KERNEL $OMR_TARGET $OMR_VERSION" > /tmp/cache-version
|
||||
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "/tmp/cache-version" }}
|
||||
- cache-{{ checksum "/tmp/cache-target" }}
|
||||
|
||||
- run:
|
||||
name: Build toolchain
|
||||
no_output_timeout: 40m
|
||||
command: |
|
||||
git clone https://github.com/suyuan168/3grouter || true
|
||||
cd openmptcprouter
|
||||
git checkout ${CIRCLE_BRANCH:-$CIRCLE_TAG} || true
|
||||
git pull || true
|
||||
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
|
||||
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
pyenv global 3.5.2
|
||||
sh build.sh prepare {tools,toolchain}/install -j2
|
||||
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build
|
||||
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build.pub
|
||||
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "/tmp/cache-target" }}
|
||||
paths:
|
||||
- openmptcprouter
|
||||
|
||||
- run:
|
||||
name: Build
|
||||
no_output_timeout: 40m
|
||||
command: make IGNORE_ERRORS=m -C ~/openmptcprouter/$OMR_TARGET/source package/{compile,install,index} target/compile -j2 package/compile -j2 target/install -j2
|
||||
|
||||
- run:
|
||||
name: Deploy
|
||||
command: |
|
||||
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
|
||||
rsync -av --delete-after ~/openmptcprouter/$OMR_TARGET/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
|
||||
rm -rf ~/openmptcprouter/$OMR_TARGET/source/bin
|
||||
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "/tmp/cache-version" }}
|
||||
paths:
|
||||
- openmptcprouter
|
||||
|
||||
build_wrt32:
|
||||
machine:
|
||||
image: ubuntu-1604:201903-01
|
||||
|
||||
environment:
|
||||
- OMR_VERSION: $CIRCLE_TAG
|
||||
- OMR_KERNEL: 5.4
|
||||
|
||||
working_directory: ~/
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: cache
|
||||
command: |
|
||||
echo "cache 107 $OMR_KERNEL $OMR_TARGET" > /tmp/cache-target
|
||||
echo "cache 108 $OMR_KERNEL $OMR_TARGET $OMR_VERSION" > /tmp/cache-version
|
||||
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "/tmp/cache-version" }}
|
||||
- cache-{{ checksum "/tmp/cache-target" }}
|
||||
|
||||
- run:
|
||||
name: Build toolchain wrt3200acm
|
||||
no_output_timeout: 40m
|
||||
command: |
|
||||
git clone https://github.com/suyuan168/3grouter || true
|
||||
cd openmptcprouter
|
||||
git checkout ${CIRCLE_BRANCH:-$CIRCLE_TAG} || true
|
||||
git pull || true
|
||||
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
|
||||
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
export OMR_TARGET="wrt3200acm"
|
||||
pyenv global 3.5.2
|
||||
sh build.sh prepare {tools,toolchain}/install -j2
|
||||
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/wrt3200acm/source/key-build
|
||||
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/wrt3200acm/source/key-build.pub
|
||||
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "/tmp/cache-target" }}
|
||||
paths:
|
||||
- openmptcprouter
|
||||
|
||||
- run:
|
||||
name: Build wrt3200acm
|
||||
no_output_timeout: 40m
|
||||
command: make IGNORE_ERRORS=m -C ~/openmptcprouter/wrt3200acm/source package/{compile,install,index} target/compile -j2 package/compile -j2 target/install -j2
|
||||
|
||||
- run:
|
||||
name: Deploy wrt3200acm
|
||||
command: |
|
||||
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
|
||||
rsync -av --delete-after ~/openmptcprouter/wrt3200acm/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/wrt3200acm
|
||||
rm -rf ~/openmptcprouter/wrt3200acm/source/bin
|
||||
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "/tmp/cache-version" }}
|
||||
paths:
|
||||
- openmptcprouter
|
||||
|
||||
- run:
|
||||
name: Build toolchain wrt32x
|
||||
no_output_timeout: 40m
|
||||
command: |
|
||||
cd ~/openmptcprouter/
|
||||
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
|
||||
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
|
||||
export OMR_TARGET="wrt32x"
|
||||
ln -s wrt3200acm wrt32x
|
||||
pyenv global 3.5.2
|
||||
sh build.sh prepare {tools,toolchain}/install -j2
|
||||
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/wrt32x/source/key-build
|
||||
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/wrt32x/source/key-build.pub
|
||||
|
||||
- run:
|
||||
name: Build wrt32x
|
||||
no_output_timeout: 40m
|
||||
command: make IGNORE_ERRORS=m -C ~/openmptcprouter/wrt32x/source package/{compile,install,index} target/compile -j2 package/compile -j2 target/install -j2
|
||||
|
||||
- run:
|
||||
name: Deploy wrt32x
|
||||
command: |
|
||||
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
|
||||
rsync -av --delete-after ~/openmptcprouter/wrt32x/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/wrt32x
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
main:
|
||||
jobs:
|
||||
- prepare:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
branches:
|
||||
only:
|
||||
- develop
|
||||
- build_x86_64:
|
||||
requires:
|
||||
- prepare
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
branches:
|
||||
only:
|
||||
- develop
|
||||
- build_x86:
|
||||
requires:
|
||||
- prepare
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
branches:
|
||||
only:
|
||||
- develop
|
||||
- build_rpi4:
|
||||
requires:
|
||||
- prepare
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
branches:
|
||||
only:
|
||||
- develop
|
||||
- build_rpi3:
|
||||
requires:
|
||||
- prepare
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
branches:
|
||||
only:
|
||||
- develop
|
||||
- build_espressobin:
|
||||
requires:
|
||||
- prepare
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
branches:
|
||||
only:
|
||||
- develop
|
||||
- build_r2s:
|
||||
requires:
|
||||
- prepare
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
branches:
|
||||
only:
|
||||
- develop
|
||||
- build_rpi2:
|
||||
requires:
|
||||
- prepare
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
branches:
|
||||
only:
|
||||
- develop
|
||||
- build_bpi-r2:
|
||||
requires:
|
||||
- prepare
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
branches:
|
||||
only:
|
||||
- develop
|
||||
- build_wrt32:
|
||||
requires:
|
||||
- prepare
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
branches:
|
||||
only:
|
||||
- develop
|
7
.github/workflows/main.yml
vendored
|
@ -1,4 +1,4 @@
|
|||
name: Build antrouter
|
||||
name: openmptcprouter
|
||||
on: [push]
|
||||
|
||||
env:
|
||||
|
@ -129,7 +129,7 @@ jobs:
|
|||
TARGET: /www/wwwroot/55860.com/bak/down/release/${{steps.branch_name.outputs.SOURCE_TAG}}/${{matrix.OMR_TARGET}}
|
||||
SOURCE: ./bin/
|
||||
KEY: ${{ secrets.PRIVATE_KEY }}
|
||||
user: root
|
||||
USER: root
|
||||
HOST: ${{ secrets.OMR_DEPLOY_HOST }}
|
||||
PORT: ${{ secrets.OMR_DEPLOY_PORT }}
|
||||
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
|
||||
|
@ -144,11 +144,10 @@ jobs:
|
|||
TARGET: /www/wwwroot/55860.com/bak/down/${{ steps.branch_name.outputs.SOURCE_BRANCH }}/${{env.OMR_KERNEL}}/${{matrix.OMR_TARGET}}
|
||||
SOURCE: ./bin/
|
||||
KEY: ${{ secrets.PRIVATE_KEY }}
|
||||
user: root
|
||||
USER: root
|
||||
HOST: ${{ secrets.OMR_DEPLOY_HOST }}
|
||||
PORT: ${{ secrets.OMR_DEPLOY_PORT }}
|
||||
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
|
||||
SOURCE_BRANCH: ${{ steps.branch_name.outputs.SOURCE_BRANCH }}
|
||||
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
|
||||
GITHUB_WORKSPACE: ${{ steps.branch_name.outputs.WORKSPACE }}
|
||||
|
||||
|
|
20
README.md
|
@ -3,7 +3,7 @@
|
|||
|
||||
This is the OpenWrt OpenMPTCProuter feed containing all modified and necessary packages to build the OpenMPTCProuter image.
|
||||
|
||||
For More information, see [https://github.com/ysurac/openmptcprouter](https://github.com/ysurac/openmptcprouter) and [https://www.openmptcprouter.com](https://www.openmptcprouter.com/).
|
||||
For More information, see [https://github.com/suyuan168/3grouter](https://github.com/suyuan168/3grouter) and [https://www.openmptcprouter.com](https://www.openmptcprouter.com/).
|
||||
|
||||
|
||||
## Glorytun
|
||||
|
@ -66,7 +66,7 @@ Added support to gateway set by user for 6in4. Used for IPv6 over the glorytun I
|
|||
|
||||
|
||||
## luci-omr-bypass
|
||||
*Source:* [https://github.com/Ysurac/openmptcprouter-feeds/tree/master/luci-app-omr-bypass](https://github.com/Ysurac/openmptcprouter-feeds/tree/master/luci-app-omr-bypass)
|
||||
*Source:* [https://github.com/suyuan168/3grouter-feeds/tree/master/luci-app-omr-bypass](https://github.com/suyuan168/3grouter-feeds/tree/master/luci-app-omr-bypass)
|
||||
|
||||
*Description:* Luci interface to bypass domains, IPs and networks with shadowsocks
|
||||
|
||||
|
@ -74,7 +74,7 @@ Domains, IPs, networks and protocol (using DPI) added are bypassed when shadowso
|
|||
|
||||
|
||||
## omr-tracker
|
||||
*Source:* [https://github.com/Ysurac/openmptcprouter-feeds/tree/master/omr-tracker](https://github.com/Ysurac/openmptcprouter-feeds/tree/master/omr-tracker)
|
||||
*Source:* [https://github.com/suyuan168/3grouter-feeds/tree/master/omr-tracker](https://github.com/suyuan168/3grouter-feeds/tree/master/omr-tracker)
|
||||
|
||||
*Description:* Track connection status. This check if gateway is up then check if the connection work. If it's not working this execute scripts. This also detect if ShadowSocks is up or not.
|
||||
|
||||
|
@ -82,7 +82,7 @@ This is used for OpenMPTCProuter failover.
|
|||
|
||||
|
||||
## luci-omr-tracker
|
||||
*Source:* [https://github.com/Ysurac/openmptcprouter-feeds/tree/master/luci-app-omr-tracker](https://github.com/Ysurac/openmptcprouter-feeds/tree/master/luci-app-omr-tracker)
|
||||
*Source:* [https://github.com/suyuan168/3grouter-feeds/tree/master/luci-app-omr-tracker](https://github.com/suyuan168/3grouter-feeds/tree/master/luci-app-omr-tracker)
|
||||
|
||||
*Description:* Luci interface to omr-tracker
|
||||
|
||||
|
@ -90,37 +90,37 @@ Interface to omr-tracker.
|
|||
|
||||
|
||||
## luci-app-iperf
|
||||
*Source:* [https://github.com/Ysurac/openmptcprouter-feeds/tree/master/luci-app-iperf](https://github.com/Ysurac/openmptcprouter-feeds/tree/master/luci-app-iperf)
|
||||
*Source:* [https://github.com/suyuan168/3grouter-feeds/tree/master/luci-app-iperf](https://github.com/suyuan168/3grouter-feeds/tree/master/luci-app-iperf)
|
||||
|
||||
*Description:* Luci interface to iPerf
|
||||
|
||||
|
||||
## omr-6in4
|
||||
*Source:* [https://github.com/Ysurac/openmptcprouter-feeds/tree/master/omr-6in4](https://github.com/Ysurac/openmptcprouter-feeds/tree/master/omr-6in4)
|
||||
*Source:* [https://github.com/suyuan168/3grouter-feeds/tree/master/omr-6in4](https://github.com/suyuan168/3grouter-feeds/tree/master/omr-6in4)
|
||||
|
||||
*Description:* Set tunnel configuration by tracking tunnel configuration.
|
||||
|
||||
|
||||
## omr-update
|
||||
*Source:* [https://github.com/Ysurac/openmptcprouter-feeds/tree/master/omr-update](https://github.com/Ysurac/openmptcprouter-feeds/tree/master/omr-update)
|
||||
*Source:* [https://github.com/suyuan168/3grouter-feeds/tree/master/omr-update](https://github.com/suyuan168/3grouter-feeds/tree/master/omr-update)
|
||||
|
||||
*Description:* Update old config with new settings.
|
||||
|
||||
|
||||
## luci-app-mptcp
|
||||
*Source:* [https://github.com/Ysurac/openmptcprouter-feeds/tree/master/luci-app-mptcp](https://github.com/Ysurac/openmptcprouter-feeds/tree/master/luci-app-mptcp)
|
||||
*Source:* [https://github.com/suyuan168/3grouter-feeds/tree/master/luci-app-mptcp](https://github.com/suyuan168/3grouter-feeds/tree/master/luci-app-mptcp)
|
||||
|
||||
*Description:* Luci interface for all MPTCP settings
|
||||
|
||||
|
||||
## luci-app-openmptcprouter
|
||||
*Source:* [https://github.com/Ysurac/openmptcprouter-feeds/tree/master/luci-app-openmptcprouter](https://github.com/Ysurac/openmptcprouter-feeds/tree/master/luci-app-openmptcprouter)
|
||||
*Source:* [https://github.com/suyuan168/3grouter-feeds/tree/master/luci-app-openmptcprouter](https://github.com/suyuan168/3grouter-feeds/tree/master/luci-app-openmptcprouter)
|
||||
|
||||
*Description:* Wizard for OpenMPTCProuter settings and status page
|
||||
|
||||
|
||||
## mptcp
|
||||
*Source:* [https://github.com/Ysurac/openmptcprouter-feeds/tree/master/mptcp](https://github.com/Ysurac/openmptcprouter-feeds/tree/master/mptcp)
|
||||
*Source:* [https://github.com/suyuan168/3grouter-feeds/tree/master/mptcp](https://github.com/suyuan168/3grouter-feeds/tree/master/mptcp)
|
||||
|
||||
*Description:* This package set all MPTCP settings
|
||||
|
||||
|
|
|
@ -49,7 +49,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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -59,7 +59,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 network
|
||||
fi
|
||||
_log "starting ${PROG_NAME} ${1} instance $*"
|
||||
|
|
|
@ -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 ''
|
||||
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 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_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
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
/etc/init.d/"$1" version 2>&1 | grep "$2"
|
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:=1
|
||||
|
||||
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))
|
24
iperf3/patches/remove-in6_flowlabel_req.patch
Normal file
|
@ -0,0 +1,24 @@
|
|||
--- 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,6 @@
|
||||
conflicts with "netinet/in.h" .
|
||||
*/
|
||||
|
||||
-#ifndef __ANDROID__
|
||||
-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,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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -62,9 +62,12 @@ function multipath_bandwidth()
|
|||
local intname = s[".name"]
|
||||
local label = s["label"]
|
||||
local dev = get_device(intname)
|
||||
if dev == "" then
|
||||
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
|
||||
if multipath == "" then
|
||||
|
|
|
@ -501,9 +501,9 @@ _intf_rule_v2ray_rules() {
|
|||
|
||||
_intf_rule() {
|
||||
local intf
|
||||
config_get intf $1 ifname
|
||||
[ -z "$intf" ] && intf=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
|
||||
intf=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -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
|
||||
|
|
|
@ -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
|
||||
|
@ -113,7 +117,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 +133,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
|
||||
|
@ -197,7 +216,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")
|
||||
|
@ -262,9 +284,14 @@ 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)
|
||||
elseif typeintf == "" and device ~= "" and proto == "ncm" then
|
||||
ucic:set("network",intf,"device",device_ncm)
|
||||
elseif typeintf == "" and device ~= "" and proto == "qmi" then
|
||||
|
@ -341,9 +368,12 @@ function wizard_add()
|
|||
|
||||
if not ucic:get("sqm",intf) ~= "" then
|
||||
local defif = get_device(intf)
|
||||
if defif == "" then
|
||||
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)
|
||||
ucic:set("sqm",intf,"qdisc","fq_codel")
|
||||
|
@ -442,7 +472,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")
|
||||
|
@ -894,7 +924,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
|
||||
|
|
|
@ -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 ifname "$1" ifname
|
||||
config_get device "$1" device
|
||||
config_get type "$1" type
|
||||
|
||||
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,7 +61,10 @@ omr_set_settings() {
|
|||
local ifname
|
||||
local multipath
|
||||
config_get multipath "$1" multipath
|
||||
config_get ifname "$1" ifname
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
@ -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("^@.*")) 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
|
||||
|
|
0
luci-app-status/Makefile
Executable file → Normal file
0
luci-app-status/htdocs/luci-static/resources/status/css/wanstatus.css
Executable file → Normal file
0
luci-app-status/htdocs/luci-static/resources/status/images/status-doing.png
Executable file → Normal file
Before Width: | Height: | Size: 536 B After Width: | Height: | Size: 536 B |
0
luci-app-status/htdocs/luci-static/resources/status/images/status-done.png
Executable file → Normal file
Before Width: | Height: | Size: 607 B After Width: | Height: | Size: 607 B |
0
luci-app-status/htdocs/luci-static/resources/status/images/status-error.png
Executable file → Normal file
Before Width: | Height: | Size: 575 B After Width: | Height: | Size: 575 B |
0
luci-app-status/htdocs/luci-static/resources/status/images/status-todo.png
Executable file → Normal file
Before Width: | Height: | Size: 536 B After Width: | Height: | Size: 536 B |
0
luci-app-status/htdocs/luci-static/resources/status/images/status-warn.png
Executable file → Normal file
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 544 B |
0
luci-app-status/htdocs/luci-static/resources/status/images/statusError.png
Executable file → Normal file
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
0
luci-app-status/htdocs/luci-static/resources/status/images/statusOK.png
Executable file → Normal file
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
0
luci-app-status/htdocs/luci-static/resources/status/images/statusWarning.png
Executable file → Normal file
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
3
luci-app-status/luasrc/controller/status.lua
Executable file → Normal file
|
@ -294,9 +294,12 @@ function multipath_bandwidth()
|
|||
local intname = s[".name"]
|
||||
local label = s["label"]
|
||||
local dev = get_device(intname)
|
||||
if dev == "" then
|
||||
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
|
||||
if multipath == "" then
|
||||
|
|
0
luci-app-status/luasrc/view/status/server.htm
Executable file → Normal file
0
luci-app-status/luasrc/view/status/wanstatus.htm
Executable file → Normal file
0
luci-app-status/po/templates/status.pot
Executable file → Normal file
0
luci-app-status/po/zh_Hans/status.po
Executable file → Normal file
0
luci-app-status/root/usr/share/luci/menu.d/luci-app-status.json
Executable file → Normal file
0
luci-app-status/root/usr/share/rpcd/acl.d/luci-app-status.json
Executable file → Normal file
|
@ -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: boardinfo.release.description
|
||||
value: (typeof boardinfo.release.description !== "undefined") ? boardinfo.release.description : 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
|
||||
|
||||
|
|
913
luci-mod-network/htdocs/luci-static/resources/tools/network.js
Normal file
|
@ -0,0 +1,913 @@
|
|||
'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, '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 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();
|
||||
|
|
|
@ -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 (hwval != null) {
|
||||
this.useBandOption = false;
|
||||
|
||||
if (/a/.test(hwval))
|
||||
band.value = '11a';
|
||||
band.value = '5g';
|
||||
else
|
||||
band.value = '11g';
|
||||
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())
|
||||
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,8 +1675,7 @@ 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 = 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'));
|
||||
|
@ -1635,7 +1700,6 @@ return view.extend({
|
|||
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" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,7 +25,7 @@ _save_macaddr() {
|
|||
}
|
||||
[ -z "$(uci -q get network.$1.macaddr)" ] && {
|
||||
_ifname=$(uci -q get "network.$1.ifname")
|
||||
[ -n "$_ifname" ] && {
|
||||
[ -n "$_ifname" ] && [ -z "$(echo $_ifname | grep '\.')" ] && {
|
||||
_macaddr=$(ip link show dev $_ifname 2>/dev/null | grep link | awk '{print $2}')
|
||||
[ -n "$_macaddr" ] && {
|
||||
uci -q set network.$1.macaddr=$_macaddr
|
||||
|
|
|
@ -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
|
||||
|
@ -46,7 +47,7 @@ start() {
|
|||
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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -47,7 +47,7 @@ interface_macaddr_count() {
|
|||
local intf="$1"
|
||||
local dmacaddr="$2"
|
||||
config_get macaddr "$intf" macaddr
|
||||
[ "$macaddr" = "$dmacaddr" ] && nbmac=$((nbmac+1))
|
||||
[ "$macaddr" = "$dmacaddr" ] && [ -z "$(echo $intf | grep '\.')" ] && nbmac=$((nbmac+1))
|
||||
}
|
||||
|
||||
interface_max_metric() {
|
||||
|
@ -85,7 +85,10 @@ interface_multipath_settings() {
|
|||
local enabled
|
||||
|
||||
config_get enabled "$config" auto "1"
|
||||
config_get iface "$config" ifname
|
||||
network_get_device iface $config
|
||||
[ -z "$iface" ] && network_get_physdev iface $config
|
||||
[ -z "$iface" ] && config_get iface "$config" device
|
||||
[ -z "$iface" ] && config_get iface "$config" ifname
|
||||
config_get txqueuelen "$config" txqueuelen
|
||||
[ -z "$iface" ] && iface=$(ifstatus "$config" | jsonfilter -q -e '@["l3_device"]')
|
||||
[ -n "$(echo $iface | grep '@')" ] && iface=$(ifstatus "$config" | jsonfilter -q -e '@["device"]')
|
||||
|
@ -349,7 +352,10 @@ interface_multipath_settings() {
|
|||
}
|
||||
|
||||
load_interfaces() {
|
||||
config_get ifname "$1" ifname
|
||||
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)"
|
||||
[ "$multipath" != "off" ] && [ "$multipath" != "" ] && interfaces=" ${ifname} ${interfaces}"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
SETROUTE=false
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
||||
set_route() {
|
||||
local multipath_config_route interface_gw interface_if
|
||||
INTERFACE=$1
|
||||
|
@ -12,9 +14,11 @@ set_route() {
|
|||
[ "$(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")
|
||||
|
@ -49,9 +53,11 @@ set_route6() {
|
|||
[ "$(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")
|
||||
|
@ -163,8 +169,10 @@ set_routes_intf() {
|
|||
[ "$(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"]')
|
||||
|
@ -217,8 +225,10 @@ set_routes_intf6() {
|
|||
[ "$(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"]')
|
||||
|
@ -287,8 +297,10 @@ set_route_balancing() {
|
|||
[ "$(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"]')
|
||||
|
@ -335,8 +347,10 @@ set_route_balancing6() {
|
|||
[ "$(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"]')
|
||||
|
@ -398,10 +412,12 @@ set_server_all_routes() {
|
|||
[ -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')
|
||||
|
@ -443,10 +459,12 @@ set_server_all_routes6() {
|
|||
[ -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" ] && {
|
||||
|
@ -497,10 +515,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")
|
||||
|
@ -532,10 +552,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")
|
||||
|
@ -650,7 +672,7 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ] || [ "$interface_up" != "true" ]; then
|
|||
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
|
||||
|
@ -895,7 +917,8 @@ 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")
|
||||
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_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
|
||||
|
@ -908,7 +931,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,7 +947,8 @@ 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")
|
||||
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)" = "" ]; then
|
||||
routesbalancing=""
|
||||
routesbalancingbackup=""
|
||||
|
@ -1395,6 +1420,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
|
||||
|
@ -1470,5 +1501,6 @@ if [ "$(pgrep openmptcprouter-vps)" = "" ] && ([ "$(uci -q show openmptcprouter
|
|||
#/etc/init.d/v2ray rules_up >/dev/null 2>&1
|
||||
#/etc/init.d/omr-bypass reload_rules >/dev/null 2>&1
|
||||
#sh /etc/firewall.gre-tunnel >/dev/null 2>&1
|
||||
/bin/blocklanfw >/dev/null 2>&1
|
||||
sleep 5
|
||||
fi
|
|
@ -8,13 +8,15 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mptcpd
|
||||
PKG_VERSION:=0.4
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/intel/mptcpd/releases/download/v$(PKG_VERSION)
|
||||
PKG_HASH:=459c45ba86ea574f1ad7a062a9914474ca650229b97375017bd46d0732f985ba
|
||||
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
|
@ -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>
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -69,6 +72,9 @@ _launch_tracker() {
|
|||
[ "${ifenabled}" = "0" ] && return
|
||||
[ "${enabled}" = "0" ] && return
|
||||
[ -z "${hosts}" ] && [ "$type" != "none" ] && return
|
||||
ifstatus=$(ifstatus "$1" | jsonfilter -q -e '@["up"]')
|
||||
ifdevice=$(ifstatus "$1" | jsonfilter -q -e '@["device"]')
|
||||
[ "${ifstatus}" = "false" ] && [ -z "${ifdevice}" ] && return
|
||||
[ -z "${interval_tries}" ] && interval_tries=1
|
||||
|
||||
procd_open_instance
|
||||
|
|
|
@ -44,7 +44,6 @@ MY_DEPENDS := \
|
|||
luci-app-uhttpd \
|
||||
luci-mod-rpc rpcd-mod-rpcsys rpcd-mod-file rpcd-mod-iwinfo \
|
||||
luci-app-openvpn \
|
||||
macvlan \
|
||||
shadowsocks-libev-ss-server shadowsocks-libev-ss-tunnel \
|
||||
omr-6in4 ip6tables-mod-nat luci-proto-ipv6 6to4 6in4 6rd ip6tables \
|
||||
speedtestc \
|
||||
|
|
|
@ -5,13 +5,15 @@ ss_rules_fw_drop() {
|
|||
fwrule=$(echo "$c" | sed 's/reject/REDIRECT --to-ports 65535/')
|
||||
if [ -n "$fwrule" ] && [ -z "$(iptables-save | grep zone_lan_prerouting | grep '${fwrule}')" ]; then
|
||||
eval "iptables -w -t nat -A zone_lan_prerouting ${fwrule} 2>&1 >/dev/null"
|
||||
fw=$((fw+1))
|
||||
fi
|
||||
done
|
||||
fw3 -4 print 2>/dev/null | awk '/iptables/&&/zone_lan_forward/&&/tcp/&&/-t filter/&&/-j drop/ {for(i=6; i<=NF; i++) { printf "%s ",$i } print "\n" }' |
|
||||
fw3 -4 print 2>/dev/null | awk '/iptables/&&/zone_lan_forward/&&/tcp/&&/-t filter/&&/-j DROP/ {for(i=6; i<=NF; i++) { printf "%s ",$i } print "\n" }' |
|
||||
while IFS=$"\n" read -r c; do
|
||||
fwrule=$(echo "$c" | sed 's/drop/REDIRECT --to-ports 65535/')
|
||||
fwrule=$(echo "$c" | sed 's/DROP/REDIRECT --to-ports 65535/')
|
||||
if [ -n "$fwrule" ] && [ -z "$(iptables-save | grep zone_lan_prerouting | grep '${fwrule}')" ]; then
|
||||
eval "iptables -t nat -A zone_lan_prerouting ${fwrule} 2>&1 >/dev/null"
|
||||
fw=$((fw+1))
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -22,13 +24,15 @@ ss_rules6_fw_drop() {
|
|||
fwrule=$(echo "$c" | sed 's/reject/REDIRECT --to-ports 65535/')
|
||||
if [ -n "$fwrule" ] && [ -z "$(iptables-save | grep zone_lan_prerouting | grep '${fwrule}')" ]; then
|
||||
eval "ip6tables -w -t nat -A zone_lan_prerouting ${fwrule} 2>&1 >/dev/null"
|
||||
fw=$((fw+1))
|
||||
fi
|
||||
done
|
||||
fw3 -6 print 2>/dev/null | awk '/iptables/&&/zone_lan_forward/&&/tcp/&&/-t filter/&&/-j drop/ {for(i=6; i<=NF; i++) { printf "%s ",$i } print "\n" }' |
|
||||
fw3 -6 print 2>/dev/null | awk '/iptables/&&/zone_lan_forward/&&/tcp/&&/-t filter/&&/-j DROP/ {for(i=6; i<=NF; i++) { printf "%s ",$i } print "\n" }' |
|
||||
while IFS=$"\n" read -r c; do
|
||||
fwrule=$(echo "$c" | sed 's/drop/REDIRECT --to-ports 65535/')
|
||||
fwrule=$(echo "$c" | sed 's/DROP/REDIRECT --to-ports 65535/')
|
||||
if [ -n "$fwrule" ] && [ -z "$(iptables-save | grep zone_lan_prerouting | grep '${fwrule}')" ]; then
|
||||
eval "ip6tables -t nat -A zone_lan_prerouting ${fwrule} 2>&1 >/dev/null"
|
||||
fw=$((fw+1))
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -38,14 +42,16 @@ v2r_rules_fw_drop() {
|
|||
while IFS=$"\n" read -r c; do
|
||||
fwrule=$(echo "$c" | sed 's/reject/REDIRECT --to-ports 65535/')
|
||||
if [ -n "$fwrule" ] && [ -z "$(iptables-save | grep zone_lan_prerouting | grep '${fwrule}')" ]; then
|
||||
eval "iptables -w -t nat -A zone_lan_prerouting ${fwrule} 2>&1 >/dev/null"
|
||||
eval "iptables -w -t nat -I zone_lan_prerouting 1 ${fwrule} 2>&1 >/dev/null"
|
||||
fw=$((fw+1))
|
||||
fi
|
||||
done
|
||||
fw3 -4 print 2>/dev/null | awk '/iptables/&&/zone_lan_forward/&&/tcp/&&/-t filter/&&/-j drop/ {for(i=6; i<=NF; i++) { printf "%s ",$i } print "\n" }' |
|
||||
fw3 -4 print 2>/dev/null | awk '/iptables/&&/zone_lan_forward/&&/tcp/&&/-t filter/&&/-j DROP/ {for(i=6; i<=NF; i++) { printf "%s ",$i } print "\n" }' |
|
||||
while IFS=$"\n" read -r c; do
|
||||
fwrule=$(echo "$c" | sed 's/drop/REDIRECT --to-ports 65535/')
|
||||
fwrule=$(echo "$c" | sed 's/DROP/REDIRECT --to-ports 65535/')
|
||||
if [ -n "$fwrule" ] && [ -z "$(iptables-save | grep zone_lan_prerouting | grep '${fwrule}')" ]; then
|
||||
eval "iptables -t nat -A zone_lan_prerouting ${fwrule} 2>&1 >/dev/null"
|
||||
eval "iptables -t nat -I zone_lan_prerouting 1 ${fwrule} 2>&1 >/dev/null"
|
||||
fw=$((fw+1))
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -55,18 +61,19 @@ v2ray_rules6_fw_drop() {
|
|||
while IFS=$"\n" read -r c; do
|
||||
fwrule=$(echo "$c" | sed 's/reject/REDIRECT --to-ports 65535/')
|
||||
if [ -n "$fwrule" ] && [ -z "$(iptables-save | grep zone_lan_prerouting | grep '${fwrule}')" ]; then
|
||||
eval "ip6tables -w -t nat -A zone_lan_prerouting ${fwrule} 2>&1 >/dev/null"
|
||||
eval "ip6tables -w -t nat -I zone_lan_prerouting 1 ${fwrule} 2>&1 >/dev/null"
|
||||
fi
|
||||
done
|
||||
fw3 -6 print 2>/dev/null | awk '/iptables/&&/zone_lan_forward/&&/tcp/&&/-t filter/&&/-j drop/ {for(i=6; i<=NF; i++) { printf "%s ",$i } print "\n" }' |
|
||||
fw3 -6 print 2>/dev/null | awk '/iptables/&&/zone_lan_forward/&&/tcp/&&/-t filter/&&/-j DROP/ {for(i=6; i<=NF; i++) { printf "%s ",$i } print "\n" }' |
|
||||
while IFS=$"\n" read -r c; do
|
||||
fwrule=$(echo "$c" | sed 's/drop/REDIRECT --to-ports 65535/')
|
||||
fwrule=$(echo "$c" | sed 's/DROP/REDIRECT --to-ports 65535/')
|
||||
if [ -n "$fwrule" ] && [ -z "$(iptables-save | grep zone_lan_prerouting | grep '${fwrule}')" ]; then
|
||||
eval "ip6tables -t nat -A zone_lan_prerouting ${fwrule} 2>&1 >/dev/null"
|
||||
eval "ip6tables -t nat -I zone_lan_prerouting 1 ${fwrule} 2>&1 >/dev/null"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
fw=0
|
||||
if [ "$(uci -q get openmptcprouter.settings.proxy)" = "shadowsocks" ]; then
|
||||
ss_rules6_fw_drop
|
||||
ss_rules_fw_drop
|
||||
|
@ -74,3 +81,7 @@ elif [ "$(uci -q get openmptcprouter.settings.proxy)" = "v2ray" ]; then
|
|||
v2r_rules_fw_drop
|
||||
v2ray_rules6_fw_drop
|
||||
fi
|
||||
rule=$(fw3 -4 print | grep 'A PREROUTING' | grep zone_lan_prerouting | sed 's/-A PREROUTING/-D PREROUTING/')
|
||||
eval "$rule 2>&1 >/dev/null"
|
||||
newrule=$(echo "$rule" | sed 's/-D PREROUTING/-I PREROUTING 1/')
|
||||
eval "$newrule 2>&1 >/dev/null"
|
||||
|
|
|
@ -13,3 +13,4 @@ config_load openmptcprouter
|
|||
config_foreach _enable_firewall_check server
|
||||
uci -q commit firewall
|
||||
#/etc/init.d/openmptcprouter-vps set_vps_firewall &
|
||||
/bin/blocklanfw 2>&1 >/dev/null
|
||||
|
|
|
@ -68,7 +68,7 @@ mptcp_over_vpn() {
|
|||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set network.ovpn${interface}=interface
|
||||
set network.ovpn${interface}.ifname="tun${id}"
|
||||
set network.ovpn${interface}.device="tun${id}"
|
||||
set network.ovpn${interface}.defaultroute='0'
|
||||
set network.ovpn${interface}.peerdns='0'
|
||||
set network.ovpn${interface}.proto='none'
|
||||
|
|
|
@ -539,7 +539,7 @@ _get_gre_tunnel() {
|
|||
set network.oip${i}.label="Tunnel for $publicaddr"
|
||||
set network.oip${i}.proto=static
|
||||
set network.oip${i}.nohostroute='1'
|
||||
set network.oip${i}.ifname="@oip${i}gre"
|
||||
set network.oip${i}.device="@oip${i}gre"
|
||||
set network.oip${i}.ipv6='0'
|
||||
set network.oip${i}.defaultroute='0'
|
||||
set network.oip${i}.multipath='off'
|
||||
|
@ -823,7 +823,7 @@ _set_vpn_ip() {
|
|||
local settings
|
||||
[ -z "$vps_config" ] && vps_config=$(_get_json "config")
|
||||
[ -z "$vps_config" ] && return
|
||||
vpnifname="$(uci -q get network.omrvpn.ifname)"
|
||||
vpnifname="$(uci -q get network.omrvpn.device)"
|
||||
vpnip_local_current="$(echo "$vps_config" | jsonfilter -q -e '@.vpn.remoteip')"
|
||||
vpnip_local=$(ip -4 -br addr ls dev ${vpnifname} | awk -F'[ /]+' '{print $3}')
|
||||
vpnip_remote_current="$(echo "$vps_config" | jsonfilter -q -e '@.vpn.localip')"
|
||||
|
@ -850,7 +850,7 @@ _set_client2client() {
|
|||
[ -z "$vps_config" ] && vps_config=$(_get_json "config")
|
||||
[ -z "$vps_config" ] && return
|
||||
c2cips="$(echo "$vps_config" | jsonfilter -q -e '@.client2client.lanips[0]')"
|
||||
vpnifname="$(uci -q get network.omrvpn.ifname)"
|
||||
vpnifname="$(uci -q get network.omrvpn.device)"
|
||||
vpnip_local=$(ip -4 -br addr ls dev ${vpnifname} | awk -F'[ /]+' '{print $3}' | tr -d "\n")
|
||||
vpnip_remote=$(ip -4 r list dev ${vpnifname} | grep via | grep -v default | grep -v / | grep -v metric | awk '{print $1}' | tr -d "\n")
|
||||
for lanip in $c2cips; do
|
||||
|
@ -909,7 +909,7 @@ _vps_firewall_redirect_port() {
|
|||
if [ "$v2ray" = "0" ]; then
|
||||
checkfw=""
|
||||
if [ "$family" = "ipv4" ]; then
|
||||
if [ "$src_dip" = "" ]; then
|
||||
if [ "$src_dip" = "" ] && [ "$src_ip" = "" ]; then
|
||||
checkfw=$(echo "$vpsfwlist" | grep "$src_dport # OMR $username redirect router $src_dport port $protoi")
|
||||
else
|
||||
comment=""
|
||||
|
@ -921,7 +921,7 @@ _vps_firewall_redirect_port() {
|
|||
checkfw=$(echo "$vpsfwlist" | grep "# OMR $username redirect router $src_dport port $protoi${comment}")
|
||||
fi
|
||||
else
|
||||
if [ "$src_dip" = "" ]; then
|
||||
if [ "$src_dip" = "" ] && [ "$src_ip" = "" ]; then
|
||||
checkfw=$(echo "$vpsfw6list" | grep "$src_dport # OMR $username redirect router $src_dport port $protoi")
|
||||
else
|
||||
comment=""
|
||||
|
@ -935,7 +935,7 @@ _vps_firewall_redirect_port() {
|
|||
_set_json "shorewallopen" "$settings"
|
||||
fi
|
||||
if [ "$family" = "ipv4" ]; then
|
||||
if [ "$src_dip" = "" ]; then
|
||||
if [ "$src_dip" = "" ] && [ "$src_ip" = "" ]; then
|
||||
vpsfwlist=$(echo "$vpsfwlist" | grep -v "$src_dport # OMR $username redirect router $src_dport port $protoi")
|
||||
[ "$username" = "openmptcprouter" ] && vpsfwlist=$(echo "$vpsfwlist" | grep -v "$src_dport # OMR redirect router $src_dport port $protoi")
|
||||
else
|
||||
|
@ -946,7 +946,7 @@ _vps_firewall_redirect_port() {
|
|||
[ "$username" = "openmptcprouter" ] && vpsfwlist=$(echo "$vpsfwlist" | grep -v "# OMR redirect router $src_dport port $protoi${comment}")
|
||||
fi
|
||||
else
|
||||
if [ "$src_dip" = "" ]; then
|
||||
if [ "$src_dip" = "" ] && [ "$src_ip" = "" ]; then
|
||||
vpsfw6list=$(echo "$vpsfw6list" | grep -v "$src_dport # OMR $username redirect router $src_dport port $protoi")
|
||||
[ "$username" = "openmptcprouter" ] && vpsfw6list=$(echo "$vpsfw6list" | grep -v "$src_dport # OMR redirect router $src_dport port $protoi")
|
||||
else
|
||||
|
@ -959,7 +959,7 @@ _vps_firewall_redirect_port() {
|
|||
else
|
||||
checkfw=""
|
||||
if [ "$family" = "ipv4" ]; then
|
||||
if [ "$src_dip" = "" ]; then
|
||||
if [ "$src_dip" = "" ] && [ "$src_ip" = "" ]; then
|
||||
checkfw=$(echo "$vpsfwlist" | grep "$src_dport # OMR $username open router $src_dport port $protoi")
|
||||
else
|
||||
comment=""
|
||||
|
@ -971,7 +971,7 @@ _vps_firewall_redirect_port() {
|
|||
checkfw=$(echo "$vpsfwlist" | grep "# OMR $username open router $src_dport port $protoi${comment}")
|
||||
fi
|
||||
else
|
||||
if [ "$src_dip" = "" ]; then
|
||||
if [ "$src_dip" = "" ] && [ "$src_ip" = "" ]; then
|
||||
checkfw=$(echo "$vpsfw6list" | grep "$src_dport # OMR $username open router $src_dport port $protoi")
|
||||
else
|
||||
comment=""
|
||||
|
@ -987,7 +987,7 @@ _vps_firewall_redirect_port() {
|
|||
_set_json "v2rayredirect" "$settings"
|
||||
fi
|
||||
if [ "$family" = "ipv4" ]; then
|
||||
if [ "$src_dip" = "" ]; then
|
||||
if [ "$src_dip" = "" ] && [ "$src_ip" = "" ]; then
|
||||
vpsfwlist=$(echo "$vpsfwlist" | grep -v "$src_dport # OMR $username open router $src_dport port $protoi")
|
||||
[ "$username" = "openmptcprouter" ] && vpsfwlist=$(echo "$vpsfwlist" | grep -v "$src_dport # OMR open router $src_dport port $protoi")
|
||||
else
|
||||
|
@ -998,7 +998,7 @@ _vps_firewall_redirect_port() {
|
|||
[ "$username" = "openmptcprouter" ] && vpsfwlist=$(echo "$vpsfwlist" | grep -v "# OMR open router $src_dport port $protoi${comment}")
|
||||
fi
|
||||
else
|
||||
if [ "$src_dip" = "" ]; then
|
||||
if [ "$src_dip" = "" ] && [ "$src_ip" = "" ]; then
|
||||
vpsfw6list=$(echo "$vpsfw6list" | grep -v "$src_dport # OMR $username open router $src_dport port $protoi")
|
||||
[ "$username" = "openmptcprouter" ] && vpsfw6list=$(echo "$vpsfw6list" | grep -v "$src_dport # OMR open router $src_dport port $protoi")
|
||||
else
|
||||
|
|
|
@ -77,7 +77,7 @@ start_service()
|
|||
set network.omrvpn.updelay='20'
|
||||
set network.omrvpn.use_carrier='1'
|
||||
set network.omrvpn.mtu='1440'
|
||||
set network.omrvpn.ifname= 'bonding-omrvpn'
|
||||
set network.omrvpn.device= 'bonding-omrvpn'
|
||||
set network.omrvpn.force_link='1'
|
||||
commit network
|
||||
EOF
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
#!/bin/sh
|
||||
if [ "$(uci -q get openmptcprouter.latest_versions)" = "" ]; then
|
||||
wanintf="$(uci -q get network.wan1.ifname)"
|
||||
wanintf="$(uci -q get network.wan1.device)"
|
||||
if [ "$(uci -q get vnstat.@vnstat[-1].interface | grep $wanintf)" = "" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete vnstat.@vnstat[-1]
|
||||
add vnstat vnstat
|
||||
set vnstat.@vnstat[-1].interface=$wanintf
|
||||
EOF
|
||||
wanintf="$(uci -q get network.wan2.ifname)"
|
||||
wanintf="$(uci -q get network.wan2.device)"
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
add_list vnstat.@vnstat[-1].interface=$wanintf
|
||||
EOF
|
||||
if [ "$(uci -q get network.wan3)" != "" ]; then
|
||||
wanintf="$(uci -q get network.wan3.ifname)"
|
||||
wanintf="$(uci -q get network.wan3.device)"
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
add_list vnstat.@vnstat[-1].interface=$wanintf
|
||||
EOF
|
||||
fi
|
||||
if [ "$(uci -q get network.wan4)" != "" ]; then
|
||||
wanintf="$(uci -q get network.wan4.ifname)"
|
||||
wanintf="$(uci -q get network.wan4.device)"
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
add_list vnstat.@vnstat[-1].interface=$wanintf
|
||||
EOF
|
||||
|
|
|
@ -45,7 +45,8 @@ if [ "$(uci -q get firewall.zone_vpn)" = "" ]; then
|
|||
uci -q batch <<-EOF >/dev/null
|
||||
set firewall.zone_vpn=zone
|
||||
set firewall.zone_vpn.name=vpn
|
||||
set firewall.zone_vpn.network=glorytun
|
||||
add_list firewall.zone_vpn.network=omrvpn
|
||||
add_list firewall.zone_vpn.network=omr6in4
|
||||
set firewall.zone_vpn.masq=1
|
||||
set firewall.zone_vpn.input=REJECT
|
||||
set firewall.zone_vpn.forward=ACCEPT
|
||||
|
@ -98,6 +99,7 @@ if [ "$(uci -q show firewall | grep Allow-Lan-to-Wan)" = "" ]; then
|
|||
set firewall.@rule[-1].name='Allow-Lan-to-Wan'
|
||||
set firewall.@rule[-1].dest='wan'
|
||||
set firewall.@rule[-1].src='lan'
|
||||
set firewall.@rule[-1].proto='all'
|
||||
commit firewall
|
||||
EOF
|
||||
fi
|
||||
|
|
|
@ -5,7 +5,7 @@ if [ "$(uci -q get network.omrvpn)" = "" ]; then
|
|||
delete network.glorytun
|
||||
delete network.omrvpn
|
||||
set network.omrvpn=interface
|
||||
set network.omrvpn.ifname=tun0
|
||||
set network.omrvpn.device=tun0
|
||||
set network.omrvpn.proto=dhcp
|
||||
set network.omrvpn.ip4table=vpn
|
||||
set network.omrvpn.multipath=off
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/sh
|
||||
if [ "$(uci -q get openmptcprouter.settings.version)" = "" ]; then
|
||||
if [ "$(uci -q get sqm.wan1)" = "" ]; then
|
||||
wan1="$(uci -q get network.wan1.ifname)"
|
||||
wan2="$(uci -q get network.wan2.ifname)"
|
||||
wan1="$(uci -q get network.wan1.device)"
|
||||
wan2="$(uci -q get network.wan2.device)"
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete sqm.eth1
|
||||
set sqm.wan1=queue
|
||||
|
@ -34,7 +34,7 @@ if [ "$(uci -q get openmptcprouter.settings.version)" = "" ]; then
|
|||
commit sqm
|
||||
EOF
|
||||
if [ "$(uci -q get network.wan3)" != "" ]; then
|
||||
wan3="$(uci -q get network.wan3.ifname)"
|
||||
wan3="$(uci -q get network.wan3.device)"
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set sqm.wan3=queue
|
||||
set sqm.wan3.qdisc="fq_codel"
|
||||
|
@ -53,7 +53,7 @@ if [ "$(uci -q get openmptcprouter.settings.version)" = "" ]; then
|
|||
EOF
|
||||
fi
|
||||
if [ "$(uci -q get network.wan4)" != "" ]; then
|
||||
wan4="$(uci -q get network.wan4.ifname)"
|
||||
wan4="$(uci -q get network.wan4.device)"
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set sqm.wan4=queue
|
||||
set sqm.wan4.qdisc="fq_codel"
|
||||
|
|
|
@ -57,7 +57,7 @@ define Package/shadowsocks-libev/Default
|
|||
SUBMENU:=Web Servers/Proxies
|
||||
TITLE:=shadowsocks-libev $(1)
|
||||
URL:=https://github.com/shadowsocks/shadowsocks-libev
|
||||
DEPENDS:=+libcares +libev +libmbedtls +libpcre +libpthread +libsodium +shadowsocks-libev-config +zlib +libpcap +libcap +libstdcpp +libelf1
|
||||
DEPENDS:=+libcares +libev +libmbedtls +libpcre +libpthread +libsodium +shadowsocks-libev-config +zlib +libpcap +libcap +libstdcpp +libelf
|
||||
endef
|
||||
|
||||
define Package/shadowsocks-libev-$(1)/install
|
||||
|
|