Compare commits
49 commits
master
...
for-12.09.
Author | SHA1 | Date | |
---|---|---|---|
|
04e09d75ef | ||
|
bd6c447b82 | ||
|
e4b8715fb3 | ||
|
7626faa9fd | ||
|
5c075bfe8a | ||
|
9638491a78 | ||
|
bfccd8d754 | ||
|
eb5806285c | ||
|
274bb795c9 | ||
|
ea91e6500f | ||
|
0e1dbcde02 | ||
|
7d2109081a | ||
|
8fa4dcd3a6 | ||
|
8cbc0e65d6 | ||
|
aa79c2ee71 | ||
|
d31e649201 | ||
|
a738b4c433 | ||
|
0d76ea5133 | ||
|
052df65d5c | ||
|
3c1fc329dc | ||
|
847812a645 | ||
|
5c9d35a7f9 | ||
|
293b992fde | ||
|
60d2e59edc | ||
|
8b2daca524 | ||
|
82ffb5cb82 | ||
|
f4e601336d | ||
|
1d55b32c29 | ||
|
3c0625032f | ||
|
4dee217945 | ||
|
6698c00136 | ||
|
6fd0400472 | ||
|
a0ffcf13f2 | ||
|
b5136c0303 | ||
|
1fe6e87387 | ||
|
f17298563b | ||
|
c54200b308 | ||
|
e3dfd595eb | ||
|
d7a47d4529 | ||
|
924208e596 | ||
|
409e558f93 | ||
|
5838fc2716 | ||
|
940739efb6 | ||
|
da6a26ab9d | ||
|
5fa04c120f | ||
|
73b84ed6f9 | ||
|
98b20ec4d6 | ||
|
cee4be1393 | ||
|
8bc77992ec |
223 changed files with 6000 additions and 11056 deletions
16
.github/issue_template
vendored
16
.github/issue_template
vendored
|
@ -1,16 +0,0 @@
|
|||
Please make sure that the issue subject starts with `<package-name>: `
|
||||
|
||||
Also make sure that the package is maintained in this repository and not in OpenWrt-base, OpenWrt-packages or OpenWrt-LuCI.
|
||||
|
||||
Issues related to releases below 18.06 and forks are not supported or maintained and will be closed.
|
||||
|
||||
# Issue template (remove lines from top till here)
|
||||
|
||||
Maintainer: @\<github-user> (find it by checking history of the package Makefile)
|
||||
Environment: (put here arch, model, OpenWrt version)
|
||||
|
||||
Description:
|
||||
|
||||
```
|
||||
Formating code blocks by wrapping them with pairs of ```
|
||||
```
|
5
.github/pull_request_template
vendored
5
.github/pull_request_template
vendored
|
@ -1,5 +0,0 @@
|
|||
Maintainer: me / @\<github-user> (find it by checking history of the package Makefile)
|
||||
Compile tested: (put here arch, model, OpenWrt version)
|
||||
Run tested: (put here arch, model, OpenWrt version, tests done)
|
||||
|
||||
Description:
|
6
.github/workflows/Dockerfile
vendored
6
.github/workflows/Dockerfile
vendored
|
@ -1,6 +0,0 @@
|
|||
ARG ARCH=x86-64
|
||||
FROM openwrt/rootfs:$ARCH
|
||||
|
||||
ADD entrypoint.sh /entrypoint.sh
|
||||
|
||||
CMD ["/entrypoint.sh"]
|
|
@ -1,91 +0,0 @@
|
|||
name: Check autorelease deprecation
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, synchronize, converted_to_draft, ready_for_review, edited]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Check autorelease deprecation
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Determine branch name
|
||||
run: |
|
||||
BRANCH="${GITHUB_BASE_REF#refs/heads/}"
|
||||
echo "Building for $BRANCH"
|
||||
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
|
||||
|
||||
- name: Determine changed packages
|
||||
run: |
|
||||
RET=0
|
||||
|
||||
# only detect packages with changes
|
||||
PKG_ROOTS=$(find . -name Makefile | \
|
||||
grep -v ".*/src/Makefile" | \
|
||||
sed -e 's@./\(.*\)/Makefile@\1/@')
|
||||
CHANGES=$(git diff --diff-filter=d --name-only origin/$BRANCH...)
|
||||
|
||||
for ROOT in $PKG_ROOTS; do
|
||||
for CHANGE in $CHANGES; do
|
||||
if [[ "$CHANGE" == "$ROOT"* ]]; then
|
||||
if grep -q '$(AUTORELEASE)' "$ROOT/Makefile"; then
|
||||
CONTAINS_AUTORELEASE+="$ROOT"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
if [ -n "$CONTAINS_AUTORELEASE" ]; then
|
||||
RET=1
|
||||
cat > "$GITHUB_WORKSPACE/pr_comment.md" << EOF
|
||||
Please do no longer set *PKG_RELEASE* to *AUTORELEASE* as the
|
||||
feature is deprecated. Please use an integer instead. Below is a
|
||||
list of affected packages including correct *PKG_RELEASE*:
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
for ROOT in $CONTAINS_AUTORELEASE; do
|
||||
echo -n " - ${ROOT}Makefile: PKG_RELEASE:=" >> "$GITHUB_WORKSPACE/pr_comment.md"
|
||||
last_bump="$(git log --pretty=format:'%h %s' "$ROOT" |
|
||||
grep --max-count=1 -e ': [uU]pdate to ' -e ': [bB]ump to ' |
|
||||
cut -f 1 -d ' ')"
|
||||
|
||||
if [ -n "$last_bump" ]; then
|
||||
echo -n $(($(git rev-list --count "$last_bump..HEAD" "$ROOT") + 2)) >> "$GITHUB_WORKSPACE/pr_comment.md"
|
||||
else
|
||||
echo -n $(($(git rev-list --count HEAD "$ROOT") + 2)) >> "$GITHUB_WORKSPACE/pr_comment.md"
|
||||
fi
|
||||
echo >> "$GITHUB_WORKSPACE/pr_comment.md"
|
||||
done
|
||||
|
||||
exit $RET
|
||||
|
||||
- name: Find Comment
|
||||
uses: peter-evans/find-comment@v2
|
||||
if: ${{ failure() }}
|
||||
id: fc
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
comment-author: 'github-actions[bot]'
|
||||
|
||||
- name: Create or update comment
|
||||
uses: peter-evans/create-or-update-comment@v2
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
comment-id: ${{ steps.fc.outputs.comment-id }}
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
body-file: 'pr_comment.md'
|
||||
edit-mode: replace
|
26
.github/workflows/ci_helpers.sh
vendored
26
.github/workflows/ci_helpers.sh
vendored
|
@ -1,26 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
color_out() {
|
||||
printf "\e[0;$1m$PKG_NAME: %s\e[0;0m\n" "$2"
|
||||
}
|
||||
|
||||
success() {
|
||||
color_out 32 "$1"
|
||||
}
|
||||
|
||||
info() {
|
||||
color_out 36 "$1"
|
||||
}
|
||||
|
||||
err() {
|
||||
color_out 31 "$1"
|
||||
}
|
||||
|
||||
warn() {
|
||||
color_out 33 "$1"
|
||||
}
|
||||
|
||||
err_die() {
|
||||
err "$1"
|
||||
exit 1
|
||||
}
|
62
.github/workflows/entrypoint.sh
vendored
62
.github/workflows/entrypoint.sh
vendored
|
@ -1,62 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# not enabling `errtrace` and `pipefail` since those are bash specific
|
||||
set -o errexit # failing commands causes script to fail
|
||||
set -o nounset # undefined variables causes script to fail
|
||||
|
||||
echo "src/gz packages_ci file:///ci" >> /etc/opkg/distfeeds.conf
|
||||
|
||||
FINGERPRINT="$(usign -F -p /ci/packages_ci.pub)"
|
||||
cp /ci/packages_ci.pub "/etc/opkg/keys/$FINGERPRINT"
|
||||
|
||||
mkdir -p /var/lock/
|
||||
|
||||
opkg update
|
||||
|
||||
[ -n "${CI_HELPER:=''}" ] || CI_HELPER="/ci/.github/workflows/ci_helpers.sh"
|
||||
|
||||
for PKG in /ci/*.ipk; do
|
||||
tar -xzOf "$PKG" ./control.tar.gz | tar xzf - ./control
|
||||
# package name including variant
|
||||
PKG_NAME=$(sed -ne 's#^Package: \(.*\)$#\1#p' ./control)
|
||||
# package version without release
|
||||
PKG_VERSION=$(sed -ne 's#^Version: \(.*\)-[0-9]*$#\1#p' ./control)
|
||||
# package source contianing test.sh script
|
||||
PKG_SOURCE=$(sed -ne 's#^Source: .*/\(.*\)$#\1#p' ./control)
|
||||
|
||||
echo "Testing package $PKG_NAME in version $PKG_VERSION from $PKG_SOURCE"
|
||||
|
||||
export PKG_NAME PKG_VERSION CI_HELPER
|
||||
|
||||
PRE_TEST_SCRIPT=$(find /ci/ -name "$PKG_SOURCE" -type d)/pre-test.sh
|
||||
|
||||
if [ -f "$PRE_TEST_SCRIPT" ]; then
|
||||
echo "Use package specific pre-test.sh"
|
||||
if sh "$PRE_TEST_SCRIPT" "$PKG_NAME" "$PKG_VERSION"; then
|
||||
echo "Pre-test successful"
|
||||
else
|
||||
echo "Pre-test failed"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "No pre-test.sh script available"
|
||||
fi
|
||||
|
||||
opkg install "$PKG"
|
||||
|
||||
TEST_SCRIPT=$(find /ci/ -name "$PKG_SOURCE" -type d)/test.sh
|
||||
|
||||
if [ -f "$TEST_SCRIPT" ]; then
|
||||
echo "Use package specific test.sh"
|
||||
if sh "$TEST_SCRIPT" "$PKG_NAME" "$PKG_VERSION"; then
|
||||
echo "Test succesful"
|
||||
else
|
||||
echo "Test failed"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "No test.sh script available"
|
||||
fi
|
||||
|
||||
opkg remove "$PKG_NAME" --force-removal-of-dependent-packages --force-remove --autoremove || true
|
||||
done
|
63
.github/workflows/formal.yml
vendored
63
.github/workflows/formal.yml
vendored
|
@ -1,63 +0,0 @@
|
|||
name: Test Formalities
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Test Formalities
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Determine branch name
|
||||
run: |
|
||||
BRANCH="${GITHUB_BASE_REF#refs/heads/}"
|
||||
echo "Building for $BRANCH"
|
||||
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
|
||||
|
||||
- name: Test formalities
|
||||
run: |
|
||||
source .github/workflows/ci_helpers.sh
|
||||
|
||||
RET=0
|
||||
for commit in $(git rev-list HEAD ^origin/$BRANCH); do
|
||||
info "=== Checking commit '$commit'"
|
||||
if git show --format='%P' -s $commit | grep -qF ' '; then
|
||||
err "Pull request should not include merge commits"
|
||||
RET=1
|
||||
fi
|
||||
|
||||
author="$(git show -s --format=%aN $commit)"
|
||||
if echo $author | grep -q '\S\+\s\+\S\+'; then
|
||||
success "Author name ($author) seems ok"
|
||||
else
|
||||
err "Author name ($author) need to be your real name 'firstname lastname'"
|
||||
RET=1
|
||||
fi
|
||||
|
||||
subject="$(git show -s --format=%s $commit)"
|
||||
if echo "$subject" | grep -q -e '^[0-9A-Za-z,+/_-]\+: ' -e '^Revert '; then
|
||||
success "Commit subject line seems ok ($subject)"
|
||||
else
|
||||
err "Commit subject line MUST start with '<package name>: ' ($subject)"
|
||||
RET=1
|
||||
fi
|
||||
|
||||
body="$(git show -s --format=%b $commit)"
|
||||
sob="$(git show -s --format='Signed-off-by: %aN <%aE>' $commit)"
|
||||
if echo "$body" | grep -qF "$sob"; then
|
||||
success "Signed-off-by match author"
|
||||
else
|
||||
err "Signed-off-by is missing or doesn't match author (should be '$sob')"
|
||||
RET=1
|
||||
fi
|
||||
done
|
||||
|
||||
exit $RET
|
157
.github/workflows/multi-arch-test-build.yml
vendored
157
.github/workflows/multi-arch-test-build.yml
vendored
|
@ -1,157 +0,0 @@
|
|||
name: Test Build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Test ${{ matrix.arch }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- arch: aarch64_generic
|
||||
target: armsr-armv8
|
||||
runtime_test: true
|
||||
|
||||
- arch: arm_cortex-a15_neon-vfpv4
|
||||
target: armsr-armv7
|
||||
runtime_test: true
|
||||
|
||||
- arch: arm_cortex-a9_vfpv3-d16
|
||||
target: mvebu-cortexa9
|
||||
runtime_test: false
|
||||
|
||||
- arch: i386_pentium-mmx
|
||||
target: x86-geode
|
||||
runtime_test: true
|
||||
|
||||
- arch: mips_24kc
|
||||
target: ath79-generic
|
||||
runtime_test: true
|
||||
|
||||
- arch: powerpc_464fp
|
||||
target: apm821xx-nand
|
||||
runtime_test: false
|
||||
|
||||
- arch: powerpc_8548
|
||||
target: mpc85xx-p1010
|
||||
runtime_test: false
|
||||
|
||||
- arch: riscv64_riscv64
|
||||
target: sifiveu-generic
|
||||
runtime_test: false
|
||||
|
||||
- arch: x86_64
|
||||
target: x86-64
|
||||
runtime_test: true
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Determine branch name
|
||||
run: |
|
||||
BRANCH="${GITHUB_BASE_REF#refs/heads/}"
|
||||
echo "Building for $BRANCH"
|
||||
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
|
||||
|
||||
- name: Determine changed packages
|
||||
run: |
|
||||
# only detect packages with changes
|
||||
PKG_ROOTS=$(find . -name Makefile | \
|
||||
grep -v ".*/src/Makefile" | \
|
||||
sed -e 's@./\(.*\)/Makefile@\1/@')
|
||||
CHANGES=$(git diff --diff-filter=d --name-only origin/$BRANCH)
|
||||
|
||||
for ROOT in $PKG_ROOTS; do
|
||||
for CHANGE in $CHANGES; do
|
||||
if [[ "$CHANGE" == "$ROOT"* ]]; then
|
||||
PACKAGES+=$(echo "$ROOT" | sed -e 's@\(.*\)/@\1 @')
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# fallback to test packages if nothing explicitly changes this is
|
||||
# should run if other mechanics in packages.git changed
|
||||
PACKAGES="${PACKAGES:-bird2 cjdns olsrd}"
|
||||
|
||||
echo "Building $PACKAGES"
|
||||
echo "PACKAGES=$PACKAGES" >> $GITHUB_ENV
|
||||
|
||||
- name: Generate build keys
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y signify-openbsd
|
||||
signify-openbsd -G -n -c 'DO NOT USE - OpenWrt packages feed CI' -p packages_ci.pub -s packages_ci.sec
|
||||
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
|
||||
echo "KEY_BUILD<<$EOF" >> $GITHUB_ENV
|
||||
cat packages_ci.sec >> $GITHUB_ENV
|
||||
echo "$EOF" >> $GITHUB_ENV
|
||||
|
||||
- name: Build
|
||||
uses: openwrt/gh-action-sdk@v5
|
||||
env:
|
||||
ARCH: ${{ matrix.arch }}-${{ env.BRANCH }}
|
||||
FEEDNAME: packages_ci
|
||||
INDEX: 1
|
||||
KEY_BUILD: ${{ env.KEY_BUILD }}
|
||||
|
||||
- name: Move created packages to project dir
|
||||
run: cp bin/packages/${{ matrix.arch }}/packages_ci/* . || true
|
||||
|
||||
- name: Store packages
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{env.ARCHIVE_NAME}}-packages
|
||||
path: |
|
||||
Packages
|
||||
Packages.*
|
||||
*.ipk
|
||||
PKG-INFO
|
||||
|
||||
- name: Store logs
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.arch}}-logs
|
||||
path: logs/
|
||||
|
||||
- name: Remove logs
|
||||
run: sudo rm -rf logs/ || true
|
||||
|
||||
- name: Check if any packages were built
|
||||
run: |
|
||||
if [ -n "$(find . -maxdepth 1 -type f -name '*.ipk' -print -quit)" ]; then
|
||||
echo "Found *.ipk files"
|
||||
HAVE_IPKS=true
|
||||
else
|
||||
echo "No *.ipk files found"
|
||||
HAVE_IPKS=false
|
||||
fi
|
||||
echo "HAVE_IPKS=$HAVE_IPKS" >> $GITHUB_ENV
|
||||
|
||||
- name: Register QEMU
|
||||
if: ${{ matrix.runtime_test && fromJSON(env.HAVE_IPKS) }}
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y qemu-user-static binfmt-support
|
||||
sudo update-binfmts --import
|
||||
|
||||
- name: Build Docker container
|
||||
if: ${{ matrix.runtime_test && fromJSON(env.HAVE_IPKS) }}
|
||||
run: |
|
||||
docker build -t test-container --build-arg ARCH .github/workflows/
|
||||
env:
|
||||
ARCH: ${{ matrix.arch }}-${{ env.BRANCH }}
|
||||
|
||||
- name: Test via Docker container
|
||||
if: ${{ matrix.runtime_test && fromJSON(env.HAVE_IPKS) }}
|
||||
run: |
|
||||
docker run --rm -v $GITHUB_WORKSPACE:/ci test-container
|
25
MAINTAINERS
25
MAINTAINERS
|
@ -1,25 +0,0 @@
|
|||
# _______ ________ __
|
||||
# | |.-----.-----.-----.| | | |.----.| |_
|
||||
# | - || _ | -__| || | | || _|| _|
|
||||
# |_______|| __|_____|__|__||________||__| |____|
|
||||
# |__| W I R E L E S S F R E E D O M
|
||||
#
|
||||
# People listed here are managing the OpenWrt routing feed,
|
||||
# use alphabetical order when updating the list.
|
||||
|
||||
Axel "axn" Neumann <neumann@cgws.de>
|
||||
Baptiste Jonglez <openwrt-pkg@bitsofnetworks.org>
|
||||
Bastian Bittorf <bb@npl.de>
|
||||
Corinna "Elektra" Aichele <onelektra@gmx.net>
|
||||
Gabriel Kerneis <gabriel@kerneis.info>
|
||||
Gui Iribarren <gui@altermundi.net>
|
||||
Jo-Philipp Wich <jo@mein.io>
|
||||
Luka Perkov <luka@openwrt.org>
|
||||
Marek Lindner <mareklindner@neomailbox.ch>
|
||||
Moritz Warning <moritzwarning@web.de>
|
||||
Nicolás Echániz <nicoechaniz@altermundi.net>
|
||||
Pau Escrich <pau@dabax.net>
|
||||
Saverio Proto <zioproto@gmail.com>
|
||||
Simon Wunderlich <sw@simonwunderlich.de>
|
||||
Steven Barth <steven@midlink.org>
|
||||
Vasilis "acinonyx" Tsiligiannis <acinonyx@openwrt.gr>
|
18
README
Normal file
18
README
Normal file
|
@ -0,0 +1,18 @@
|
|||
This is an OpenWrt package feed containing community maintained routing packages.
|
||||
|
||||
To use these packages, add the following line to the feeds.conf
|
||||
in the OpenWrt buildroot:
|
||||
|
||||
src-git routing git://github.com/openwrt-routing/packages.git
|
||||
|
||||
Update the feed:
|
||||
|
||||
./scripts/feeds update routing
|
||||
|
||||
Activate the package:
|
||||
|
||||
./scripts/feeds install -a -p routing
|
||||
|
||||
The routing packages should now appear in menuconfig.
|
||||
|
||||
|
21
README.md
21
README.md
|
@ -1,21 +0,0 @@
|
|||
# OpenWrt Routing Feed
|
||||
|
||||
## Description
|
||||
|
||||
This OpenWrt package feed contains community maintained routing packages.
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
This repository is intended to be layered on-top of an OpenWrt buildroot.
|
||||
If you do not have an OpenWrt buildroot installed, see the documentation at:
|
||||
[OpenWrt Buildroot – Installation][1] on the OpenWrt support site.
|
||||
|
||||
This feed is enabled by default. To install all its package definitions, run:
|
||||
|
||||
```
|
||||
./scripts/feeds update routing
|
||||
./scripts/feeds install -a -p routing
|
||||
```
|
||||
|
||||
[1]: https://openwrt.org/docs/guide-developer/build-system/install-buildsystem
|
|
@ -1,58 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2007-2011 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:=ahcpd
|
||||
PKG_VERSION:=0.53
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://www.irif.fr/~jch/software/files/
|
||||
PKG_HASH:=a4622e817d2b2a9b878653f085585bd57f3838cc546cca6028d3b73ffcac0d52
|
||||
|
||||
PKG_MAINTAINER:=Gabriel Kerneis <gabriel@kerneis.info>
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENCE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ahcpd
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Ad-Hoc Configuration Protocol daemon
|
||||
URL:=https://www.irif.fr/~jch/software/ahcp/
|
||||
DEPENDS:=@IPV6 +ip +librt
|
||||
endef
|
||||
|
||||
define Package/ahcpd/description
|
||||
Ahcpd is a daemon for configuring an IPv6 network using the Ad-Hoc
|
||||
Configuration Protocol (AHCP). AHCP is designed for wireless mesh
|
||||
networks, where IPv6 autoconfiguration and DHCPv6 do not work, but may
|
||||
also be used on wired networks.
|
||||
endef
|
||||
|
||||
define Package/ahcpd/conffiles
|
||||
/etc/config/ahcpd
|
||||
endef
|
||||
|
||||
MAKE_FLAGS += \
|
||||
EXTRA_DEFINES="$(TARGET_CFLAGS)"
|
||||
|
||||
define Package/ahcpd/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/etc/ahcp
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ahcp-config.sh $(1)/etc/ahcp/
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ahcpd $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./files/ahcpd.config $(1)/etc/config/ahcpd
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/ahcpd.init $(1)/etc/init.d/ahcpd
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ahcpd))
|
|
@ -1,32 +0,0 @@
|
|||
package ahcpd
|
||||
|
||||
config ahcpd
|
||||
# Choose ahcp mode: client (default), server or forwarder
|
||||
## option 'mode' 'client'
|
||||
# Uncomment the following lines to enable ahcpd on the desired
|
||||
# interfaces.
|
||||
## list 'interface' 'lan'
|
||||
## list 'interface' 'wlan'
|
||||
|
||||
# The following only makes sense in 'server' mode.
|
||||
# Tweak to suit your needs.
|
||||
## list 'prefix' 'fde6:20f5:c9ac:358::/64'
|
||||
## list 'prefix' '192.168.4.128/25'
|
||||
## list 'name_server' 'fde6:20f5:c9ac:358::1'
|
||||
## list 'name_server' '192.168.4.1'
|
||||
## list 'ntp_server' '192.168.4.2'
|
||||
## option 'lease_dir' '/var/lib/leases'
|
||||
|
||||
# option 'id_file' '/var/lib/ahcp-unique-id'
|
||||
# option 'log_file' '/var/log/ahcpd.log'
|
||||
# The configuration file is not necessary since you can configure
|
||||
# everything from this file. But still, you might prefer using it.
|
||||
## option 'conf_file' '/etc/ahcp/ahcp.conf'
|
||||
|
||||
# option 'multicast_address' 'ff02::cca6:c0f9:e182:5359'
|
||||
# option 'port' '5359'
|
||||
# option 'ipv4_only' 'false'
|
||||
# option 'ipv6_only' 'false'
|
||||
# option 'lease_time' '3666'
|
||||
# option 'debug' '1'
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2007-2011 OpenWrt.org
|
||||
|
||||
START=71
|
||||
|
||||
SERVICE_USE_PID=1
|
||||
|
||||
EXTRA_COMMANDS="status"
|
||||
EXTRA_HELP=" status Print ahcpd's status to the log file."
|
||||
|
||||
append_bool() {
|
||||
local section="$1"
|
||||
local option="$2"
|
||||
local value="$3"
|
||||
local _loctmp
|
||||
config_get_bool _loctmp "$section" "$option" 0
|
||||
[ "$_loctmp" -gt 0 ] && append args "$value"
|
||||
}
|
||||
|
||||
append_parm() {
|
||||
local section="$1"
|
||||
local option="$2"
|
||||
local switch="$3"
|
||||
local _loctmp
|
||||
config_get _loctmp "$section" "$option"
|
||||
[ -z "$_loctmp" ] && return 0
|
||||
append args "$switch $_loctmp"
|
||||
}
|
||||
|
||||
append_stmt() {
|
||||
local name="$1"
|
||||
local switch="$2"
|
||||
append args "-C '$switch $name'"
|
||||
}
|
||||
|
||||
append_opt_stmt() {
|
||||
local section="$1"
|
||||
local option="$2"
|
||||
local switch="$3"
|
||||
local _loctmp
|
||||
config_get _loctmp "$section" "$option"
|
||||
[ -z "$_loctmp" ] && return 0
|
||||
append args "-C '$switch $_loctmp'"
|
||||
}
|
||||
|
||||
ahcp_addif() {
|
||||
local ifname=$(uci_get_state network "$1" ifname "$1")
|
||||
append interfaces "$ifname"
|
||||
}
|
||||
|
||||
ahcp_server() {
|
||||
local cfg="$1"
|
||||
|
||||
append_opt_stmt "$cfg" 'mode' 'mode'
|
||||
append_opt_stmt "$cfg" 'lease_dir' 'lease-dir'
|
||||
config_list_foreach "$cfg" 'prefix' append_stmt 'prefix'
|
||||
config_list_foreach "$cfg" 'name_server' append_stmt 'name-server'
|
||||
config_list_foreach "$cfg" 'ntp_server' append_stmt 'ntp-server'
|
||||
|
||||
append_parm "$cfg" 'id_file' '-i'
|
||||
append_parm "$cfg" 'log_file' '-L'
|
||||
}
|
||||
|
||||
ahcp_config() {
|
||||
local cfg="$1"
|
||||
local interface
|
||||
local _loctmp
|
||||
|
||||
config_list_foreach "$cfg" 'interface' ahcp_addif
|
||||
|
||||
# Add interfaces with "option proto ahcp" in /etc/config/network
|
||||
# (only for client mode)
|
||||
config_get _loctmp "$cfg" "mode"
|
||||
if [ -z "$_loctmp" -o "$_loctmp" = "client" ]; then
|
||||
for interface in $(uci -P /var/state show network|grep proto=ahcp|cut -d. -f2); do
|
||||
ahcp_addif $interface
|
||||
done
|
||||
fi
|
||||
|
||||
append_bool "$cfg" 'ipv4_only' '-4'
|
||||
append_bool "$cfg" 'ipv6_only' '-6'
|
||||
append_bool "$cfg" 'no_dns' '-N'
|
||||
|
||||
append_parm "$cfg" 'multicast_address' '-m'
|
||||
append_parm "$cfg" 'port' '-p'
|
||||
append_parm "$cfg" 'lease_time' '-t'
|
||||
append_parm "$cfg" 'debug' '-d'
|
||||
append_parm "$cfg" 'conf_file' '-c'
|
||||
append_parm "$cfg" 'script' '-s'
|
||||
}
|
||||
|
||||
start() {
|
||||
mkdir -p /var/lib
|
||||
config_load ahcpd
|
||||
unset args
|
||||
unset interfaces
|
||||
config_foreach ahcp_config ahcpd
|
||||
config_foreach ahcp_server ahcpd
|
||||
[ -z "$interfaces" ] && return 0
|
||||
eval "service_start /usr/sbin/ahcpd -D $args $interfaces"
|
||||
}
|
||||
|
||||
stop() {
|
||||
service_stop /usr/sbin/ahcpd
|
||||
}
|
||||
|
||||
status() {
|
||||
SERVICE_SIG="USR1" service_signal /usr/sbin/ahcpd
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
config ALFRED_NEEDS_lua
|
||||
bool
|
||||
|
||||
config ALFRED_NEEDS_libgps
|
||||
bool
|
||||
|
||||
config PACKAGE_ALFRED_VIS
|
||||
bool "enable vis server for alfred"
|
||||
depends on PACKAGE_alfred
|
||||
default y
|
||||
|
||||
config PACKAGE_ALFRED_BATHOSTS
|
||||
bool "enable autogeneration of /etc/bat-hosts"
|
||||
depends on PACKAGE_alfred
|
||||
select ALFRED_NEEDS_lua
|
||||
default n
|
||||
|
||||
config PACKAGE_ALFRED_GPSD
|
||||
bool "enable gpsd service for alfred"
|
||||
depends on PACKAGE_alfred
|
||||
select ALFRED_NEEDS_libgps
|
||||
default n
|
|
@ -1,84 +0,0 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=alfred
|
||||
PKG_VERSION:=2024.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
|
||||
PKG_HASH:=d029a43638ab16771e5f71e134bc843d1713d74041c65bcda18a31d18f5531bd
|
||||
|
||||
PKG_MAINTAINER:=Simon Wunderlich <sw@simonwunderlich.de>
|
||||
PKG_LICENSE:=GPL-2.0-only MIT
|
||||
PKG_LICENSE_FILES:=LICENSES/preferred/GPL-2.0 LICENSES/preferred/MIT
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_BUILD_FLAGS:=gc-sections lto
|
||||
|
||||
PKG_CONFIG_DEPENDS += \
|
||||
CONFIG_ALFRED_NEEDS_lua \
|
||||
CONFIG_ALFRED_NEEDS_libgps \
|
||||
CONFIG_PACKAGE_ALFRED_VIS \
|
||||
CONFIG_PACKAGE_ALFRED_BATHOSTS \
|
||||
CONFIG_PACKAGE_ALFRED_GPSD
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/alfred
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=A.L.F.R.E.D. - Almighty Lightweight Fact Remote Exchange Daemon
|
||||
URL:=https://www.open-mesh.org/
|
||||
DEPENDS:= +libc @IPV6 +libnl-tiny +librt \
|
||||
+ALFRED_NEEDS_lua:lua \
|
||||
+ALFRED_NEEDS_libgps:libgps
|
||||
endef
|
||||
|
||||
define Package/alfred/description
|
||||
alfred is a user space daemon for distributing arbitrary local information
|
||||
over the mesh/network in a decentralized fashion. This data can be anything
|
||||
which appears to be useful - originally designed to replace the batman-adv
|
||||
visualization (vis), you may distribute hostnames, phone books, administration
|
||||
information, DNS information, the local weather forecast ...
|
||||
|
||||
alfred runs as daemon in the background of the system. A user may insert
|
||||
information by using the alfred binary on the command line, or use special
|
||||
programs to communicate with alfred (done via unix sockets). alfred then takes
|
||||
care of distributing the local information to other alfred servers on other
|
||||
nodes. This is done via IPv6 link-local multicast, and does not require any
|
||||
configuration. A user can request data from alfred, and will receive the
|
||||
information available from all alfred servers in the network.
|
||||
endef
|
||||
|
||||
define Package/alfred/conffiles
|
||||
/etc/config/alfred
|
||||
endef
|
||||
|
||||
define Package/alfred/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
MAKE_FLAGS += \
|
||||
CONFIG_ALFRED_VIS=$(if $(CONFIG_PACKAGE_ALFRED_VIS),y,n) \
|
||||
CONFIG_ALFRED_GPSD=$(if $(CONFIG_PACKAGE_ALFRED_GPSD),y,n) \
|
||||
CONFIG_ALFRED_CAPABILITIES=n \
|
||||
LIBNL_NAME="libnl-tiny" \
|
||||
LIBNL_GENL_NAME="libnl-tiny" \
|
||||
REVISION="$(PKG_VERSION)-openwrt-$(PKG_RELEASE)"
|
||||
|
||||
define Package/alfred/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
cp -fpR $(PKG_BUILD_DIR)/alfred $(1)/usr/sbin/
|
||||
[ "x$(CONFIG_PACKAGE_ALFRED_VIS)" == "xy" ] && cp -fpR $(PKG_BUILD_DIR)/vis/batadv-vis $(1)/usr/sbin/ ; true
|
||||
[ "x$(CONFIG_PACKAGE_ALFRED_GPSD)" == "xy" ] && cp -fpR $(PKG_BUILD_DIR)/gpsd/alfred-gpsd $(1)/usr/sbin/ ; true
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/alfred.init $(1)/etc/init.d/alfred
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DATA) ./files/alfred.config $(1)/etc/config/alfred
|
||||
$(INSTALL_DIR) $(1)/etc/alfred
|
||||
[ "x$(CONFIG_PACKAGE_ALFRED_BATHOSTS)" == "xy" ] && $(INSTALL_BIN) ./files/bat-hosts.lua $(1)/etc/alfred/bat-hosts.lua ; true
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,alfred))
|
|
@ -1,8 +0,0 @@
|
|||
config 'alfred' 'alfred'
|
||||
list interface 'br-lan'
|
||||
option mode 'master'
|
||||
option batmanif 'bat0'
|
||||
option start_vis '1'
|
||||
option run_facters '1'
|
||||
# REMOVE THIS LINE TO ENABLE ALFRED
|
||||
option disabled '1'
|
|
@ -1,97 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
alfred_args=""
|
||||
vis_args=""
|
||||
facters_dir="/etc/alfred"
|
||||
enable=0
|
||||
vis_enable=0
|
||||
|
||||
append_interface()
|
||||
{
|
||||
append "interfaces" "$1" ","
|
||||
}
|
||||
|
||||
alfred_start() {
|
||||
local args=""
|
||||
local section="$1"
|
||||
local disabled interface mode
|
||||
local interfaces
|
||||
|
||||
# check if section is disabled
|
||||
config_get_bool disabled "$section" disabled 0
|
||||
[ $disabled = 0 ] || return 1
|
||||
|
||||
args="-f"
|
||||
|
||||
config_list_foreach "$section" "interface" append_interface
|
||||
if [ -z "$interfaces" ]; then
|
||||
config_get interface "$section" interface
|
||||
append_interface "$interface"
|
||||
fi
|
||||
append args "-i $interfaces"
|
||||
|
||||
config_get mode "$section" mode
|
||||
[ "$mode" = "master" ] && append args "-m"
|
||||
|
||||
config_get batmanif "$section" batmanif
|
||||
append args "-b $batmanif"
|
||||
|
||||
append alfred_args "$args"
|
||||
enable=1
|
||||
|
||||
config_get_bool start_vis "$section" start_vis 0
|
||||
if [ "$start_vis" = 1 ] && [ -x /usr/sbin/batadv-vis ]; then
|
||||
vis_enable=1
|
||||
append vis_args "-i $batmanif -s"
|
||||
fi
|
||||
|
||||
config_get_bool run_facters "$section" run_facters 0
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load "alfred"
|
||||
config_foreach alfred_start alfred
|
||||
|
||||
[ "$enable" = "0" ] && return 0
|
||||
|
||||
procd_open_instance "alfred"
|
||||
procd_set_param command /usr/sbin/alfred
|
||||
procd_append_param command ${alfred_args}
|
||||
procd_close_instance
|
||||
|
||||
[ "$vis_enable" = "1" ] && {
|
||||
procd_open_instance "batadv-vis"
|
||||
procd_set_param command /usr/sbin/batadv-vis
|
||||
procd_append_param command ${vis_args}
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
[ "$run_facters" = "1" ] && {
|
||||
( for file in $facters_dir/* ; do [ -x $file ] && $file ; done )
|
||||
if ! ( grep -q "for file in $facters_dir/\* ; do " /etc/crontabs/root 2>/dev/null ) ; then
|
||||
echo "*/5 * * * * ( for file in $facters_dir/* ; do [ -x \$file ] && \$file ; done )" >> /etc/crontabs/root
|
||||
/etc/init.d/cron enable
|
||||
/etc/init.d/cron restart
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "alfred"
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
[ -e /etc/crontabs/root ] && {
|
||||
sed "\|for file in $facters_dir/\* ; do |d" -i /etc/crontabs/root
|
||||
/etc/init.d/cron restart
|
||||
}
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
#!/usr/bin/lua
|
||||
|
||||
local type_id = 64 -- bat-hosts
|
||||
|
||||
function get_hostname()
|
||||
local hostfile = io.open("/proc/sys/kernel/hostname", "r")
|
||||
local ret_string = hostfile:read()
|
||||
hostfile:close()
|
||||
return ret_string
|
||||
end
|
||||
|
||||
function get_interfaces_names()
|
||||
local ret = {}
|
||||
|
||||
for name in io.popen("ls -1 /sys/class/net/"):lines() do
|
||||
table.insert(ret, name)
|
||||
end
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
function get_interface_address(name)
|
||||
local addressfile = io.open("/sys/class/net/"..name.."/address", "r")
|
||||
local ret_string = addressfile:read()
|
||||
addressfile:close()
|
||||
return ret_string
|
||||
end
|
||||
|
||||
|
||||
local function generate_bat_hosts()
|
||||
-- get hostname and interface macs/names
|
||||
-- then return a table containing valid bat-hosts lines
|
||||
local n, i
|
||||
local ifaces, ret = {}, {}
|
||||
|
||||
local hostname = get_hostname()
|
||||
|
||||
for n, i in ipairs(get_interfaces_names()) do
|
||||
local address = get_interface_address(i)
|
||||
if not ifaces[address] then ifaces[address] = i end
|
||||
end
|
||||
|
||||
for mac, iname in pairs(ifaces) do
|
||||
if mac:match("^%x%x:%x%x:%x%x:%x%x:%x%x:%x%x$") and not mac:match("00:00:00:00:00:00") then
|
||||
table.insert(ret, mac.." "..hostname.."_"..iname.."\n")
|
||||
end
|
||||
end
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
local function publish_bat_hosts()
|
||||
-- pass a raw chunk of data to alfred
|
||||
local fd = io.popen("alfred -s " .. type_id, "w")
|
||||
if fd then
|
||||
local ret = generate_bat_hosts()
|
||||
if ret then
|
||||
fd:write(table.concat(ret))
|
||||
end
|
||||
fd:close()
|
||||
end
|
||||
end
|
||||
|
||||
local function write_bat_hosts(rows)
|
||||
local content = { "### /tmp/bat-hosts generated by alfred-bat-hosts\n",
|
||||
"### /!\\ This file is overwritten every 5 minutes /!\\\n",
|
||||
"### (To keep manual changes, replace /etc/bat-hosts symlink with a static file)\n" }
|
||||
|
||||
-- merge the chunks from all nodes, de-escaping newlines
|
||||
for _, row in ipairs(rows) do
|
||||
local node, value = unpack(row)
|
||||
table.insert(content, "# Node ".. node .. "\n")
|
||||
table.insert(content, value:gsub("\x0a", "\n") .. "\n")
|
||||
end
|
||||
|
||||
-- write parsed content down to disk
|
||||
local fd = io.open("/tmp/bat-hosts", "w")
|
||||
if fd then
|
||||
fd:write(table.concat(content))
|
||||
fd:close()
|
||||
end
|
||||
|
||||
-- try to make a symlink in /etc pointing to /tmp,
|
||||
-- if it exists, ln will do nothing.
|
||||
os.execute("ln -ns /tmp/bat-hosts /etc/bat-hosts 2>/dev/null")
|
||||
end
|
||||
|
||||
local function receive_bat_hosts()
|
||||
-- read raw chunks from alfred, convert them to a nested table and call write_bat_hosts
|
||||
-- "alfred -r" can fail in slave nodes (returns empty stdout), so:
|
||||
-- check output is not null before writing /tmp/bat-hosts, and retry 3 times before giving up.
|
||||
for n = 1, 3 do
|
||||
local fd = io.popen("alfred -r " .. type_id)
|
||||
--[[ this command returns something like
|
||||
{ "54:e6:fc:b9:cb:37", "00:11:22:33:44:55 ham_wlan0\x0a00:22:33:22:33:22 ham_eth0\x0a" },
|
||||
{ "90:f6:52:bb:ec:57", "00:22:33:22:33:23 spam\x0a" },
|
||||
]]--
|
||||
|
||||
if fd then
|
||||
local output = fd:read("*a")
|
||||
fd:close()
|
||||
if output and output ~= "" then
|
||||
assert(loadstring("rows = {" .. output .. "}"))()
|
||||
write_bat_hosts(rows)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
publish_bat_hosts()
|
||||
receive_bat_hosts()
|
|
@ -1,41 +0,0 @@
|
|||
# Copyright (C) 2012-2014 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=babel-pinger
|
||||
PKG_VERSION:=0.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://www.pps.univ-paris-diderot.fr/~jch/software/files/
|
||||
PKG_HASH:=c411430bb102f08d3d68d2fb5010b5da0149908b671ac0fb12abd8c8ee6380c5
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/babel-pinger
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Routing and Redirection
|
||||
TITLE:=Babel-pinger
|
||||
URL:=http://www.pps.univ-paris-diderot.fr/~jch/software/babel/
|
||||
MAINTAINER:=Gabriel Kerneis <gabriel@kerneis.info>
|
||||
DEPENDS:=+librt
|
||||
endef
|
||||
|
||||
define Package/babel-pinger/description
|
||||
Babel-pinger is a hack to export a default route into Babel for people
|
||||
using DHCP to configure their routers rather than speaking to their
|
||||
upstream provider with a proper routing protocol.
|
||||
endef
|
||||
|
||||
MAKE_FLAGS+= \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
|
||||
define Package/babel-pinger/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/babel-pinger $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,babel-pinger))
|
|
@ -1,23 +1,19 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#
|
||||
# Copyright (C) 2007-2021 OpenWrt.org
|
||||
# Copyright (C) 2007-2009 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:=babeld
|
||||
PKG_VERSION:=1.13.1
|
||||
PKG_VERSION:=1.5.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://www.irif.fr/~jch/software/files/
|
||||
PKG_HASH:=15f24d26da0ccfc073abcdef0309f281e4684f2aa71126f826572c4c845e8dd9
|
||||
|
||||
PKG_MAINTAINER:=Gabriel Kerneis <gabriel@kerneis.info>, \
|
||||
Baptiste Jonglez <openwrt-pkg@bitsofnetworks.org>, \
|
||||
Nick Hainke <vincent@systemli.org>
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENCE
|
||||
PKG_SOURCE_URL:=http://www.pps.univ-paris-diderot.fr/~jch/software/files/
|
||||
PKG_MD5SUM:=ac884beb644792bdb79f0042755820ee
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
@ -25,17 +21,20 @@ define Package/babeld
|
|||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Routing and Redirection
|
||||
TITLE:=A loop-avoiding distance-vector routing protocol
|
||||
URL:=https://www.irif.fr/~jch/software/babel/
|
||||
DEPENDS:=@IPV6 +libubus +libubox
|
||||
TITLE:=A loop-free distance-vector routing protocol
|
||||
URL:=http://www.pps.univ-paris-diderot.fr/~jch/software/babel/
|
||||
MAINTAINER:=Gabriel Kerneis <gabriel@kerneis.info>
|
||||
DEPENDS:=+kmod-ipv6 +librt
|
||||
endef
|
||||
|
||||
define Package/babeld/description
|
||||
Babel is a loop-avoiding distance-vector routing protocol for IPv6 and IPv4
|
||||
with fast convergence properties. It is based on the ideas in DSDV, AODV and
|
||||
Cisco's EIGRP, but is designed to work well not only in wired networks but
|
||||
also in wireless mesh networks, and has been extended with support for
|
||||
overlay networks. Babel is an IETF standard protocol (RFC 8966).
|
||||
Babel is a loop-avoiding distance-vector routing protocol roughly based
|
||||
on DSDV and AODV, but with provisions for link cost estimation and
|
||||
redistribution of routes from other routing protocols.
|
||||
While it is optimised for wireless mesh networks, Babel will also work
|
||||
efficiently on wired networks. It will generate between 1.2 and 2.4 times
|
||||
the amount of routing traffic that RIPng would generate, while
|
||||
never counting to infinity.
|
||||
endef
|
||||
|
||||
define Package/babeld/conffiles
|
||||
|
@ -45,8 +44,6 @@ endef
|
|||
|
||||
MAKE_FLAGS+= \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
LDLIBS="" \
|
||||
LDLIBS+="-lubus -lubox"
|
||||
|
||||
define Package/babeld/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
|
|
|
@ -1,103 +1,78 @@
|
|||
package babeld
|
||||
|
||||
# Detailed documentation: https://openwrt.org/docs/guide-user/services/babeld
|
||||
|
||||
# Babeld reads options from the following files (the last one takes precedence
|
||||
# if an option is defined in several places):
|
||||
# - the file defined by the option conf_file (default: /etc/babeld.conf),
|
||||
# - *.conf files in the directory defined by conf_dir (default: /tmp/babel.d/),
|
||||
# - this UCI configuration file.
|
||||
|
||||
# See "man babeld" for all available options ("Global options").
|
||||
# Important: remember to use '_' instead of '-' in option names.
|
||||
config general
|
||||
# option 'random_id' 'true'
|
||||
# option 'debug' '1'
|
||||
# option 'local_port' '33123'
|
||||
# option 'log_file' '/var/log/babeld.log'
|
||||
## Enable ipv6-subtrees by default since OpenWrt should ship with a
|
||||
## recent enough kernel for it to work.
|
||||
option 'ipv6_subtrees' 'true'
|
||||
# list 'import_table' '42'
|
||||
# list 'import_table' '100'
|
||||
## Alternative configuration file and directory.
|
||||
## See comment at the top of this file for more details.
|
||||
# option 'multicast_address' 'ff02:0:0:0:0:0:1:6'
|
||||
# option 'port' '6696'
|
||||
# option 'state_file' '/var/lib/babel-state'
|
||||
# option 'hello_interval' '4'
|
||||
# option 'wired_hello_interval' '20'
|
||||
# option 'diversity' '0,128'
|
||||
# option 'smoothing_half_time' '4'
|
||||
# option 'kernel_priority' '0'
|
||||
# Do not use this option unless you know what you are doing, as it can
|
||||
# cause persistent route flapping.
|
||||
## option 'duplication_priority' '0'
|
||||
# option 'carrier_sense' 'false'
|
||||
# option 'assume_wireless' 'false'
|
||||
# option 'no_split_horizon' 'false'
|
||||
# option 'debug' '0'
|
||||
# Listen for connections from a front-end, e.g. on port 33123.
|
||||
## option 'local_server' '33123'
|
||||
# option 'random_router_id' 'false'
|
||||
# Keep unfeasible routes
|
||||
## option 'keep_unfeasible' 'false'
|
||||
# Use the given kernel routing table for routes inserted by babeld.
|
||||
## option 'export_table' '0'
|
||||
# Export routes from the given kernel routing tables.
|
||||
## list 'import_table' '0'
|
||||
## list 'import_table' '42'
|
||||
# The configuration file is not necessary since you can do everything
|
||||
# from this file.
|
||||
# option 'conf_file' '/etc/babeld.conf'
|
||||
# option 'conf_dir' '/tmp/babel.d/'
|
||||
# option 'ubus_bindings' 'false'
|
||||
# option 'log_file' '/var/log/babeld.log'
|
||||
|
||||
config interface
|
||||
## Remove this line to enable babeld on this interface
|
||||
# You can use aliases (like lan, wlan) or real names (like eth0.0).
|
||||
# If you use an alias, it must be already defined when babeld starts.
|
||||
# Otherwise, the name is taken literally and the interface can be
|
||||
# brought up later (useful for tunnels for instance).
|
||||
config interface wlan
|
||||
# Remove this line to enable babeld on this interface
|
||||
option 'ignore' 'true'
|
||||
## You can use aliases (like lan, wlan) or real names (like eth0.0).
|
||||
## If you use an alias, it must be already defined when babeld starts.
|
||||
## Otherwise, the name is taken literally and the interface can be
|
||||
## brought up later (useful for tunnels for instance).
|
||||
option 'ifname' 'wlan'
|
||||
## You can set options, see babeld man page ("Interface configuration")
|
||||
# option 'rxcost' '256'
|
||||
# option 'hello_interval' '1'
|
||||
# option 'wired' 'auto'
|
||||
# option 'link_quality' 'auto'
|
||||
# option 'split_horizon' 'auto'
|
||||
# The default is 96 for wired interfaces, and 256 for wireless ones
|
||||
## option 'rxcost' '256'
|
||||
# The default is specified with the -h and -H command-line flags.
|
||||
## option 'hello_interval' '4'
|
||||
# This can be set to a fairly large value, unless significant
|
||||
# packet loss is expected. The default is four times the hello
|
||||
# interval.
|
||||
## option 'update_interval' '16'
|
||||
# Options to enable and configure RTT-based metric
|
||||
## option 'enable_timestamps' 'false'
|
||||
## option 'max_rtt_penalty' '0'
|
||||
## option 'rtt_decay' '42'
|
||||
## option 'rtt_min' '10'
|
||||
## option 'rtt_max' '120'
|
||||
|
||||
config interface
|
||||
config interface lan
|
||||
option 'ignore' 'true'
|
||||
## Physical interface name
|
||||
option 'ifname' 'tun-example'
|
||||
## Specify the type of interface: tunnels use the RTT-based metric.
|
||||
option 'type' 'tunnel'
|
||||
## Other options that can be overriden.
|
||||
# option 'max_rtt_penalty' '96'
|
||||
|
||||
# A config interface without "option ifname" will set default options
|
||||
# for all interfaces. Interface-specific configuration always overrides
|
||||
# default configuration.
|
||||
config interface
|
||||
# option 'enable_timestamps' 'true'
|
||||
# option 'update_interval' '30'
|
||||
|
||||
|
||||
# A filter consists of a type ('in', 'out', 'redistribute' or 'install'),
|
||||
# a set of selectors ('ip', 'eq', etc.) and a set of actions to perform
|
||||
# ('allow', 'deny', 'metric xxx', 'src-prefix xxx', 'table xxx', 'pref-src xxx').
|
||||
# See babeld man page ("Filtering rules") for more details.
|
||||
|
||||
# Below is a sample filter that redistributes the default route if its
|
||||
# protocol number is "boot", e.g. when it is installed by dhcp (see
|
||||
# /etc/iproute2/rt_protos). This filter is disabled thanks to the 'ignore'
|
||||
# setting.
|
||||
# A filter consists in a type ('in', 'out' or 'redistribute'), an action
|
||||
# ('allow', 'deny' or 'metric xxx') and a set of selectors ('ip', 'eq',
|
||||
# etc.). See /etc/babeld.conf for more details.
|
||||
# Here is a sample filter wich redistributes the default route if its
|
||||
# protocol number is "boot", e.g. when it installed by dhcp. It is
|
||||
# disabled by default.
|
||||
config filter
|
||||
option 'ignore' 'true'
|
||||
# Type of filter
|
||||
option 'type' 'redistribute'
|
||||
# Selectors: ip, eq, le, ge, src_ip, src_eq, src_le, src_ge, neigh, id,
|
||||
# proto, local, if.
|
||||
option 'ip' '0.0.0.0/0'
|
||||
option 'eq' '0'
|
||||
option 'proto' '3'
|
||||
# Action, which can be any of: allow, deny, metric <NUMBER>, src-prefix <PREFIX>,
|
||||
# table <ID>, pref-src <IP>.
|
||||
# The action defaults to "allow" if not specified. Here, we specify a higher
|
||||
# redistribution metric than the default (0).
|
||||
option 'action' 'metric 128'
|
||||
option 'ignore' 'true'
|
||||
# Type
|
||||
option 'type' 'redistribute'
|
||||
# Selectors: ip, eq, le, ge, neigh, id, proto, local, if
|
||||
option 'ip' '0.0.0.0/0'
|
||||
option 'le' '0'
|
||||
option 'proto' '3'
|
||||
# Action
|
||||
option 'action' 'metric 128'
|
||||
|
||||
# Another example filter: don't redistribute local addresses in a certain IP prefix.
|
||||
# By default, babeld redistributes *all* local addresses.
|
||||
config filter
|
||||
option 'ignore' 'true'
|
||||
option 'type' 'redistribute'
|
||||
# Only apply to routes/addresses within this prefix.
|
||||
option 'ip' '198.51.100.0/24'
|
||||
# Notice that the 'local' selector is a boolean.
|
||||
option 'local' 'true'
|
||||
# Don't redistribute.
|
||||
option 'action' 'deny'
|
||||
|
||||
# Example install filter, to change or filter routes before they are inserted
|
||||
# into the kernel.
|
||||
config filter
|
||||
option 'ignore' 'true'
|
||||
option 'type' 'install'
|
||||
# Optional: only apply to routes within 2001:db8:cafe::/48
|
||||
option 'ip' '2001:db8:cafe::/48'
|
||||
# We specify the kernel routing table and the preferred source address to use for these routes.
|
||||
# "Allow" is implicit.
|
||||
option 'action' 'table 200 pref-src 2001:db8:ba:be1::42'
|
||||
|
|
|
@ -1,32 +1,18 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
. $IPKG_INSTROOT/lib/functions/network.sh
|
||||
|
||||
USE_PROCD=1
|
||||
START=70
|
||||
|
||||
CONFIGFILE='/var/etc/babeld.conf'
|
||||
OTHERCONFIGFILE="/etc/babeld.conf"
|
||||
OTHERCONFIGDIR="/tmp/babeld.d/"
|
||||
pidfile='/var/run/babeld.pid'
|
||||
EXTRA_COMMANDS="status"
|
||||
EXTRA_HELP=" status Dump Babel's table to the log file."
|
||||
|
||||
# Append a line to the configuration file
|
||||
cfg_append() {
|
||||
local value="$1"
|
||||
echo "$value" >> "$CONFIGFILE"
|
||||
listen_ifname() {
|
||||
local ifname=$(uci_get_state network "$1" ifname "$1")
|
||||
local switch="$2"
|
||||
append args "$switch $ifname"
|
||||
append interfaces "$ifname"
|
||||
}
|
||||
|
||||
cfg_append_option() {
|
||||
local section="$1"
|
||||
local option="$2"
|
||||
local value
|
||||
config_get value "$section" "$option"
|
||||
# babeld convention for options is '-', not '_'
|
||||
[ -n "$value" ] && cfg_append "${option//_/-} $value"
|
||||
}
|
||||
|
||||
# Append to the "$buffer" variable
|
||||
append_ifname() {
|
||||
local section="$1"
|
||||
local option="$2"
|
||||
|
@ -35,7 +21,7 @@ append_ifname() {
|
|||
config_get _name "$section" "$option"
|
||||
[ -z "$_name" ] && return 0
|
||||
local ifname=$(uci_get_state network "$_name" ifname "$_name")
|
||||
append buffer "$switch $ifname"
|
||||
append args "$switch $ifname"
|
||||
}
|
||||
|
||||
append_bool() {
|
||||
|
@ -44,7 +30,13 @@ append_bool() {
|
|||
local value="$3"
|
||||
local _loctmp
|
||||
config_get_bool _loctmp "$section" "$option" 0
|
||||
[ "$_loctmp" -gt 0 ] && append buffer "$value"
|
||||
[ "$_loctmp" -gt 0 ] && append args "$value"
|
||||
}
|
||||
|
||||
append_switch() {
|
||||
local value="$1"
|
||||
local switch="$2"
|
||||
append args "$switch $value"
|
||||
}
|
||||
|
||||
append_parm() {
|
||||
|
@ -54,7 +46,7 @@ append_parm() {
|
|||
local _loctmp
|
||||
config_get _loctmp "$section" "$option"
|
||||
[ -z "$_loctmp" ] && return 0
|
||||
append buffer "$switch $_loctmp"
|
||||
append args "$switch $_loctmp"
|
||||
}
|
||||
|
||||
babel_filter() {
|
||||
|
@ -64,8 +56,9 @@ babel_filter() {
|
|||
local _ignored
|
||||
config_get_bool _ignored "$cfg" 'ignore' 0
|
||||
[ "$_ignored" -eq 1 ] && return 0
|
||||
|
||||
append args "-C '"
|
||||
|
||||
unset buffer
|
||||
append_parm "$cfg" 'type' ''
|
||||
|
||||
append_bool "$cfg" 'local' 'local'
|
||||
|
@ -74,10 +67,6 @@ babel_filter() {
|
|||
append_parm "$cfg" 'eq' 'eq'
|
||||
append_parm "$cfg" 'le' 'le'
|
||||
append_parm "$cfg" 'ge' 'ge'
|
||||
append_parm "$cfg" 'src_ip' 'src-ip'
|
||||
append_parm "$cfg" 'src_eq' 'src-eq'
|
||||
append_parm "$cfg" 'src_le' 'src-le'
|
||||
append_parm "$cfg" 'src_ge' 'src-ge'
|
||||
append_parm "$cfg" 'neigh' 'neigh'
|
||||
append_parm "$cfg" 'id' 'id'
|
||||
append_parm "$cfg" 'proto' 'proto'
|
||||
|
@ -86,121 +75,81 @@ babel_filter() {
|
|||
|
||||
append_parm "$cfg" 'action' ''
|
||||
|
||||
cfg_append "$buffer"
|
||||
append args ' ' "'"
|
||||
}
|
||||
|
||||
# Only one of babeld's options is allowed multiple times, "import-table".
|
||||
# We just append it multiple times.
|
||||
list_cb() {
|
||||
option_cb "$@"
|
||||
}
|
||||
|
||||
babel_config_cb() {
|
||||
local type="$1"
|
||||
local section="$2"
|
||||
case "$type" in
|
||||
"general")
|
||||
option_cb() {
|
||||
local option="$1"
|
||||
local value="$2"
|
||||
# Ignore options that are not supposed to be given to babeld
|
||||
[ "$option" = "conf_file" ] && return
|
||||
[ "$option" = "conf_dir" ] && return
|
||||
# Skip lists. They will be taken care of by list_cb
|
||||
test "${option#*_ITEM}" != "$option" && return
|
||||
test "${option#*_LENGTH}" != "$option" && return
|
||||
cfg_append "${option//_/-} $value"
|
||||
}
|
||||
;;
|
||||
"interface")
|
||||
local _ifname
|
||||
config_get _ifname "$section" 'ifname'
|
||||
# Try to resolve the logical interface name
|
||||
unset interface
|
||||
network_get_device interface "$_ifname" || interface="$_ifname"
|
||||
option_cb() {
|
||||
local option="$1"
|
||||
local value="$2"
|
||||
local _interface
|
||||
# "option ifname" is a special option, don't actually
|
||||
# generate configuration for it.
|
||||
[ "$option" = "ifname" ] && return
|
||||
[ -n "$interface" ] && _interface="interface $interface" || _interface="default"
|
||||
cfg_append "$_interface ${option//_/-} $value"
|
||||
}
|
||||
# Handle ignore options.
|
||||
local _ignored
|
||||
# This works because we loaded the whole configuration
|
||||
# beforehand (see config_load below).
|
||||
config_get_bool _ignored "$section" 'ignore' 0
|
||||
if [ "$_ignored" -eq 1 ]
|
||||
then
|
||||
option_cb() { return; }
|
||||
else
|
||||
# Also include an empty "interface $interface" statement,
|
||||
# so that babeld operates on this interface.
|
||||
[ -n "$interface" ] && cfg_append "interface $interface"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
# Don't use reset_cb, this would also reset config_cb
|
||||
option_cb() { return; }
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Support for conf_file and conf_dir
|
||||
babel_configpaths() {
|
||||
babel_addif() {
|
||||
local cfg="$1"
|
||||
local conf_file
|
||||
config_get conf_file "$cfg" "conf_file"
|
||||
[ -n "$conf_file" ] && OTHERCONFIGFILE="$conf_file"
|
||||
local conf_dir
|
||||
config_get conf_dir "$cfg" "conf_dir"
|
||||
[ -n "$conf_dir" ] && OTHERCONFIGDIR="$conf_dir"
|
||||
|
||||
local _ignored
|
||||
config_get_bool _ignored "$cfg" 'ignore' 0
|
||||
[ "$_ignored" -eq 1 ] && return 0
|
||||
|
||||
listen_ifname "$cfg" "-C 'interface"
|
||||
|
||||
append_parm "$cfg" 'wired' 'wired'
|
||||
append_parm "$cfg" 'link_quality' 'link-quality'
|
||||
append_parm "$cfg" 'split_horizon' 'split-horizon'
|
||||
append_parm "$cfg" 'rxcost' 'rxcost'
|
||||
append_parm "$cfg" 'hello_interval' 'hello-interval'
|
||||
append_parm "$cfg" 'update_interval' 'update-interval'
|
||||
append_parm "$cfg" 'enable_timestamps' 'enable-timestamps'
|
||||
append_parm "$cfg" 'max_rtt_penalty' 'max-rtt-penalty'
|
||||
append_parm "$cfg" 'rtt_decay' 'rtt-decay'
|
||||
append_parm "$cfg" 'rtt_min' 'rtt-min'
|
||||
append_parm "$cfg" 'rtt_max' 'rtt-max'
|
||||
|
||||
append args ' ' "'"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
babel_config() {
|
||||
local cfg="$1"
|
||||
|
||||
append_bool "$cfg" 'carrier_sense' '-l'
|
||||
append_bool "$cfg" 'assume_wireless' '-w'
|
||||
append_bool "$cfg" 'no_split_horizon' '-s'
|
||||
append_bool "$cfg" 'keep_unfeasible' '-u'
|
||||
append_bool "$cfg" 'random_router_id' '-r'
|
||||
|
||||
append_parm "$cfg" 'multicast_address' '-m'
|
||||
append_parm "$cfg" 'port' '-p'
|
||||
append_parm "$cfg" 'state_file' '-S'
|
||||
append_parm "$cfg" 'hello_interval' '-h'
|
||||
append_parm "$cfg" 'wired_hello_interval' '-H'
|
||||
append_parm "$cfg" 'diversity' '-z'
|
||||
append_parm "$cfg" 'smoothing_half_time' '-M'
|
||||
append_parm "$cfg" 'kernel_priority' '-k'
|
||||
append_parm "$cfg" 'duplication_priority' '-A'
|
||||
append_parm "$cfg" 'debug' '-d'
|
||||
append_parm "$cfg" 'local_server' '-g'
|
||||
append_parm "$cfg" 'export_table' '-t'
|
||||
config_list_foreach "$cfg" 'import_table' append_switch '-T'
|
||||
append_parm "$cfg" 'conf_file' '-c'
|
||||
append_parm "$cfg" 'log_file' '-L'
|
||||
}
|
||||
|
||||
start() {
|
||||
mkdir -p /var/lib
|
||||
mkdir -p /var/etc
|
||||
|
||||
# First load the whole config file, without callbacks, so that we are
|
||||
# aware of all "ignore" options in the second pass. This also allows
|
||||
# to load the configuration paths (conf_file and conf_dir).
|
||||
config_load babeld
|
||||
|
||||
# Configure alternative configuration file and directory
|
||||
config_foreach babel_configpaths "general"
|
||||
|
||||
# Start by emptying the generated config file
|
||||
>"$CONFIGFILE"
|
||||
# Import dynamic config files
|
||||
mkdir -p "$OTHERCONFIGDIR"
|
||||
for f in "$OTHERCONFIGDIR"/*.conf; do
|
||||
[ -f "$f" ] && cat "$f" >> "$CONFIGFILE"
|
||||
done
|
||||
|
||||
# Parse general and interface sections thanks to the "config_cb()"
|
||||
# callback. This allows to loop over all options without having to
|
||||
# know their name in advance.
|
||||
config_cb() { babel_config_cb "$@"; }
|
||||
config_load babeld
|
||||
# Parse filters separately, since we know which options we expect
|
||||
unset args
|
||||
unset interfaces
|
||||
config_foreach babel_config general
|
||||
config_foreach babel_addif interface
|
||||
config_foreach babel_filter filter
|
||||
procd_open_instance
|
||||
# Using multiple config files is supported since babeld 1.5.1
|
||||
procd_set_param command /usr/sbin/babeld -I "" -c "$OTHERCONFIGFILE" -c "$CONFIGFILE"
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_set_param file "$OTHERCONFIGFILE" "$OTHERCONFIGDIR"/*.conf "$CONFIGFILE"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
[ -z "$interfaces" ] && return 0
|
||||
eval "/usr/sbin/babeld -D -I $pidfile $args $interfaces"
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger babeld
|
||||
stop() {
|
||||
[ -f "$pidfile" ] && kill $(cat $pidfile)
|
||||
# avoid race-condition on restart: wait for
|
||||
# babeld to die for real.
|
||||
[ -f "$pidfile" ] && sleep 1
|
||||
[ -f "$pidfile" ] && sleep 1
|
||||
[ -f "$pidfile" ] && sleep 1
|
||||
[ -f "$pidfile" ] && exit 42
|
||||
}
|
||||
|
||||
status() {
|
||||
kill -USR1 $(pgrep -P 1 babeld)
|
||||
[ -f "$pidfile" ] && kill -USR1 $(cat $pidfile)
|
||||
}
|
||||
|
|
|
@ -1,132 +0,0 @@
|
|||
--- a/babeld.c
|
||||
+++ b/babeld.c
|
||||
@@ -54,6 +54,8 @@ THE SOFTWARE.
|
||||
#include "local.h"
|
||||
#include "version.h"
|
||||
|
||||
+#include "ubus.h"
|
||||
+
|
||||
struct timeval now;
|
||||
|
||||
unsigned char myid[8];
|
||||
@@ -505,6 +507,9 @@ main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
+ if(ubus_bindings)
|
||||
+ babeld_add_ubus();
|
||||
+
|
||||
init_signals();
|
||||
rc = resize_receive_buffer(1500);
|
||||
if(rc < 0)
|
||||
@@ -597,6 +602,8 @@ main(int argc, char **argv)
|
||||
FD_SET(local_sockets[i].fd, &readfds);
|
||||
maxfd = MAX(maxfd, local_sockets[i].fd);
|
||||
}
|
||||
+ if(ubus_bindings)
|
||||
+ maxfd = babeld_ubus_add_read_sock(&readfds, maxfd);
|
||||
rc = select(maxfd + 1, &readfds, NULL, NULL, &tv);
|
||||
if(rc < 0) {
|
||||
if(errno != EINTR) {
|
||||
@@ -665,6 +672,9 @@ main(int argc, char **argv)
|
||||
i++;
|
||||
}
|
||||
|
||||
+ if(ubus_bindings)
|
||||
+ babeld_ubus_receive(&readfds);
|
||||
+
|
||||
if(reopening) {
|
||||
kernel_dump_time = now.tv_sec;
|
||||
check_neighbours_timeout = now;
|
||||
--- a/generate-version.sh
|
||||
+++ b/generate-version.sh
|
||||
@@ -10,4 +10,4 @@ else
|
||||
version="unknown"
|
||||
fi
|
||||
|
||||
-echo "#define BABELD_VERSION \"$version\""
|
||||
+echo "#define BABELD_VERSION \"$version-ubus-mod\""
|
||||
--- a/configuration.c
|
||||
+++ b/configuration.c
|
||||
@@ -42,6 +42,8 @@ THE SOFTWARE.
|
||||
#include "hmac.h"
|
||||
#include "configuration.h"
|
||||
|
||||
+#include "ubus.h"
|
||||
+
|
||||
static struct filter *input_filters = NULL;
|
||||
static struct filter *output_filters = NULL;
|
||||
static struct filter *redistribute_filters = NULL;
|
||||
@@ -1024,7 +1026,8 @@ parse_option(int c, gnc_t gnc, void *clo
|
||||
strcmp(token, "daemonise") == 0 ||
|
||||
strcmp(token, "skip-kernel-setup") == 0 ||
|
||||
strcmp(token, "ipv6-subtrees") == 0 ||
|
||||
- strcmp(token, "reflect-kernel-metric") == 0) {
|
||||
+ strcmp(token, "reflect-kernel-metric") == 0 ||
|
||||
+ strcmp(token, "ubus-bindings") == 0) {
|
||||
int b;
|
||||
c = getbool(c, &b, gnc, closure);
|
||||
if(c < -1)
|
||||
@@ -1042,6 +1045,8 @@ parse_option(int c, gnc_t gnc, void *clo
|
||||
has_ipv6_subtrees = b;
|
||||
else if(strcmp(token, "reflect-kernel-metric") == 0)
|
||||
reflect_kernel_metric = b;
|
||||
+ else if(strcmp(token, "ubus-bindings") == 0)
|
||||
+ ubus_bindings = b;
|
||||
else
|
||||
abort();
|
||||
} else if(strcmp(token, "protocol-group") == 0) {
|
||||
--- a/local.c
|
||||
+++ b/local.c
|
||||
@@ -42,6 +42,8 @@ THE SOFTWARE.
|
||||
#include "local.h"
|
||||
#include "version.h"
|
||||
|
||||
+#include "ubus.h"
|
||||
+
|
||||
int local_server_socket = -1;
|
||||
struct local_socket local_sockets[MAX_LOCAL_SOCKETS];
|
||||
int num_local_sockets = 0;
|
||||
@@ -191,6 +193,8 @@ local_notify_neighbour(struct neighbour
|
||||
if(local_sockets[i].monitor)
|
||||
local_notify_neighbour_1(&local_sockets[i], neigh, kind);
|
||||
}
|
||||
+ if(ubus_bindings)
|
||||
+ ubus_notify_neighbour(neigh, kind);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -228,6 +232,8 @@ local_notify_xroute(struct xroute *xrout
|
||||
if(local_sockets[i].monitor)
|
||||
local_notify_xroute_1(&local_sockets[i], xroute, kind);
|
||||
}
|
||||
+ if(ubus_bindings)
|
||||
+ ubus_notify_xroute(xroute, kind);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -273,6 +279,8 @@ local_notify_route(struct babel_route *r
|
||||
if(local_sockets[i].monitor)
|
||||
local_notify_route_1(&local_sockets[i], route, kind);
|
||||
}
|
||||
+ if(ubus_bindings)
|
||||
+ ubus_notify_route(route, kind);
|
||||
}
|
||||
|
||||
static void
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -11,11 +11,11 @@ LDLIBS = -lrt
|
||||
|
||||
SRCS = babeld.c net.c kernel.c util.c interface.c source.c neighbour.c \
|
||||
route.c xroute.c message.c resend.c configuration.c local.c \
|
||||
- hmac.c rfc6234/sha224-256.c BLAKE2/ref/blake2s-ref.c
|
||||
+ hmac.c ubus.c rfc6234/sha224-256.c BLAKE2/ref/blake2s-ref.c
|
||||
|
||||
OBJS = babeld.o net.o kernel.o util.o interface.o source.o neighbour.o \
|
||||
route.o xroute.o message.o resend.o configuration.o local.o \
|
||||
- hmac.o rfc6234/sha224-256.o BLAKE2/ref/blake2s-ref.o
|
||||
+ hmac.o ubus.o rfc6234/sha224-256.o BLAKE2/ref/blake2s-ref.o
|
||||
|
||||
babeld: $(OBJS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o babeld $(OBJS) $(LDLIBS)
|
|
@ -1,535 +0,0 @@
|
|||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
#include <libubox/blob.h>
|
||||
#include <libubox/blobmsg.h>
|
||||
#include <libubox/list.h>
|
||||
#include <libubus.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "babeld.h"
|
||||
#include "configuration.h"
|
||||
#include "interface.h"
|
||||
#include "kernel.h"
|
||||
#include "local.h"
|
||||
#include "message.h"
|
||||
#include "neighbour.h"
|
||||
#include "net.h"
|
||||
#include "resend.h"
|
||||
#include "route.h"
|
||||
#include "source.h"
|
||||
#include "util.h"
|
||||
#include "version.h"
|
||||
#include "xroute.h"
|
||||
|
||||
#include "ubus.h"
|
||||
|
||||
// Definition of header variable whether to enable ubus bindings.
|
||||
int ubus_bindings = 0;
|
||||
|
||||
// Shared state maintained throughout calls to handle ubus messages.
|
||||
static struct ubus_context *shared_ctx;
|
||||
|
||||
// List of exported routes (to be used with ubox's list helpers).
|
||||
struct xroute_list_entry {
|
||||
struct list_head list;
|
||||
struct xroute *xroute;
|
||||
};
|
||||
|
||||
// List of received routes (to be used with ubox's list helpers).
|
||||
struct route_list_entry {
|
||||
struct list_head list;
|
||||
struct babel_route *route;
|
||||
};
|
||||
|
||||
// List of neighbours (to be used with ubox's list helpers).
|
||||
struct neighbour_list_entry {
|
||||
struct list_head list;
|
||||
struct neighbour *neighbour;
|
||||
};
|
||||
|
||||
// Definition of interface function enums (to be used with ubox's blobmsg
|
||||
// helpers).
|
||||
enum { INTERFACE_IFNAME, __INTERFACE_MAX };
|
||||
|
||||
// Definition of interface parsing (to be used with ubox's blobmsg helpers).
|
||||
static const struct blobmsg_policy interface_policy[__INTERFACE_MAX] = {
|
||||
[INTERFACE_IFNAME] = {"ifname", BLOBMSG_TYPE_STRING},
|
||||
};
|
||||
|
||||
// Definition of filter function enums (to be used with ubox's blobmsg
|
||||
// helpers).
|
||||
enum { FILTER_IFNAME, FILTER_TYPE, FILTER_METRIC, __FILTER_MAX };
|
||||
|
||||
// Definition of filter parsing (to be used with ubox's blobmsg helpers).
|
||||
static const struct blobmsg_policy filter_policy[__FILTER_MAX] = {
|
||||
[FILTER_IFNAME] = {"ifname", BLOBMSG_TYPE_STRING},
|
||||
[FILTER_TYPE] = {"type", BLOBMSG_TYPE_INT32},
|
||||
[FILTER_METRIC] = {"metric", BLOBMSG_TYPE_INT32},
|
||||
};
|
||||
|
||||
// Adds a filter (ubus equivalent to "filter"-function).
|
||||
static int babeld_ubus_add_filter(struct ubus_context *ctx_local,
|
||||
struct ubus_object *obj,
|
||||
struct ubus_request_data *req,
|
||||
const char *method, struct blob_attr *msg) {
|
||||
struct blob_attr *tb[__FILTER_MAX];
|
||||
struct blob_buf b = {0};
|
||||
struct filter *filter = NULL;
|
||||
char *ifname;
|
||||
int metric, type;
|
||||
|
||||
blobmsg_parse(filter_policy, __FILTER_MAX, tb, blob_data(msg), blob_len(msg));
|
||||
|
||||
if (!tb[FILTER_IFNAME])
|
||||
return UBUS_STATUS_INVALID_ARGUMENT;
|
||||
|
||||
if (!tb[FILTER_TYPE])
|
||||
return UBUS_STATUS_INVALID_ARGUMENT;
|
||||
|
||||
type = blobmsg_get_u32(tb[FILTER_TYPE]);
|
||||
|
||||
if (tb[FILTER_METRIC])
|
||||
metric = blobmsg_get_u32(tb[FILTER_METRIC]);
|
||||
|
||||
filter = calloc(1, sizeof(struct filter));
|
||||
if (filter == NULL)
|
||||
return UBUS_STATUS_UNKNOWN_ERROR;
|
||||
|
||||
filter->af = AF_INET6;
|
||||
filter->proto = 0;
|
||||
filter->plen_le = 128;
|
||||
filter->src_plen_le = 128;
|
||||
filter->action.add_metric = metric;
|
||||
|
||||
ifname = blobmsg_get_string(tb[FILTER_IFNAME]);
|
||||
filter->ifname = strdup(ifname);
|
||||
filter->ifindex = if_nametoindex(filter->ifname);
|
||||
|
||||
add_filter(filter, type);
|
||||
|
||||
return UBUS_STATUS_OK;
|
||||
}
|
||||
|
||||
// Adds an inteface (ubus equivalent to "interface"-function).
|
||||
static int babeld_ubus_add_interface(struct ubus_context *ctx_local,
|
||||
struct ubus_object *obj,
|
||||
struct ubus_request_data *req,
|
||||
const char *method,
|
||||
struct blob_attr *msg) {
|
||||
struct blob_attr *tb[__INTERFACE_MAX];
|
||||
struct blob_buf b = {0};
|
||||
struct interface *ifp = NULL;
|
||||
char *ifname;
|
||||
|
||||
blobmsg_parse(interface_policy, __INTERFACE_MAX, tb, blob_data(msg),
|
||||
blob_len(msg));
|
||||
|
||||
if (!tb[INTERFACE_IFNAME])
|
||||
return UBUS_STATUS_INVALID_ARGUMENT;
|
||||
|
||||
ifname = blobmsg_get_string(tb[INTERFACE_IFNAME]);
|
||||
|
||||
ifp = add_interface(ifname, NULL);
|
||||
if (ifp == NULL)
|
||||
return UBUS_STATUS_UNKNOWN_ERROR;
|
||||
|
||||
return UBUS_STATUS_OK;
|
||||
}
|
||||
|
||||
// Sends a babel info message on ubus socket.
|
||||
static int babeld_ubus_babeld_info(struct ubus_context *ctx_local,
|
||||
struct ubus_object *obj,
|
||||
struct ubus_request_data *req,
|
||||
const char *method, struct blob_attr *msg) {
|
||||
struct blob_buf b = {0};
|
||||
void *prefix;
|
||||
char host[64];
|
||||
int ret;
|
||||
|
||||
blob_buf_init(&b, 0);
|
||||
blobmsg_add_string(&b, "babeld-version", BABELD_VERSION);
|
||||
blobmsg_add_string(&b, "my-id", format_eui64(myid));
|
||||
if (!gethostname(host, sizeof(host)))
|
||||
blobmsg_add_string(&b, "host", host);
|
||||
|
||||
ret = ubus_send_reply(ctx_local, req, b.head);
|
||||
if (ret)
|
||||
fprintf(stderr, "Failed to send reply: %s\n", ubus_strerror(ret));
|
||||
|
||||
blob_buf_free(&b);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Appends an exported route message entry to the buffer.
|
||||
static void babeld_add_xroute_buf(struct xroute *xroute, struct blob_buf *b) {
|
||||
void *prefix;
|
||||
|
||||
prefix = blobmsg_open_table(b, format_prefix(xroute->prefix, xroute->plen));
|
||||
|
||||
blobmsg_add_string(b, "src-prefix",
|
||||
format_prefix(xroute->src_prefix, xroute->src_plen));
|
||||
blobmsg_add_u32(b, "metric", xroute->metric);
|
||||
blobmsg_close_table(b, prefix);
|
||||
}
|
||||
|
||||
// Sends an exported routes message on ubus socket, splitting apart IPv4 and
|
||||
// IPv6 routes.
|
||||
static int babeld_ubus_get_xroutes(struct ubus_context *ctx_local,
|
||||
struct ubus_object *obj,
|
||||
struct ubus_request_data *req,
|
||||
const char *method, struct blob_attr *msg) {
|
||||
struct blob_buf b = {0};
|
||||
struct xroute_stream *xroutes;
|
||||
struct xroute_list_entry *cur, *tmp;
|
||||
void *ipv4, *ipv6;
|
||||
int ret;
|
||||
LIST_HEAD(xroute_ipv4_list);
|
||||
LIST_HEAD(xroute_ipv6_list);
|
||||
|
||||
blob_buf_init(&b, 0);
|
||||
|
||||
xroutes = xroute_stream();
|
||||
if (xroutes) {
|
||||
while (1) {
|
||||
struct xroute *xroute = xroute_stream_next(xroutes);
|
||||
if (xroute == NULL)
|
||||
break;
|
||||
|
||||
struct xroute_list_entry *xr =
|
||||
calloc(1, sizeof(struct xroute_list_entry));
|
||||
xr->xroute = xroute;
|
||||
|
||||
if (v4mapped(xroute->prefix)) {
|
||||
list_add(&xr->list, &xroute_ipv4_list);
|
||||
} else {
|
||||
list_add(&xr->list, &xroute_ipv6_list);
|
||||
}
|
||||
}
|
||||
xroute_stream_done(xroutes);
|
||||
}
|
||||
|
||||
ipv4 = blobmsg_open_table(&b, "IPv4");
|
||||
list_for_each_entry_safe(cur, tmp, &xroute_ipv4_list, list) {
|
||||
babeld_add_xroute_buf(cur->xroute, &b);
|
||||
list_del(&cur->list);
|
||||
free(cur);
|
||||
}
|
||||
blobmsg_close_table(&b, ipv4);
|
||||
|
||||
ipv6 = blobmsg_open_table(&b, "IPv6");
|
||||
list_for_each_entry_safe(cur, tmp, &xroute_ipv6_list, list) {
|
||||
babeld_add_xroute_buf(cur->xroute, &b);
|
||||
list_del(&cur->list);
|
||||
free(cur);
|
||||
}
|
||||
blobmsg_close_table(&b, ipv6);
|
||||
|
||||
ret = ubus_send_reply(ctx_local, req, b.head);
|
||||
if (ret)
|
||||
fprintf(stderr, "Failed to send reply: %s\n", ubus_strerror(ret));
|
||||
|
||||
blob_buf_free(&b);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Appends an route message entry to the buffer.
|
||||
static void babeld_add_route_buf(struct babel_route *route,
|
||||
struct blob_buf *b) {
|
||||
void *prefix;
|
||||
|
||||
prefix = blobmsg_open_table(
|
||||
b, format_prefix(route->src->prefix, route->src->plen));
|
||||
|
||||
blobmsg_add_string(
|
||||
b, "src-prefix",
|
||||
format_prefix(route->src->src_prefix, route->src->src_plen));
|
||||
blobmsg_add_u32(b, "route_metric", route_metric(route));
|
||||
blobmsg_add_u32(b, "route_smoothed_metric", route_smoothed_metric(route));
|
||||
blobmsg_add_u32(b, "refmetric", route->refmetric);
|
||||
blobmsg_add_string(b, "id", format_eui64(route->src->id));
|
||||
blobmsg_add_u32(b, "seqno", (uint32_t)route->seqno);
|
||||
blobmsg_add_u32(b, "age", (int)(now.tv_sec - route->time));
|
||||
blobmsg_add_string(b, "via", format_address(route->neigh->address));
|
||||
if (memcmp(route->nexthop, route->neigh->address, 16) != 0)
|
||||
blobmsg_add_string(b, "nexthop", format_address(route->nexthop));
|
||||
|
||||
blobmsg_add_u8(b, "installed", route->installed);
|
||||
blobmsg_add_u8(b, "feasible", route_feasible(route));
|
||||
|
||||
blobmsg_close_table(b, prefix);
|
||||
}
|
||||
|
||||
// Sends received routes message on ubus socket, splitting apart IPv4 and IPv6
|
||||
// routes.
|
||||
static int babeld_ubus_get_routes(struct ubus_context *ctx_local,
|
||||
struct ubus_object *obj,
|
||||
struct ubus_request_data *req,
|
||||
const char *method, struct blob_attr *msg) {
|
||||
struct blob_buf b = {0};
|
||||
struct route_stream *routes;
|
||||
struct route_list_entry *cur, *tmp;
|
||||
void *prefix, *ipv4, *ipv6;
|
||||
int ret;
|
||||
LIST_HEAD(route_ipv4_list);
|
||||
LIST_HEAD(route_ipv6_list);
|
||||
|
||||
blob_buf_init(&b, 0);
|
||||
|
||||
routes = route_stream(0);
|
||||
if (routes) {
|
||||
while (1) {
|
||||
struct babel_route *route = route_stream_next(routes);
|
||||
if (route == NULL)
|
||||
break;
|
||||
struct route_list_entry *r = calloc(1, sizeof(struct route_list_entry));
|
||||
r->route = route;
|
||||
|
||||
if (v4mapped(route->src->prefix)) {
|
||||
list_add(&r->list, &route_ipv4_list);
|
||||
} else {
|
||||
list_add(&r->list, &route_ipv6_list);
|
||||
}
|
||||
}
|
||||
route_stream_done(routes);
|
||||
}
|
||||
|
||||
ipv4 = blobmsg_open_table(&b, "IPv4");
|
||||
list_for_each_entry_safe(cur, tmp, &route_ipv4_list, list) {
|
||||
babeld_add_route_buf(cur->route, &b);
|
||||
list_del(&cur->list);
|
||||
free(cur);
|
||||
}
|
||||
blobmsg_close_table(&b, ipv4);
|
||||
|
||||
ipv6 = blobmsg_open_table(&b, "IPv6");
|
||||
list_for_each_entry_safe(cur, tmp, &route_ipv6_list, list) {
|
||||
babeld_add_route_buf(cur->route, &b);
|
||||
list_del(&cur->list);
|
||||
free(cur);
|
||||
}
|
||||
blobmsg_close_table(&b, ipv6);
|
||||
|
||||
ret = ubus_send_reply(ctx_local, req, b.head);
|
||||
if (ret)
|
||||
fprintf(stderr, "Failed to send reply: %s\n", ubus_strerror(ret));
|
||||
|
||||
blob_buf_free(&b);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Appends an neighbour entry to the buffer.
|
||||
static void babeld_add_neighbour_buf(struct neighbour *neigh,
|
||||
struct blob_buf *b) {
|
||||
void *neighbour;
|
||||
|
||||
neighbour = blobmsg_open_table(b, format_address(neigh->address));
|
||||
blobmsg_add_string(b, "dev", neigh->ifp->name);
|
||||
blobmsg_add_u32(b, "hello-reach", neigh->hello.reach);
|
||||
blobmsg_add_u32(b, "uhello-reach", neigh->uhello.reach);
|
||||
blobmsg_add_u32(b, "rxcost", neighbour_rxcost(neigh));
|
||||
blobmsg_add_u32(b, "txcost", neigh->txcost);
|
||||
blobmsg_add_string(b, "rtt", format_thousands(neigh->rtt));
|
||||
blobmsg_add_u8(b, "if_up", if_up(neigh->ifp));
|
||||
blobmsg_close_table(b, neighbour);
|
||||
}
|
||||
|
||||
// Sends neighbours message on ubus socket, splitting apart IPv4 and IPv6
|
||||
// neighbours.
|
||||
static int babeld_ubus_get_neighbours(struct ubus_context *ctx_local,
|
||||
struct ubus_object *obj,
|
||||
struct ubus_request_data *req,
|
||||
const char *method,
|
||||
struct blob_attr *msg) {
|
||||
struct blob_buf b = {0};
|
||||
struct neighbour *neigh;
|
||||
struct neighbour_list_entry *cur, *tmp;
|
||||
void *ipv4, *ipv6;
|
||||
int ret;
|
||||
LIST_HEAD(neighbour_ipv4_list);
|
||||
LIST_HEAD(neighbour_ipv6_list);
|
||||
|
||||
blob_buf_init(&b, 0);
|
||||
|
||||
FOR_ALL_NEIGHBOURS(neigh) {
|
||||
struct neighbour_list_entry *n =
|
||||
calloc(1, sizeof(struct neighbour_list_entry));
|
||||
n->neighbour = neigh;
|
||||
if (v4mapped(neigh->address)) {
|
||||
list_add(&n->list, &neighbour_ipv4_list);
|
||||
} else {
|
||||
list_add(&n->list, &neighbour_ipv6_list);
|
||||
}
|
||||
}
|
||||
|
||||
ipv4 = blobmsg_open_table(&b, "IPv4");
|
||||
list_for_each_entry_safe(cur, tmp, &neighbour_ipv4_list, list) {
|
||||
babeld_add_neighbour_buf(cur->neighbour, &b);
|
||||
list_del(&cur->list);
|
||||
free(cur);
|
||||
}
|
||||
blobmsg_close_table(&b, ipv4);
|
||||
|
||||
ipv6 = blobmsg_open_table(&b, "IPv6");
|
||||
list_for_each_entry_safe(cur, tmp, &neighbour_ipv6_list, list) {
|
||||
babeld_add_neighbour_buf(cur->neighbour, &b);
|
||||
list_del(&cur->list);
|
||||
free(cur);
|
||||
}
|
||||
blobmsg_close_table(&b, ipv6);
|
||||
|
||||
ret = ubus_send_reply(ctx_local, req, b.head);
|
||||
if (ret)
|
||||
fprintf(stderr, "Failed to send reply: %s\n", ubus_strerror(ret));
|
||||
|
||||
blob_buf_free(&b);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// List of functions we expose via the ubus bus.
|
||||
static const struct ubus_method babeld_methods[] = {
|
||||
UBUS_METHOD("add_interface", babeld_ubus_add_interface, interface_policy),
|
||||
UBUS_METHOD("add_filter", babeld_ubus_add_filter, filter_policy),
|
||||
UBUS_METHOD_NOARG("get_info", babeld_ubus_babeld_info),
|
||||
UBUS_METHOD_NOARG("get_xroutes", babeld_ubus_get_xroutes),
|
||||
UBUS_METHOD_NOARG("get_routes", babeld_ubus_get_routes),
|
||||
UBUS_METHOD_NOARG("get_neighbours", babeld_ubus_get_neighbours),
|
||||
};
|
||||
|
||||
// Definition of the ubus object type.
|
||||
static struct ubus_object_type babeld_object_type =
|
||||
UBUS_OBJECT_TYPE("babeld", babeld_methods);
|
||||
|
||||
// Object we announce via the ubus bus.
|
||||
static struct ubus_object babeld_object = {
|
||||
.name = "babeld",
|
||||
.type = &babeld_object_type,
|
||||
.methods = babeld_methods,
|
||||
.n_methods = ARRAY_SIZE(babeld_methods),
|
||||
};
|
||||
|
||||
// Registers handlers for babel methods in the global ubus context.
|
||||
static bool ubus_init_object() {
|
||||
int ret;
|
||||
|
||||
ret = ubus_add_object(shared_ctx, &babeld_object);
|
||||
if (ret) {
|
||||
fprintf(stderr, "Failed to add object: %s\n", ubus_strerror(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Initializes the global ubus context, connecting to the bus to be able to
|
||||
// receive and send messages.
|
||||
static bool babeld_ubus_init(void) {
|
||||
if (shared_ctx)
|
||||
return true;
|
||||
|
||||
shared_ctx = ubus_connect(NULL);
|
||||
if (!shared_ctx)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ubus_notify_route(struct babel_route *route, int kind) {
|
||||
struct blob_buf b = {0};
|
||||
char method[50]; // possible methods are route.change, route.add, route.flush
|
||||
|
||||
if (!babeld_object.has_subscribers)
|
||||
return;
|
||||
|
||||
if (!route)
|
||||
return;
|
||||
|
||||
if (!shared_ctx)
|
||||
return;
|
||||
|
||||
blob_buf_init(&b, 0);
|
||||
babeld_add_route_buf(route, &b);
|
||||
snprintf(method, sizeof(method), "route.%s", local_kind(kind));
|
||||
ubus_notify(shared_ctx, &babeld_object, method, b.head, -1);
|
||||
blob_buf_free(&b);
|
||||
}
|
||||
|
||||
void ubus_notify_xroute(struct xroute *xroute, int kind) {
|
||||
struct blob_buf b = {0};
|
||||
char method[50]; // possible methods are xroute.change, xroute.add,
|
||||
// xroute.flush
|
||||
|
||||
if (!babeld_object.has_subscribers)
|
||||
return;
|
||||
|
||||
if (!xroute)
|
||||
return;
|
||||
|
||||
if (!shared_ctx)
|
||||
return;
|
||||
|
||||
blob_buf_init(&b, 0);
|
||||
babeld_add_xroute_buf(xroute, &b);
|
||||
snprintf(method, sizeof(method), "xroute.%s", local_kind(kind));
|
||||
ubus_notify(shared_ctx, &babeld_object, method, b.head, -1);
|
||||
blob_buf_free(&b);
|
||||
}
|
||||
|
||||
void ubus_notify_neighbour(struct neighbour *neigh, int kind) {
|
||||
struct blob_buf b = {0};
|
||||
char method[50]; // possible methods are neigh.change, neigh.add, neigh.flush
|
||||
|
||||
if (!babeld_object.has_subscribers)
|
||||
return;
|
||||
|
||||
if (!neigh)
|
||||
return;
|
||||
|
||||
if (!shared_ctx)
|
||||
return;
|
||||
|
||||
blob_buf_init(&b, 0);
|
||||
babeld_add_neighbour_buf(neigh, &b);
|
||||
snprintf(method, sizeof(method), "neigh.%s", local_kind(kind));
|
||||
ubus_notify(shared_ctx, &babeld_object, method, b.head, -1);
|
||||
blob_buf_free(&b);
|
||||
}
|
||||
|
||||
void babeld_ubus_receive(fd_set *readfds) {
|
||||
if (!shared_ctx)
|
||||
return;
|
||||
if (FD_ISSET(shared_ctx->sock.fd, readfds))
|
||||
ubus_handle_event(shared_ctx);
|
||||
}
|
||||
|
||||
int babeld_ubus_add_read_sock(fd_set *readfds, int maxfd) {
|
||||
if (!shared_ctx)
|
||||
return maxfd;
|
||||
|
||||
FD_SET(shared_ctx->sock.fd, readfds);
|
||||
return MAX(maxfd, shared_ctx->sock.fd);
|
||||
}
|
||||
|
||||
bool babeld_add_ubus() {
|
||||
if (!babeld_ubus_init()) {
|
||||
fprintf(stderr, "Failed to initialize ubus!\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ubus_init_object()) {
|
||||
fprintf(stderr, "Failed to add objects to ubus!\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
/*
|
||||
IPC integration of babeld with OpenWrt.
|
||||
|
||||
The ubus interface offers following functions:
|
||||
- add_filter '{"ifname":"eth0", "type":0, "metric":5000}'
|
||||
type:
|
||||
0: FILTER_TYPE_INPUT
|
||||
1: FILTER_TYPE_OUTPUT
|
||||
2: FILTER_TYPE_REDISTRIBUTE
|
||||
3: FILTER_TYPE_INSTALL
|
||||
- add_interface '{"ifname":"eth0"}'
|
||||
- get_info
|
||||
- get_neighbours
|
||||
- get_xroutes
|
||||
- get_routes
|
||||
|
||||
All output is divided into IPv4 and IPv6.
|
||||
|
||||
Ubus notifications are sent if we receive updates for
|
||||
- xroutes
|
||||
- routes
|
||||
- neighbours
|
||||
|
||||
The format is:
|
||||
- {route,xroute,neighbour}.add: Object was added
|
||||
- {route,xroute,neighbour}.change: Object was changed
|
||||
- {route,xroute,neighbour}.flush: Object was flushed
|
||||
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
struct babel_route;
|
||||
struct neighbour;
|
||||
struct xroute;
|
||||
|
||||
// Whether to enable ubus bindings (boolean option).
|
||||
extern int ubus_bindings;
|
||||
|
||||
/**
|
||||
* Initialize ubus interface.
|
||||
*
|
||||
* Connect to the ubus daemon and expose the ubus functions.
|
||||
*
|
||||
* @return if initializing ubus was successful
|
||||
*/
|
||||
bool babeld_add_ubus();
|
||||
|
||||
/**
|
||||
* Add ubus socket to given filedescriptor set.
|
||||
*
|
||||
* We need to check repeatedly if the ubus socket has something to read.
|
||||
* The functions allows to add the ubus socket to the normal while(1)-loop of
|
||||
* babeld.
|
||||
*
|
||||
* @param readfs: the filedescriptor set
|
||||
* @param maxfd: the current maximum file descriptor
|
||||
* @return the maximum file descriptor
|
||||
*/
|
||||
int babeld_ubus_add_read_sock(fd_set *readfds, int maxfd);
|
||||
|
||||
/**
|
||||
* Check and process ubus socket.
|
||||
*
|
||||
* If the ubus-socket signals that data is available, the ubus_handle_event is
|
||||
* called.
|
||||
*/
|
||||
void babeld_ubus_receive(fd_set *readfds);
|
||||
|
||||
/***
|
||||
* Notify the ubus bus that a new xroute is received.
|
||||
*
|
||||
* If a new xroute is received or changed, we will notify subscribers.
|
||||
*
|
||||
* @param xroute: xroute that experienced some change
|
||||
* @param kind: kind that describes if we have a flush, add or change
|
||||
*/
|
||||
void ubus_notify_xroute(struct xroute *xroute, int kind);
|
||||
|
||||
/***
|
||||
* Notify the ubus bus that a new route is received.
|
||||
*
|
||||
* If a new route is received or changed, we will notify subscribers.
|
||||
*
|
||||
* @param route: route that experienced some change
|
||||
* @param kind: kind that describes if we have a flush, add or change
|
||||
*/
|
||||
void ubus_notify_route(struct babel_route *route, int kind);
|
||||
|
||||
/***
|
||||
* Notify the ubus bus that a new neighbour is received.
|
||||
*
|
||||
* If a new neighbour is received or changed, we will notify subscribers.
|
||||
*
|
||||
* @param neigh: neighbour that experienced some change
|
||||
* @param kind: kind that describes if we have a flush, add or change
|
||||
*/
|
||||
void ubus_notify_neighbour(struct neighbour *neigh, int kind);
|
248
batctl/Makefile
248
batctl/Makefile
|
@ -1,248 +0,0 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=batctl
|
||||
PKG_VERSION:=2024.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
|
||||
PKG_HASH:=76853e87201af63c411db152fd0c625a729a9733115897d1331604e2c5a67c7d
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_MAINTAINER:=Simon Wunderlich <sw@simonwunderlich.de>
|
||||
PKG_LICENSE:=GPL-2.0-only ISC MIT
|
||||
PKG_LICENSE_FILES:=LICENSES/preferred/GPL-2.0 LICENSES/preferred/MIT LICENSES/deprecated/ISC
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_BUILD_FLAGS:=gc-sections lto
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/batctl/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
URL:=https://www.open-mesh.org/
|
||||
DEPENDS:=+libnl-tiny +libc +librt
|
||||
PROVIDES:=batctl
|
||||
endef
|
||||
|
||||
define Package/batctl/description
|
||||
batctl is a more intuitive managment utility for B.A.T.M.A.N.-Advanced.
|
||||
It is an easier method for configuring batman-adv and provides some
|
||||
additional tools for debugging as well. This package builds
|
||||
version $(PKG_VERSION) of the user space utility.
|
||||
endef
|
||||
|
||||
define Package/batctl-tiny
|
||||
$(call Package/batctl/Default)
|
||||
TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Minimal)
|
||||
VARIANT:=tiny
|
||||
ALTERNATIVES:=100:/usr/sbin/batctl:/usr/libexec/batctl-tiny
|
||||
endef
|
||||
|
||||
define Package/batctl-tiny/description
|
||||
$(Package/batctl/description)
|
||||
Only configuration relevant subcommands are enabled.
|
||||
endef
|
||||
|
||||
define Package/batctl-default
|
||||
$(call Package/batctl/Default)
|
||||
TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Default)
|
||||
VARIANT:=default
|
||||
ALTERNATIVES:=200:/usr/sbin/batctl:/usr/libexec/batctl-default
|
||||
endef
|
||||
|
||||
define Package/batctl-default/description
|
||||
$(Package/batctl/description)
|
||||
Standard subcommands for configuration and online debugging are enabled.
|
||||
endef
|
||||
|
||||
define Package/batctl-full
|
||||
$(call Package/batctl/Default)
|
||||
TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Full)
|
||||
VARIANT:=full
|
||||
ALTERNATIVES:=300:/usr/sbin/batctl:/usr/libexec/batctl-full
|
||||
endef
|
||||
|
||||
define Package/batctl-full/description
|
||||
$(Package/batctl/description)
|
||||
Subcommands for configuration, online and offline debugging are enabled.
|
||||
endef
|
||||
|
||||
MAKE_VARS += \
|
||||
LIBNL_NAME="libnl-tiny" \
|
||||
LIBNL_GENL_NAME="libnl-tiny"
|
||||
|
||||
MAKE_FLAGS += \
|
||||
REVISION="$(PKG_VERSION)-openwrt-$(PKG_RELEASE)"
|
||||
|
||||
config-n := \
|
||||
aggregation \
|
||||
ap_isolation \
|
||||
backbonetable \
|
||||
bisect_iv \
|
||||
bonding \
|
||||
bla_backbone_json \
|
||||
bla_claim_json \
|
||||
bridge_loop_avoidance \
|
||||
claimtable \
|
||||
dat_cache \
|
||||
dat_cache_json \
|
||||
distributed_arp_table \
|
||||
elp_interval \
|
||||
event \
|
||||
fragmentation \
|
||||
gateways \
|
||||
gateways_json \
|
||||
gw_mode \
|
||||
hardif_json \
|
||||
hardifs_json \
|
||||
hop_penalty \
|
||||
interface \
|
||||
isolation_mark \
|
||||
loglevel \
|
||||
mcast_flags \
|
||||
mcast_flags_json \
|
||||
mesh_json \
|
||||
multicast_fanout \
|
||||
multicast_forceflood \
|
||||
multicast_mode \
|
||||
neighbors \
|
||||
neighbors_json \
|
||||
network_coding \
|
||||
orig_interval \
|
||||
originators \
|
||||
originators_json \
|
||||
ping \
|
||||
routing_algo \
|
||||
statistics \
|
||||
tcpdump \
|
||||
throughput_override \
|
||||
throughputmeter \
|
||||
traceroute \
|
||||
transglobal \
|
||||
translate \
|
||||
translocal \
|
||||
transtable_global_json \
|
||||
transtable_local_json \
|
||||
vlan_json \
|
||||
|
||||
config-settings := \
|
||||
aggregation \
|
||||
ap_isolation \
|
||||
bonding \
|
||||
bridge_loop_avoidance \
|
||||
distributed_arp_table \
|
||||
elp_interval \
|
||||
fragmentation \
|
||||
gw_mode \
|
||||
hop_penalty \
|
||||
interface \
|
||||
isolation_mark \
|
||||
loglevel \
|
||||
multicast_fanout \
|
||||
multicast_forceflood \
|
||||
multicast_mode \
|
||||
network_coding \
|
||||
orig_interval \
|
||||
routing_algo \
|
||||
throughput_override \
|
||||
|
||||
config-tables := \
|
||||
backbonetable \
|
||||
claimtable \
|
||||
dat_cache \
|
||||
gateways \
|
||||
mcast_flags \
|
||||
neighbors \
|
||||
originators \
|
||||
statistics \
|
||||
transglobal \
|
||||
translocal \
|
||||
|
||||
config-json := \
|
||||
bla_backbone_json \
|
||||
bla_claim_json \
|
||||
dat_cache_json \
|
||||
gateways_json \
|
||||
hardif_json \
|
||||
hardifs_json \
|
||||
mcast_flags_json \
|
||||
mesh_json \
|
||||
neighbors_json \
|
||||
originators_json \
|
||||
transtable_global_json \
|
||||
transtable_local_json \
|
||||
vlan_json \
|
||||
|
||||
config-tools := \
|
||||
event \
|
||||
ping \
|
||||
tcpdump \
|
||||
throughputmeter \
|
||||
traceroute \
|
||||
translate \
|
||||
|
||||
config-extratools := \
|
||||
bisect_iv \
|
||||
|
||||
ifeq ($(BUILD_VARIANT),tiny)
|
||||
|
||||
config-y := \
|
||||
$(config-settings) \
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),default)
|
||||
|
||||
config-y := \
|
||||
$(config-settings) \
|
||||
$(config-tables) \
|
||||
$(config-json) \
|
||||
$(config-tools) \
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),full)
|
||||
|
||||
config-y := \
|
||||
$(config-settings) \
|
||||
$(config-tables) \
|
||||
$(config-json) \
|
||||
$(config-tools) \
|
||||
$(config-extratools) \
|
||||
|
||||
endif
|
||||
|
||||
define ConfigVars
|
||||
$(subst $(space),,$(foreach opt,$(config-$(1)),CONFIG_$(opt)=$(1)
|
||||
))
|
||||
endef
|
||||
|
||||
define batctl_config
|
||||
$(call ConfigVars,n)$(call ConfigVars,y)
|
||||
endef
|
||||
$(eval $(call shexport,batctl_config))
|
||||
|
||||
MAKE_FLAGS += $$$$$(call shvar,batctl_config)
|
||||
|
||||
define Package/batctl-tiny/install
|
||||
$(INSTALL_DIR) $(1)/usr/libexec
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-tiny
|
||||
endef
|
||||
|
||||
define Package/batctl-default/install
|
||||
$(INSTALL_DIR) $(1)/usr/libexec
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-default
|
||||
endef
|
||||
|
||||
define Package/batctl-full/install
|
||||
$(INSTALL_DIR) $(1)/usr/libexec
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-full
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,batctl-default))
|
||||
$(eval $(call BuildPackage,batctl-tiny))
|
||||
$(eval $(call BuildPackage,batctl-full))
|
|
@ -1,88 +1,29 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2007-2019 B.A.T.M.A.N. contributors:
|
||||
#
|
||||
# Marek Lindner, Simon Wunderlich
|
||||
|
||||
#
|
||||
# B.A.T.M.A.N meshing protocol
|
||||
#
|
||||
config KMOD_BATMAN_ADV_DEBUG_LOG
|
||||
bool "enable verbose debug logging"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
default n
|
||||
|
||||
config BATMAN_ADV_BATMAN_V
|
||||
bool "B.A.T.M.A.N. V protocol"
|
||||
config KMOD_BATMAN_ADV_BLA
|
||||
bool "enable bridge loop avoidance"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
default y
|
||||
|
||||
config KMOD_BATMAN_ADV_DAT
|
||||
bool "enable distributed arp table"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
default y
|
||||
|
||||
config KMOD_BATMAN_ADV_NC
|
||||
bool "enable network coding [requires promisc mode support]"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
default n
|
||||
|
||||
config KMOD_BATMAN_ADV_BATCTL
|
||||
bool "enable batctl"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
default y
|
||||
help
|
||||
This option enables the B.A.T.M.A.N. V protocol, the successor
|
||||
of the currently used B.A.T.M.A.N. IV protocol. The main
|
||||
changes include splitting of the OGM protocol into a neighbor
|
||||
discovery protocol (Echo Location Protocol, ELP) and a new OGM
|
||||
Protocol OGMv2 for flooding protocol information through the
|
||||
network, as well as a throughput based metric.
|
||||
B.A.T.M.A.N. V is currently considered experimental and not
|
||||
compatible to B.A.T.M.A.N. IV networks.
|
||||
|
||||
config BATMAN_ADV_BLA
|
||||
bool "Bridge Loop Avoidance"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
select PACKAGE_kmod-lib-crc16
|
||||
default y
|
||||
help
|
||||
This option enables BLA (Bridge Loop Avoidance), a mechanism
|
||||
to avoid Ethernet frames looping when mesh nodes are connected
|
||||
to both the same LAN and the same mesh. If you will never use
|
||||
more than one mesh node in the same LAN, you can safely remove
|
||||
this feature and save some space.
|
||||
|
||||
config BATMAN_ADV_DAT
|
||||
bool "Distributed ARP Table"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
default y
|
||||
help
|
||||
This option enables DAT (Distributed ARP Table), a DHT based
|
||||
mechanism that increases ARP reliability on sparse wireless
|
||||
mesh networks. If you think that your network does not need
|
||||
this option you can safely remove it and save some space.
|
||||
|
||||
config BATMAN_ADV_NC
|
||||
bool "Network Coding"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
help
|
||||
This option enables network coding, a mechanism that aims to
|
||||
increase the overall network throughput by fusing multiple
|
||||
packets in one transmission.
|
||||
Note that interfaces controlled by batman-adv must be manually
|
||||
configured to have promiscuous mode enabled in order to make
|
||||
network coding work.
|
||||
If you think that your network does not need this feature you
|
||||
can safely disable it and save some space.
|
||||
|
||||
config BATMAN_ADV_MCAST
|
||||
bool "Multicast optimisation"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
default y
|
||||
help
|
||||
This option enables the multicast optimisation which aims to
|
||||
reduce the air overhead while improving the reliability of
|
||||
multicast messages.
|
||||
|
||||
config BATMAN_ADV_DEBUG
|
||||
bool "B.A.T.M.A.N. debugging"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
help
|
||||
This is an option for use by developers; most people should
|
||||
say N here. This enables compilation of support for
|
||||
outputting debugging information to the debugfs log or tracing
|
||||
buffer. The output is controlled via the batadv netdev specific
|
||||
log_level setting.
|
||||
|
||||
config BATMAN_ADV_TRACING
|
||||
bool "B.A.T.M.A.N. tracing support"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
select KERNEL_FTRACE
|
||||
select KERNEL_ENABLE_DEFAULT_TRACERS
|
||||
help
|
||||
This is an option for use by developers; most people should
|
||||
say N here. Select this option to gather traces like the debug
|
||||
messages using the generic tracing infrastructure of the kernel.
|
||||
BATMAN_ADV_DEBUG must also be selected to get trace events for
|
||||
batadv_dbg.
|
||||
batctl is a more intuitive managment utility for B.A.T.M.A.N.-Advanced.
|
||||
It is an easier method for configuring batman-adv and
|
||||
provides some additional tools for debugging as well.
|
||||
|
|
|
@ -1,101 +1,142 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# $Id: Makefile 5624 2006-11-23 00:29:07Z nbd $
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=batman-adv
|
||||
PKG_VERSION:=2024.0
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_VERSION:=2013.4.0
|
||||
BATCTL_VERSION:=2013.4.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_MD5SUM:=6590caa324709289e3cb142273a5ff57
|
||||
BATCTL_MD5SUM:=42e269cc710bbc9a8fd17628201d4258
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
|
||||
PKG_HASH:=61110697b5799f646a2a82a4dcf97faed4bb12a7cc43bf4683d2c4de4f6b40e7
|
||||
PKG_EXTMOD_SUBDIRS:=net/batman-adv
|
||||
PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
|
||||
|
||||
PKG_MAINTAINER:=Simon Wunderlich <sw@simonwunderlich.de>
|
||||
PKG_LICENSE:=GPL-2.0-only MIT
|
||||
PKG_LICENSE_FILES:=LICENSES/preferred/GPL-2.0 LICENSES/preferred/MIT
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BATCTL_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/batctl-$(BATCTL_VERSION)
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
|
||||
|
||||
PKG_CONFIG_DEPENDS += \
|
||||
CONFIG_BATMAN_ADV_BATMAN_V \
|
||||
CONFIG_BATMAN_ADV_BLA \
|
||||
CONFIG_BATMAN_ADV_DAT \
|
||||
CONFIG_BATMAN_ADV_NC \
|
||||
CONFIG_BATMAN_ADV_MCAST \
|
||||
CONFIG_BATMAN_ADV_DEBUG \
|
||||
CONFIG_BATMAN_ADV_TRACING
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
define KernelPackage/batman-adv
|
||||
URL:=http://www.open-mesh.org/
|
||||
MAINTAINER:=Marek Lindner <lindner_marek@yahoo.de>
|
||||
SUBMENU:=Network Support
|
||||
DEPENDS:=+kmod-lib-crc16 +kmod-crypto-core +kmod-crypto-crc32c +kmod-lib-crc32c +libc
|
||||
TITLE:=B.A.T.M.A.N. Adv
|
||||
URL:=https://www.open-mesh.org/
|
||||
DEPENDS:=+BATMAN_ADV_BLA:kmod-lib-crc16 +kmod-lib-crc32c +kmod-cfg80211 +batctl
|
||||
FILES:=$(PKG_BUILD_DIR)/net/batman-adv/batman-adv.$(LINUX_KMOD_SUFFIX)
|
||||
AUTOLOAD:=$(call AutoProbe,batman-adv)
|
||||
FILES:=$(PKG_BUILD_DIR)/batman-adv.$(LINUX_KMOD_SUFFIX)
|
||||
AUTOLOAD:=$(call AutoLoad,50,batman-adv)
|
||||
endef
|
||||
|
||||
define KernelPackage/batman-adv/description
|
||||
B.A.T.M.A.N. (better approach to mobile ad-hoc networking) is
|
||||
a routing protocol for multi-hop ad-hoc mesh networks. The
|
||||
networks may be wired or wireless. See
|
||||
https://www.open-mesh.org/ for more information and user space
|
||||
tools. This package builds version $(PKG_VERSION) of the kernel
|
||||
module.
|
||||
B.A.T.M.A.N. advanced is a kernel module which allows to
|
||||
build layer 2 mesh networks. This package contains the
|
||||
version $(PKG_VERSION) of the kernel module plus its user space
|
||||
configuration & managerment tool batctl.
|
||||
endef
|
||||
|
||||
define KernelPackage/batman-adv/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Package/kmod-batman-adv/conffiles
|
||||
/etc/config/batman-adv
|
||||
MAKE_BATMAN_ADV_ARGS += \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
KERNELPATH="$(LINUX_DIR)" \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
PATH="$(TARGET_PATH)" \
|
||||
SUBDIRS="$(PKG_BUILD_DIR)" \
|
||||
PWD="$(PKG_BUILD_DIR)" \
|
||||
LINUX_VERSION="$(LINUX_VERSION)" \
|
||||
CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_KMOD_BATMAN_ADV_DEBUG_LOG),y,n) \
|
||||
CONFIG_BATMAN_ADV_BLA=$(if $(CONFIG_KMOD_BATMAN_ADV_BLA),y,n) \
|
||||
CONFIG_BATMAN_ADV_DAT=$(if $(CONFIG_KMOD_BATMAN_ADV_DAT),y,n) \
|
||||
CONFIG_BATMAN_ADV_NC=$(if $(CONFIG_KMOD_BATMAN_ADV_NC),y,n) \
|
||||
REVISION="" all
|
||||
|
||||
# The linker can identify unused sections of a binary when each symbol is stored
|
||||
# in a separate section. This mostly removes unused linker sections and reduces
|
||||
# the size by ~3% on mipsel.
|
||||
|
||||
TARGET_CFLAGS += -ffunction-sections -fdata-sections
|
||||
TARGET_LDFLAGS += -Wl,--gc-sections
|
||||
|
||||
# Link-time optimization allows to move parts of the optimization from the single
|
||||
# source file to the global source view. This is done by emitting the GIMPLE
|
||||
# representation in each object file and analyzing it again during the link step.
|
||||
|
||||
TARGET_CFLAGS += -flto
|
||||
TARGET_LDFLAGS += -fuse-linker-plugin
|
||||
|
||||
MAKE_BATCTL_ENV += \
|
||||
CPPFLAGS="$(TARGET_CPPFLAGS)" \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS)"
|
||||
|
||||
MAKE_BATCTL_ARGS += \
|
||||
REVISION="" \
|
||||
CC="$(TARGET_CC)" \
|
||||
DESTDIR="$(PKG_INSTALL_DIR)" \
|
||||
batctl install
|
||||
|
||||
ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),)
|
||||
define Download/batctl
|
||||
FILE:=batctl-$(BATCTL_VERSION).tar.gz
|
||||
URL:=$(PKG_SOURCE_URL)
|
||||
MD5SUM:=$(BATCTL_MD5SUM)
|
||||
endef
|
||||
$(eval $(call Download,batctl))
|
||||
|
||||
BATCTL_EXTRACT = tar xzf "$(DL_DIR)/batctl-$(BATCTL_VERSION).tar.gz" -C "$(BUILD_DIR)/$(PKG_NAME)"
|
||||
BATCTL_PATCH = $(call Build/DoPatch,"$(PKG_BATCTL_BUILD_DIR)","$(PATCH_DIR)","*batctl*")
|
||||
BATCTL_BUILD = $(MAKE_BATCTL_ENV) $(MAKE) -C $(PKG_BATCTL_BUILD_DIR) $(MAKE_BATCTL_ARGS)
|
||||
BATCTL_INSTALL = $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/sbin/batctl $(1)/usr/sbin/
|
||||
endif
|
||||
|
||||
KPATCH ?= $(PATCH)
|
||||
define Build/DoPatch
|
||||
@if [ -d "$(2)" ]; then \
|
||||
if [ "$$$$(ls $(2) | grep -Ec $(3))" -gt 0 ]; then \
|
||||
$(KPATCH) "$(1)" "$(2)" "$(3)"; \
|
||||
fi; \
|
||||
fi
|
||||
endef
|
||||
|
||||
PKG_EXTRA_KCONFIG:= \
|
||||
CONFIG_BATMAN_ADV=m \
|
||||
CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_BATMAN_ADV_DEBUG),y,n) \
|
||||
CONFIG_BATMAN_ADV_BLA=$(if $(CONFIG_BATMAN_ADV_BLA),y,n) \
|
||||
CONFIG_BATMAN_ADV_DAT=$(if $(CONFIG_BATMAN_ADV_DAT),y,n) \
|
||||
CONFIG_BATMAN_ADV_MCAST=$(if $(CONFIG_BATMAN_ADV_MCAST),y,n) \
|
||||
CONFIG_BATMAN_ADV_NC=$(if $(CONFIG_BATMAN_ADV_NC),y,n) \
|
||||
CONFIG_BATMAN_ADV_BATMAN_V=$(if $(CONFIG_BATMAN_ADV_BATMAN_V),y,n) \
|
||||
CONFIG_BATMAN_ADV_TRACING=$(if $(CONFIG_BATMAN_ADV_TRACING),y,n) \
|
||||
define Build/Patch
|
||||
$(call Build/DoPatch,"$(PKG_BUILD_DIR)","$(PATCH_DIR)","*batman*")
|
||||
$(BATCTL_EXTRACT)
|
||||
$(BATCTL_PATCH)
|
||||
endef
|
||||
|
||||
PKG_EXTRA_CFLAGS:= \
|
||||
$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(PKG_EXTRA_KCONFIG)))) \
|
||||
$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(PKG_EXTRA_KCONFIG)))) \
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
$(SED) '/#define _NET_BATMAN_ADV_MAIN_H_/a\#undef CONFIG_MODULE_STRIPPED' \
|
||||
$(PKG_BUILD_DIR)/main.h
|
||||
endef
|
||||
|
||||
NOSTDINC_FLAGS = \
|
||||
$(KERNEL_NOSTDINC_FLAGS) \
|
||||
-I$(PKG_BUILD_DIR)/net/batman-adv \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211-backport \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211 \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211/uapi \
|
||||
-I$(PKG_BUILD_DIR)/include/ \
|
||||
-include backport/autoconf.h \
|
||||
-include backport/backport.h \
|
||||
-include $(PKG_BUILD_DIR)/compat-hacks.h \
|
||||
-DBATADV_SOURCE_VERSION=\\\"$(PKG_VERSION)-openwrt-$(PKG_RELEASE)\\\"
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
M="$(PKG_BUILD_DIR)/net/batman-adv" \
|
||||
$(PKG_EXTRA_KCONFIG) \
|
||||
EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS)" \
|
||||
NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
|
||||
modules
|
||||
$(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATMAN_ADV_ARGS)
|
||||
$(BATCTL_BUILD)
|
||||
endef
|
||||
|
||||
define Build/Clean
|
||||
rm -rf $(BUILD_DIR)/$(PKG_NAME)/
|
||||
endef
|
||||
|
||||
define KernelPackage/batman-adv/install
|
||||
$(CP) ./files/. $(1)/
|
||||
$(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/net $(1)/etc/hotplug.d/iface $(1)/lib/batman-adv $(1)/usr/sbin $(1)/lib/netifd/proto
|
||||
$(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config
|
||||
$(INSTALL_DATA) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv
|
||||
$(INSTALL_BIN) ./files/etc/hotplug.d/net/99-batman-adv $(1)/etc/hotplug.d/net
|
||||
$(INSTALL_BIN) ./files/lib/netifd/proto/batadv.sh $(1)/lib/netifd/proto
|
||||
$(BATCTL_INSTALL)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,batman-adv))
|
||||
|
|
20
batman-adv/files/etc/config/batman-adv
Normal file
20
batman-adv/files/etc/config/batman-adv
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
config 'mesh' 'bat0'
|
||||
option 'aggregated_ogms'
|
||||
option 'ap_isolation'
|
||||
option 'bonding'
|
||||
option 'fragmentation'
|
||||
option 'gw_bandwidth'
|
||||
option 'gw_mode'
|
||||
option 'gw_sel_class'
|
||||
option 'log_level'
|
||||
option 'orig_interval'
|
||||
option 'vis_mode'
|
||||
option 'bridge_loop_avoidance'
|
||||
option 'distributed_arp_table'
|
||||
option 'network_coding'
|
||||
option 'hop_penalty'
|
||||
|
||||
# yet another batX instance
|
||||
# config 'mesh' 'bat5'
|
||||
# option 'interfaces' 'second_mesh'
|
12
batman-adv/files/etc/hotplug.d/net/99-batman-adv
Normal file
12
batman-adv/files/etc/hotplug.d/net/99-batman-adv
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /lib/batman-adv/config.sh
|
||||
|
||||
bat_load_module
|
||||
config_load batman-adv
|
||||
|
||||
case "$ACTION" in
|
||||
add)
|
||||
[ -d /sys/class/net/$INTERFACE/mesh/ ] && bat_config "$INTERFACE"
|
||||
;;
|
||||
esac
|
|
@ -1,97 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# This UCI-Defaults script will split the batadv proto network interfaces
|
||||
# in batadv_hardif and batadv proto. The configuration options from
|
||||
# /etc/config/batman-adv will be moved to the latter.
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
proto_batadv_to_batadv_hardif() {
|
||||
local section="$1"
|
||||
local proto
|
||||
local mesh
|
||||
local routing_algo
|
||||
|
||||
config_get proto "${section}" proto
|
||||
config_get mesh "${section}" mesh
|
||||
config_get routing_algo "${section}" routing_algo
|
||||
|
||||
if [ -z "$mesh" -o "${proto}" != "batadv" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
uci set network."${section}".proto="batadv_hardif"
|
||||
uci rename network."${section}".mesh="master"
|
||||
uci delete network."${section}".routing_algo
|
||||
|
||||
# create new section or adjust existing one
|
||||
uci set network."${mesh}"=interface
|
||||
uci set network."${mesh}".proto=batadv
|
||||
[ -n "${routing_algo}" ] && uci set network."${mesh}".routing_algo="${routing_algo}"
|
||||
}
|
||||
|
||||
mv_batadv_config_section() {
|
||||
local section="$1"
|
||||
local aggregated_ogms
|
||||
local ap_isolation
|
||||
local bonding
|
||||
local bridge_loop_avoidance
|
||||
local distributed_arp_table
|
||||
local fragmentation
|
||||
local gw_bandwidth
|
||||
local gw_mode
|
||||
local gw_sel_class
|
||||
local hop_penalty
|
||||
local isolation_mark
|
||||
local log_level
|
||||
local multicast_mode
|
||||
local network_coding
|
||||
local orig_interval
|
||||
|
||||
config_get aggregated_ogms "${section}" aggregated_ogms
|
||||
config_get ap_isolation "${section}" ap_isolation
|
||||
config_get bonding "${section}" bonding
|
||||
config_get bridge_loop_avoidance "${section}" bridge_loop_avoidance
|
||||
config_get distributed_arp_table "${section}" distributed_arp_table
|
||||
config_get fragmentation "${section}" fragmentation
|
||||
config_get gw_bandwidth "${section}" gw_bandwidth
|
||||
config_get gw_mode "${section}" gw_mode
|
||||
config_get gw_sel_class "${section}" gw_sel_class
|
||||
config_get hop_penalty "${section}" hop_penalty
|
||||
config_get isolation_mark "${section}" isolation_mark
|
||||
config_get log_level "${section}" log_level
|
||||
config_get multicast_mode "${section}" multicast_mode
|
||||
config_get network_coding "${section}" network_coding
|
||||
config_get orig_interval "${section}" orig_interval
|
||||
|
||||
# update section in case it exists
|
||||
[ -n "${aggregated_ogms}" ] && uci set network."${section}".aggregated_ogms="${aggregated_ogms}"
|
||||
[ -n "${ap_isolation}" ] && uci set network."${section}".ap_isolation="${ap_isolation}"
|
||||
[ -n "${bonding}" ] && uci set network."${section}".bonding="${bonding}"
|
||||
[ -n "${bridge_loop_avoidance}" ] && uci set network."${section}".bridge_loop_avoidance="${bridge_loop_avoidance}"
|
||||
[ -n "${distributed_arp_table}" ] && uci set network."${section}".distributed_arp_table="${distributed_arp_table}"
|
||||
[ -n "${fragmentation}" ] && uci set network."${section}".fragmentation="${fragmentation}"
|
||||
[ -n "${gw_bandwidth}" ] && uci set network."${section}".gw_bandwidth="${gw_bandwidth}"
|
||||
[ -n "${gw_mode}" ] && uci set network."${section}".gw_mode="${gw_mode}"
|
||||
[ -n "${gw_sel_class}" ] && uci set network."${section}".gw_sel_class="${gw_sel_class}"
|
||||
[ -n "${hop_penalty}" ] && uci set network."${section}".hop_penalty="${hop_penalty}"
|
||||
[ -n "${isolation_mark}" ] && uci set network."${section}".isolation_mark="${isolation_mark}"
|
||||
[ -n "${log_level}" ] && uci set network."${section}".log_level="${log_level}"
|
||||
[ -n "${multicast_mode}" ] && uci set network."${section}".multicast_mode="${multicast_mode}"
|
||||
[ -n "${network_coding}" ] && uci set network."${section}".network_coding="${network_coding}"
|
||||
[ -n "${orig_interval}" ] && uci set network."${section}".orig_interval="${orig_interval}"
|
||||
}
|
||||
|
||||
if [ -f /etc/config/batman-adv ]; then
|
||||
config_load network
|
||||
config_foreach proto_batadv_to_batadv_hardif 'interface'
|
||||
uci commit network
|
||||
|
||||
config_load batman-adv
|
||||
config_foreach mv_batadv_config_section 'mesh'
|
||||
uci commit network
|
||||
|
||||
rm -f /etc/config/batman-adv
|
||||
fi
|
||||
|
||||
exit 0
|
48
batman-adv/files/lib/batman-adv/config.sh
Normal file
48
batman-adv/files/lib/batman-adv/config.sh
Normal file
|
@ -0,0 +1,48 @@
|
|||
#!/bin/sh
|
||||
|
||||
bat_load_module()
|
||||
{
|
||||
[ -d "/sys/module/batman_adv/" ] && return
|
||||
|
||||
. /lib/functions.sh
|
||||
load_modules /etc/modules.d/*-crc16 /etc/modules.d/*-crypto* /etc/modules.d/*-lib-crc* /etc/modules.d/*-batman-adv*
|
||||
}
|
||||
|
||||
bat_config()
|
||||
{
|
||||
local mesh="$1"
|
||||
local aggregated_ogms ap_isolation bonding bridge_loop_avoidance distributed_arp_table fragmentation
|
||||
local gw_bandwidth gw_mode gw_sel_class hop_penalty network_coding log_level orig_interval vis_mode
|
||||
|
||||
config_get aggregated_ogms "$mesh" aggregated_ogms
|
||||
config_get ap_isolation "$mesh" ap_isolation
|
||||
config_get bonding "$mesh" bonding
|
||||
config_get bridge_loop_avoidance "$mesh" bridge_loop_avoidance
|
||||
config_get distributed_arp_table "$mesh" distributed_arp_table
|
||||
config_get fragmentation "$mesh" fragmentation
|
||||
config_get gw_bandwidth "$mesh" gw_bandwidth
|
||||
config_get gw_mode "$mesh" gw_mode
|
||||
config_get gw_sel_class "$mesh" gw_sel_class
|
||||
config_get hop_penalty "$mesh" hop_penalty
|
||||
config_get network_coding "$mesh" network_coding
|
||||
config_get log_level "$mesh" log_level
|
||||
config_get orig_interval "$mesh" orig_interval
|
||||
config_get vis_mode "$mesh" vis_mode
|
||||
|
||||
[ ! -f "/sys/class/net/$mesh/mesh/orig_interval" ] && echo "batman-adv mesh $mesh does not exist - check your interface configuration" && return 1
|
||||
|
||||
[ -n "$aggregate_ogms" ] && echo $aggregate_ogms > /sys/class/net/$mesh/mesh/aggregate_ogms
|
||||
[ -n "$ap_isolation" ] && echo $ap_isolation > /sys/class/net/$mesh/mesh/ap_isolation
|
||||
[ -n "$bonding" ] && echo $bonding > /sys/class/net/$mesh/mesh/bonding
|
||||
[ -n "$bridge_loop_avoidance" ] && echo $bridge_loop_avoidance > /sys/class/net/$mesh/mesh/bridge_loop_avoidance 2>&-
|
||||
[ -n "$distributed_arp_table" ] && echo $distributed_arp_table > /sys/class/net/$mesh/mesh/distributed_arp_table 2>&-
|
||||
[ -n "$fragmentation" ] && echo $fragmentation > /sys/class/net/$mesh/mesh/fragmentation
|
||||
[ -n "$gw_bandwidth" ] && echo $gw_bandwidth > /sys/class/net/$mesh/mesh/gw_bandwidth
|
||||
[ -n "$gw_mode" ] && echo $gw_mode > /sys/class/net/$mesh/mesh/gw_mode
|
||||
[ -n "$gw_sel_class" ] && echo $gw_sel_class > /sys/class/net/$mesh/mesh/gw_sel_class
|
||||
[ -n "$hop_penalty" ] && echo $hop_penalty > /sys/class/net/$mesh/mesh/hop_penalty
|
||||
[ -n "$network_coding" ] && echo $network_coding > /sys/class/net/$mesh/mesh/network_coding 2>&-
|
||||
[ -n "$log_level" ] && echo $log_level > /sys/class/net/$mesh/mesh/log_level 2>&-
|
||||
[ -n "$orig_interval" ] && echo $orig_interval > /sys/class/net/$mesh/mesh/orig_interval
|
||||
[ -n "$vis_mode" ] && echo $vis_mode > /sys/class/net/$mesh/mesh/vis_mode
|
||||
}
|
113
batman-adv/files/lib/netifd/proto/batadv.sh
Executable file → Normal file
113
batman-adv/files/lib/netifd/proto/batadv.sh
Executable file → Normal file
|
@ -1,123 +1,30 @@
|
|||
#!/bin/sh
|
||||
|
||||
[ -n "$INCLUDE_ONLY" ] || {
|
||||
. /lib/functions.sh
|
||||
. ../netifd-proto.sh
|
||||
init_proto "$@"
|
||||
}
|
||||
. /lib/functions.sh
|
||||
. ../netifd-proto.sh
|
||||
init_proto "$@"
|
||||
|
||||
proto_batadv_init_config() {
|
||||
no_device=1
|
||||
available=1
|
||||
|
||||
proto_config_add_boolean 'aggregated_ogms:bool'
|
||||
proto_config_add_boolean 'ap_isolation:bool'
|
||||
proto_config_add_boolean 'bonding:bool'
|
||||
proto_config_add_boolean 'bridge_loop_avoidance:bool'
|
||||
proto_config_add_boolean 'distributed_arp_table:bool'
|
||||
proto_config_add_boolean 'fragmentation:bool'
|
||||
proto_config_add_string 'gw_bandwidth'
|
||||
proto_config_add_string 'gw_mode'
|
||||
proto_config_add_int 'gw_sel_class'
|
||||
proto_config_add_int 'hop_penalty'
|
||||
proto_config_add_string 'isolation_mark'
|
||||
proto_config_add_string 'log_level'
|
||||
proto_config_add_int 'multicast_fanout'
|
||||
proto_config_add_boolean 'multicast_mode:bool'
|
||||
proto_config_add_boolean 'network_coding:bool'
|
||||
proto_config_add_int 'orig_interval'
|
||||
proto_config_add_string 'routing_algo'
|
||||
proto_config_add_string "mesh"
|
||||
}
|
||||
|
||||
proto_batadv_setup() {
|
||||
local config="$1"
|
||||
local iface="$config"
|
||||
local iface="$2"
|
||||
|
||||
local aggregated_ogms
|
||||
local ap_isolation
|
||||
local bonding
|
||||
local bridge_loop_avoidance
|
||||
local distributed_arp_table
|
||||
local fragmentation
|
||||
local gw_bandwidth
|
||||
local gw_mode
|
||||
local gw_sel_class
|
||||
local hop_penalty
|
||||
local isolation_mark
|
||||
local log_level
|
||||
local multicast_fanout
|
||||
local multicast_mode
|
||||
local network_coding
|
||||
local orig_interval
|
||||
local routing_algo
|
||||
|
||||
json_get_vars aggregated_ogms
|
||||
json_get_vars ap_isolation
|
||||
json_get_vars bonding
|
||||
json_get_vars bridge_loop_avoidance
|
||||
json_get_vars distributed_arp_table
|
||||
json_get_vars fragmentation
|
||||
json_get_vars gw_bandwidth
|
||||
json_get_vars gw_mode
|
||||
json_get_vars gw_sel_class
|
||||
json_get_vars hop_penalty
|
||||
json_get_vars isolation_mark
|
||||
json_get_vars log_level
|
||||
json_get_vars multicast_fanout
|
||||
json_get_vars multicast_mode
|
||||
json_get_vars network_coding
|
||||
json_get_vars orig_interval
|
||||
json_get_vars routing_algo
|
||||
|
||||
set_default routing_algo 'BATMAN_IV'
|
||||
|
||||
batctl routing_algo "$routing_algo"
|
||||
batctl meshif "$iface" interface create
|
||||
|
||||
[ -n "$aggregated_ogms" ] && batctl meshif "$iface" aggregation "$aggregated_ogms"
|
||||
[ -n "$ap_isolation" ] && batctl meshif "$iface" ap_isolation "$ap_isolation"
|
||||
[ -n "$bonding" ] && batctl meshif "$iface" bonding "$bonding"
|
||||
[ -n "$bridge_loop_avoidance" ] && batctl meshif "$iface" bridge_loop_avoidance "$bridge_loop_avoidance" 2>&-
|
||||
[ -n "$distributed_arp_table" ] && batctl meshif "$iface" distributed_arp_table "$distributed_arp_table" 2>&-
|
||||
[ -n "$fragmentation" ] && batctl meshif "$iface" fragmentation "$fragmentation"
|
||||
|
||||
case "$gw_mode" in
|
||||
server)
|
||||
if [ -n "$gw_bandwidth" ]; then
|
||||
batctl meshif "$iface" gw_mode "server" "$gw_bandwidth"
|
||||
else
|
||||
batctl meshif "$iface" gw_mode "server"
|
||||
fi
|
||||
;;
|
||||
client)
|
||||
if [ -n "$gw_sel_class" ]; then
|
||||
batctl meshif "$iface" gw_mode "client" "$gw_sel_class"
|
||||
else
|
||||
batctl meshif "$iface" gw_mode "client"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
batctl meshif "$iface" gw_mode "off"
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -n "$hop_penalty" ] && batctl meshif "$iface" hop_penalty "$hop_penalty"
|
||||
[ -n "$isolation_mark" ] && batctl meshif "$iface" isolation_mark "$isolation_mark"
|
||||
[ -n "$multicast_fanout" ] && batctl meshif "$iface" multicast_fanout "$multicast_fanout"
|
||||
[ -n "$multicast_mode" ] && batctl meshif "$iface" multicast_mode "$multicast_mode" 2>&-
|
||||
[ -n "$network_coding" ] && batctl meshif "$iface" network_coding "$network_coding" 2>&-
|
||||
[ -n "$log_level" ] && batctl meshif "$iface" loglevel "$log_level" 2>&-
|
||||
[ -n "$orig_interval" ] && batctl meshif "$iface" orig_interval "$orig_interval"
|
||||
local mesh
|
||||
json_get_vars mesh
|
||||
|
||||
echo "$mesh" > "/sys/class/net/$iface/batman_adv/mesh_iface"
|
||||
proto_init_update "$iface" 1
|
||||
proto_send_update "$config"
|
||||
}
|
||||
|
||||
proto_batadv_teardown() {
|
||||
local config="$1"
|
||||
local iface="$config"
|
||||
local iface="$2"
|
||||
|
||||
batctl meshif "$iface" interface destroy
|
||||
echo "none" > "/sys/class/net/$iface/batman_adv/mesh_iface" || true
|
||||
}
|
||||
|
||||
add_protocol batadv
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
[ -n "$INCLUDE_ONLY" ] || {
|
||||
. /lib/functions.sh
|
||||
. ../netifd-proto.sh
|
||||
init_proto "$@"
|
||||
}
|
||||
|
||||
proto_batadv_hardif_init_config() {
|
||||
proto_config_add_int 'elp_interval'
|
||||
proto_config_add_int 'hop_penalty'
|
||||
proto_config_add_string "master"
|
||||
proto_config_add_string 'throughput_override'
|
||||
}
|
||||
|
||||
proto_batadv_hardif_setup() {
|
||||
local config="$1"
|
||||
local iface="$2"
|
||||
|
||||
local elp_interval
|
||||
local hop_penalty
|
||||
local master
|
||||
local throughput_override
|
||||
|
||||
json_get_vars elp_interval
|
||||
json_get_vars hop_penalty
|
||||
json_get_vars master
|
||||
json_get_vars throughput_override
|
||||
|
||||
( proto_add_host_dependency "$config" '' "$master" )
|
||||
|
||||
batctl meshif "$master" interface -M add "$iface"
|
||||
|
||||
[ -n "$elp_interval" ] && batctl hardif "$iface" elp_interval "$elp_interval"
|
||||
[ -n "$hop_penalty" ] && batctl hardif "$iface" hop_penalty "$hop_penalty"
|
||||
[ -n "$throughput_override" ] && batctl hardif "$iface" throughput_override "$throughput_override"
|
||||
|
||||
proto_init_update "$iface" 1
|
||||
proto_send_update "$config"
|
||||
}
|
||||
|
||||
proto_batadv_hardif_teardown() {
|
||||
local config="$1"
|
||||
local iface="$2"
|
||||
|
||||
local master
|
||||
|
||||
json_get_vars master
|
||||
|
||||
batctl meshif "$master" interface -M del "$iface" || true
|
||||
}
|
||||
|
||||
add_protocol batadv_hardif
|
|
@ -1,29 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. ../netifd-proto.sh
|
||||
init_proto "$@"
|
||||
|
||||
proto_batadv_vlan_init_config() {
|
||||
proto_config_add_boolean 'ap_isolation:bool'
|
||||
}
|
||||
|
||||
proto_batadv_vlan_setup() {
|
||||
local config="$1"
|
||||
local iface="$2"
|
||||
|
||||
# batadv_vlan options
|
||||
local ap_isolation
|
||||
|
||||
json_get_vars ap_isolation
|
||||
|
||||
[ -n "$ap_isolation" ] && batctl vlan "$iface" ap_isolation "$ap_isolation"
|
||||
proto_init_update "$iface" 1
|
||||
proto_send_update "$config"
|
||||
}
|
||||
|
||||
proto_batadv_vlan_teardown() {
|
||||
local cfg="$1"
|
||||
}
|
||||
|
||||
add_protocol batadv_vlan
|
|
@ -1,274 +0,0 @@
|
|||
From: Sven Eckelmann <sven@narfation.org>
|
||||
Date: Fri, 6 May 2022 22:03:29 +0200
|
||||
Subject: Revert "batman-adv: Migrate to linux/container_of.h"
|
||||
|
||||
The original patch requires Linux 5.16.0 or a mac80211 compat header with this
|
||||
name. But the mac80211 package is currently not providing this header and
|
||||
OpenWrt main is still using older Linux kernel versions for some targets.
|
||||
|
||||
This reverts commit 043ae5634bdfd4c4dd8b95a22890752495080bb5.
|
||||
|
||||
--- a/compat-include/linux/container_of.h
|
||||
+++ /dev/null
|
||||
@@ -1,20 +0,0 @@
|
||||
-/* SPDX-License-Identifier: GPL-2.0 */
|
||||
-/* Copyright (C) B.A.T.M.A.N. contributors:
|
||||
- *
|
||||
- * Marek Lindner, Simon Wunderlich
|
||||
- *
|
||||
- * This file contains macros for maintaining compatibility with older versions
|
||||
- * of the Linux kernel.
|
||||
- */
|
||||
-
|
||||
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_CONTAINER_OF_H_
|
||||
-#define _NET_BATMAN_ADV_COMPAT_LINUX_CONTAINER_OF_H_
|
||||
-
|
||||
-#include <linux/version.h>
|
||||
-#if LINUX_VERSION_IS_GEQ(5, 16, 0)
|
||||
-#include_next <linux/container_of.h>
|
||||
-#else
|
||||
-#include <linux/kernel.h>
|
||||
-#endif
|
||||
-
|
||||
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_CONTAINER_OF_H_ */
|
||||
--- a/net/batman-adv/bat_iv_ogm.c
|
||||
+++ b/net/batman-adv/bat_iv_ogm.c
|
||||
@@ -13,13 +13,13 @@
|
||||
#include <linux/bug.h>
|
||||
#include <linux/byteorder/generic.h>
|
||||
#include <linux/cache.h>
|
||||
-#include <linux/container_of.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/jiffies.h>
|
||||
+#include <linux/kernel.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/lockdep.h>
|
||||
--- a/net/batman-adv/bat_v_elp.c
|
||||
+++ b/net/batman-adv/bat_v_elp.c
|
||||
@@ -10,13 +10,13 @@
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/byteorder/generic.h>
|
||||
-#include <linux/container_of.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/jiffies.h>
|
||||
+#include <linux/kernel.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/minmax.h>
|
||||
#include <linux/netdevice.h>
|
||||
--- a/net/batman-adv/bat_v_ogm.c
|
||||
+++ b/net/batman-adv/bat_v_ogm.c
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/byteorder/generic.h>
|
||||
-#include <linux/container_of.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/jiffies.h>
|
||||
+#include <linux/kernel.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/lockdep.h>
|
||||
--- a/net/batman-adv/bridge_loop_avoidance.c
|
||||
+++ b/net/batman-adv/bridge_loop_avoidance.c
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/byteorder/generic.h>
|
||||
#include <linux/compiler.h>
|
||||
-#include <linux/container_of.h>
|
||||
#include <linux/crc16.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/etherdevice.h>
|
||||
--- a/net/batman-adv/distributed-arp-table.c
|
||||
+++ b/net/batman-adv/distributed-arp-table.c
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/byteorder/generic.h>
|
||||
-#include <linux/container_of.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/gfp.h>
|
||||
@@ -21,6 +20,7 @@
|
||||
#include <linux/in.h>
|
||||
#include <linux/ip.h>
|
||||
#include <linux/jiffies.h>
|
||||
+#include <linux/kernel.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/netlink.h>
|
||||
--- a/net/batman-adv/gateway_client.c
|
||||
+++ b/net/batman-adv/gateway_client.c
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/byteorder/generic.h>
|
||||
-#include <linux/container_of.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/gfp.h>
|
||||
--- a/net/batman-adv/hard-interface.c
|
||||
+++ b/net/batman-adv/hard-interface.c
|
||||
@@ -10,12 +10,12 @@
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/byteorder/generic.h>
|
||||
#include <linux/compiler.h>
|
||||
-#include <linux/container_of.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/if_arp.h>
|
||||
#include <linux/if_ether.h>
|
||||
+#include <linux/kernel.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/limits.h>
|
||||
#include <linux/list.h>
|
||||
--- a/net/batman-adv/main.c
|
||||
+++ b/net/batman-adv/main.c
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/build_bug.h>
|
||||
#include <linux/byteorder/generic.h>
|
||||
-#include <linux/container_of.h>
|
||||
#include <linux/crc32c.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/errno.h>
|
||||
--- a/net/batman-adv/multicast.c
|
||||
+++ b/net/batman-adv/multicast.c
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/byteorder/generic.h>
|
||||
-#include <linux/container_of.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/gfp.h>
|
||||
--- a/net/batman-adv/network-coding.c
|
||||
+++ b/net/batman-adv/network-coding.c
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/byteorder/generic.h>
|
||||
#include <linux/compiler.h>
|
||||
-#include <linux/container_of.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/gfp.h>
|
||||
@@ -20,6 +19,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/jhash.h>
|
||||
#include <linux/jiffies.h>
|
||||
+#include <linux/kernel.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/lockdep.h>
|
||||
--- a/net/batman-adv/originator.c
|
||||
+++ b/net/batman-adv/originator.c
|
||||
@@ -8,11 +8,11 @@
|
||||
#include "main.h"
|
||||
|
||||
#include <linux/atomic.h>
|
||||
-#include <linux/container_of.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/jiffies.h>
|
||||
+#include <linux/kernel.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/lockdep.h>
|
||||
--- a/net/batman-adv/send.c
|
||||
+++ b/net/batman-adv/send.c
|
||||
@@ -10,13 +10,13 @@
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/byteorder/generic.h>
|
||||
-#include <linux/container_of.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/jiffies.h>
|
||||
+#include <linux/kernel.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/netdevice.h>
|
||||
--- a/net/batman-adv/soft-interface.c
|
||||
+++ b/net/batman-adv/soft-interface.c
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <linux/byteorder/generic.h>
|
||||
#include <linux/cache.h>
|
||||
#include <linux/compiler.h>
|
||||
-#include <linux/container_of.h>
|
||||
#include <linux/cpumask.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/etherdevice.h>
|
||||
@@ -20,6 +19,7 @@
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/jiffies.h>
|
||||
+#include <linux/kernel.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/lockdep.h>
|
||||
--- a/net/batman-adv/tp_meter.c
|
||||
+++ b/net/batman-adv/tp_meter.c
|
||||
@@ -12,13 +12,13 @@
|
||||
#include <linux/byteorder/generic.h>
|
||||
#include <linux/cache.h>
|
||||
#include <linux/compiler.h>
|
||||
-#include <linux/container_of.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/jiffies.h>
|
||||
+#include <linux/kernel.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/limits.h>
|
||||
--- a/net/batman-adv/translation-table.c
|
||||
+++ b/net/batman-adv/translation-table.c
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <linux/byteorder/generic.h>
|
||||
#include <linux/cache.h>
|
||||
#include <linux/compiler.h>
|
||||
-#include <linux/container_of.h>
|
||||
#include <linux/crc32c.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/etherdevice.h>
|
||||
@@ -22,6 +21,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/jhash.h>
|
||||
#include <linux/jiffies.h>
|
||||
+#include <linux/kernel.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/lockdep.h>
|
||||
--- a/net/batman-adv/tvlv.c
|
||||
+++ b/net/batman-adv/tvlv.c
|
||||
@@ -7,10 +7,10 @@
|
||||
#include "main.h"
|
||||
|
||||
#include <linux/byteorder/generic.h>
|
||||
-#include <linux/container_of.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/if_ether.h>
|
||||
+#include <linux/kernel.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/lockdep.h>
|
|
@ -0,0 +1,33 @@
|
|||
From 2c7bfe1299efa97438814bf6826a8f7ab3bc0b16 Mon Sep 17 00:00:00 2001
|
||||
From: Sven Eckelmann <sven@narfation.org>
|
||||
Date: Tue, 7 May 2013 14:51:02 +0200
|
||||
Subject: [PATCH] batctl: Add CFLAGS to the linker step
|
||||
|
||||
The GCC manual states for different parameters that the options for compilation
|
||||
must also be used when linking. The options for compilation are stored in
|
||||
CFLAGS and added to LINK.o to fix the behavior.
|
||||
|
||||
Option which need this are for example -fPIC/-fPIE or -flto.
|
||||
|
||||
Signed-off-by: Sven Eckelmann <sven@narfation.org>
|
||||
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
|
||||
---
|
||||
Makefile | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 311e70e..233f453 100755
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -53,7 +53,7 @@ RM ?= rm -f
|
||||
INSTALL ?= install
|
||||
MKDIR ?= mkdir -p
|
||||
COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
|
||||
-LINK.o = $(Q_LD)$(CC) $(LDFLAGS) $(TARGET_ARCH)
|
||||
+LINK.o = $(Q_LD)$(CC) $(CFLAGS) $(LDFLAGS) $(TARGET_ARCH)
|
||||
|
||||
# standard install paths
|
||||
PREFIX = /usr/local
|
||||
--
|
||||
1.7.10.4
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
From: Alexandru Gagniuc <mr.nuke.me@gmail.com>
|
||||
Date: Thu, 6 Apr 2023 18:05:50 -0500
|
||||
Subject: fix batadv_is_cfg80211_netdev
|
||||
|
||||
Replace CONFIG_CFG80211 with CPTCFG_CFG80211, which is the correct
|
||||
macro to use when building under backports.
|
||||
|
||||
--- a/net/batman-adv/hard-interface.c
|
||||
+++ b/net/batman-adv/hard-interface.c
|
||||
@@ -308,8 +308,7 @@ static bool batadv_is_cfg80211_netdev(st
|
||||
{
|
||||
if (!net_device)
|
||||
return false;
|
||||
-
|
||||
-#if IS_ENABLED(CONFIG_CFG80211)
|
||||
+#if IS_ENABLED(CPTCFG_CFG80211)
|
||||
/* cfg80211 drivers have to set ieee80211_ptr */
|
||||
if (net_device->ieee80211_ptr)
|
||||
return true;
|
|
@ -1,97 +0,0 @@
|
|||
From: Sven Eckelmann <sven@narfation.org>
|
||||
Date: Fri, 2 Feb 2024 22:49:00 +0100
|
||||
Subject: Revert "batman-adv: Switch to linux/sprintf.h"
|
||||
|
||||
The original patch requires Linux 6.6.0 or a mac80211 compat header with this
|
||||
name. But the mac80211 package is currently not providing this header and
|
||||
OpenWrt main is still using older Linux kernel versions for some targets.
|
||||
|
||||
This reverts commit f0fb49c5ab70dfa064f0aa8d1c5d84f65e8cbc86.
|
||||
|
||||
--- a/compat-include/linux/sprintf.h
|
||||
+++ /dev/null
|
||||
@@ -1,20 +0,0 @@
|
||||
-/* SPDX-License-Identifier: GPL-2.0 */
|
||||
-/* Copyright (C) B.A.T.M.A.N. contributors:
|
||||
- *
|
||||
- * Marek Lindner, Simon Wunderlich
|
||||
- *
|
||||
- * This file contains macros for maintaining compatibility with older versions
|
||||
- * of the Linux kernel.
|
||||
- */
|
||||
-
|
||||
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_SPRINTF_H_
|
||||
-#define _NET_BATMAN_ADV_COMPAT_LINUX_SPRINTF_H_
|
||||
-
|
||||
-#include <linux/version.h>
|
||||
-#if LINUX_VERSION_IS_GEQ(6, 6, 0)
|
||||
-#include_next <linux/sprintf.h>
|
||||
-#else
|
||||
-#include <linux/kernel.h>
|
||||
-#endif
|
||||
-
|
||||
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_SPRINTF_H_ */
|
||||
--- a/net/batman-adv/bridge_loop_avoidance.c
|
||||
+++ b/net/batman-adv/bridge_loop_avoidance.c
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/jhash.h>
|
||||
#include <linux/jiffies.h>
|
||||
+#include <linux/kernel.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/lockdep.h>
|
||||
@@ -29,7 +30,6 @@
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spinlock.h>
|
||||
-#include <linux/sprintf.h>
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/workqueue.h>
|
||||
--- a/net/batman-adv/gateway_client.c
|
||||
+++ b/net/batman-adv/gateway_client.c
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <linux/in.h>
|
||||
#include <linux/ip.h>
|
||||
#include <linux/ipv6.h>
|
||||
+#include <linux/kernel.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/lockdep.h>
|
||||
@@ -27,7 +28,6 @@
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spinlock.h>
|
||||
-#include <linux/sprintf.h>
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/udp.h>
|
||||
#include <net/sock.h>
|
||||
--- a/net/batman-adv/main.c
|
||||
+++ b/net/batman-adv/main.c
|
||||
@@ -32,7 +32,6 @@
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spinlock.h>
|
||||
-#include <linux/sprintf.h>
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/workqueue.h>
|
||||
--- a/net/batman-adv/multicast.c
|
||||
+++ b/net/batman-adv/multicast.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <linux/ip.h>
|
||||
#include <linux/ipv6.h>
|
||||
#include <linux/jiffies.h>
|
||||
+#include <linux/kernel.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/lockdep.h>
|
||||
#include <linux/netdevice.h>
|
||||
@@ -34,7 +35,6 @@
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spinlock.h>
|
||||
-#include <linux/sprintf.h>
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/types.h>
|
|
@ -1,69 +0,0 @@
|
|||
From: Sven Eckelmann <sven@narfation.org>
|
||||
Date: Fri, 2 Feb 2024 22:49:48 +0100
|
||||
Subject: Revert "batman-adv: Switch to linux/array_size.h"
|
||||
|
||||
The original patch requires Linux 6.7.0 or a mac80211 compat header with this
|
||||
name. But the mac80211 package is currently not providing this header and
|
||||
OpenWrt main is still using older Linux kernel versions for some targets.
|
||||
|
||||
This reverts commit f33d7f724675544a36b24c77f8d4b95d41252ae2.
|
||||
|
||||
--- a/compat-include/linux/array_size.h
|
||||
+++ /dev/null
|
||||
@@ -1,20 +0,0 @@
|
||||
-/* SPDX-License-Identifier: GPL-2.0 */
|
||||
-/* Copyright (C) B.A.T.M.A.N. contributors:
|
||||
- *
|
||||
- * Marek Lindner, Simon Wunderlich
|
||||
- *
|
||||
- * This file contains macros for maintaining compatibility with older versions
|
||||
- * of the Linux kernel.
|
||||
- */
|
||||
-
|
||||
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_ARRAY_SIZE_H_
|
||||
-#define _NET_BATMAN_ADV_COMPAT_LINUX_ARRAY_SIZE_H_
|
||||
-
|
||||
-#include <linux/version.h>
|
||||
-#if LINUX_VERSION_IS_GEQ(6, 7, 0)
|
||||
-#include_next <linux/array_size.h>
|
||||
-#else
|
||||
-#include <linux/kernel.h>
|
||||
-#endif
|
||||
-
|
||||
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_ARRAY_SIZE_H_ */
|
||||
--- a/net/batman-adv/main.c
|
||||
+++ b/net/batman-adv/main.c
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include "main.h"
|
||||
|
||||
-#include <linux/array_size.h>
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/build_bug.h>
|
||||
#include <linux/byteorder/generic.h>
|
||||
@@ -20,6 +19,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/ip.h>
|
||||
#include <linux/ipv6.h>
|
||||
+#include <linux/kernel.h>
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/list.h>
|
||||
--- a/net/batman-adv/netlink.c
|
||||
+++ b/net/batman-adv/netlink.c
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "netlink.h"
|
||||
#include "main.h"
|
||||
|
||||
-#include <linux/array_size.h>
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/bug.h>
|
||||
@@ -21,6 +20,7 @@
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/init.h>
|
||||
+#include <linux/kernel.h>
|
||||
#include <linux/limits.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/minmax.h>
|
|
@ -1,121 +0,0 @@
|
|||
/* Please avoid adding hacks here - instead add it to mac80211/backports.git */
|
||||
|
||||
#undef CONFIG_MODULE_STRIPPED
|
||||
|
||||
#include <linux/version.h> /* LINUX_VERSION_CODE */
|
||||
#include <linux/types.h>
|
||||
|
||||
#if LINUX_VERSION_IS_LESS(6, 0, 0)
|
||||
|
||||
#define __vstring(item, fmt, ap) __dynamic_array(char, item, 256)
|
||||
#define __assign_vstr(dst, fmt, va) \
|
||||
WARN_ON_ONCE(vsnprintf(__get_dynamic_array(dst), 256, fmt, *va) >= 256)
|
||||
|
||||
#endif /* LINUX_VERSION_IS_LESS(6, 0, 0) */
|
||||
|
||||
#if LINUX_VERSION_IS_LESS(6, 2, 0)
|
||||
|
||||
#include <linux/random.h>
|
||||
|
||||
#define genl_split_ops genl_ops
|
||||
|
||||
static inline u32 batadv_get_random_u32_below(u32 ep_ro)
|
||||
{
|
||||
return prandom_u32_max(ep_ro);
|
||||
}
|
||||
|
||||
#define get_random_u32_below batadv_get_random_u32_below
|
||||
|
||||
#endif /* LINUX_VERSION_IS_LESS(6, 2, 0) */
|
||||
|
||||
#if LINUX_VERSION_IS_LESS(6, 4, 0) && \
|
||||
!(LINUX_VERSION_IS_GEQ(5, 10, 205) && LINUX_VERSION_IS_LESS(5, 11, 0)) && \
|
||||
!(LINUX_VERSION_IS_GEQ(5, 15, 144) && LINUX_VERSION_IS_LESS(5, 16, 0)) && \
|
||||
!(LINUX_VERSION_IS_GEQ(6, 1, 69) && LINUX_VERSION_IS_LESS(6, 2, 0))
|
||||
|
||||
#include <linux/if_vlan.h>
|
||||
|
||||
/* Prefer this version in TX path, instead of
|
||||
* skb_reset_mac_header() + vlan_eth_hdr()
|
||||
*/
|
||||
static inline struct vlan_ethhdr *skb_vlan_eth_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct vlan_ethhdr *)skb->data;
|
||||
}
|
||||
|
||||
#endif /* LINUX_VERSION_IS_LESS(6, 4, 0) */
|
||||
|
||||
/* <DECLARE_EWMA> */
|
||||
|
||||
#include <linux/version.h>
|
||||
#include_next <linux/average.h>
|
||||
|
||||
#include <linux/bug.h>
|
||||
|
||||
#ifdef DECLARE_EWMA
|
||||
#undef DECLARE_EWMA
|
||||
#endif /* DECLARE_EWMA */
|
||||
|
||||
/*
|
||||
* Exponentially weighted moving average (EWMA)
|
||||
*
|
||||
* This implements a fixed-precision EWMA algorithm, with both the
|
||||
* precision and fall-off coefficient determined at compile-time
|
||||
* and built into the generated helper funtions.
|
||||
*
|
||||
* The first argument to the macro is the name that will be used
|
||||
* for the struct and helper functions.
|
||||
*
|
||||
* The second argument, the precision, expresses how many bits are
|
||||
* used for the fractional part of the fixed-precision values.
|
||||
*
|
||||
* The third argument, the weight reciprocal, determines how the
|
||||
* new values will be weighed vs. the old state, new values will
|
||||
* get weight 1/weight_rcp and old values 1-1/weight_rcp. Note
|
||||
* that this parameter must be a power of two for efficiency.
|
||||
*/
|
||||
|
||||
#define DECLARE_EWMA(name, _precision, _weight_rcp) \
|
||||
struct ewma_##name { \
|
||||
unsigned long internal; \
|
||||
}; \
|
||||
static inline void ewma_##name##_init(struct ewma_##name *e) \
|
||||
{ \
|
||||
BUILD_BUG_ON(!__builtin_constant_p(_precision)); \
|
||||
BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \
|
||||
/* \
|
||||
* Even if you want to feed it just 0/1 you should have \
|
||||
* some bits for the non-fractional part... \
|
||||
*/ \
|
||||
BUILD_BUG_ON((_precision) > 30); \
|
||||
BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \
|
||||
e->internal = 0; \
|
||||
} \
|
||||
static inline unsigned long \
|
||||
ewma_##name##_read(struct ewma_##name *e) \
|
||||
{ \
|
||||
BUILD_BUG_ON(!__builtin_constant_p(_precision)); \
|
||||
BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \
|
||||
BUILD_BUG_ON((_precision) > 30); \
|
||||
BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \
|
||||
return e->internal >> (_precision); \
|
||||
} \
|
||||
static inline void ewma_##name##_add(struct ewma_##name *e, \
|
||||
unsigned long val) \
|
||||
{ \
|
||||
unsigned long internal = READ_ONCE(e->internal); \
|
||||
unsigned long weight_rcp = ilog2(_weight_rcp); \
|
||||
unsigned long precision = _precision; \
|
||||
\
|
||||
BUILD_BUG_ON(!__builtin_constant_p(_precision)); \
|
||||
BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \
|
||||
BUILD_BUG_ON((_precision) > 30); \
|
||||
BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \
|
||||
\
|
||||
WRITE_ONCE(e->internal, internal ? \
|
||||
(((internal << weight_rcp) - internal) + \
|
||||
(val << precision)) >> weight_rcp : \
|
||||
(val << precision)); \
|
||||
}
|
||||
|
||||
/* </DECLARE_EWMA> */
|
125
batmand/Makefile
125
batmand/Makefile
|
@ -6,29 +6,32 @@
|
|||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=batmand
|
||||
PKG_REV:=1439
|
||||
PKG_VERSION:=r$(PKG_REV)
|
||||
PKG_RELEASE:=2
|
||||
PKG_EXTRA_CFLAGS=-DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA -DREVISION_VERSION=\"\ rv$(PKG_REV)\"
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://git.open-mesh.org/batmand.git
|
||||
PKG_REV:=b67a7087b51d7a5e90d27ac39116d1f57257c86e
|
||||
PKG_VERSION:=1440
|
||||
PKG_RELEASE:=1
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
PKG_SOURCE_PROTO:=svn
|
||||
PKG_SOURCE_VERSION:=$(PKG_REV)
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_SUBDIR:=$(if $(PKG_BRANCH),$(PKG_BRANCH),$(PKG_NAME))-$(PKG_VERSION)
|
||||
PKG_SOURCE_URL:=http://downloads.open-mesh.org/svn/batman/trunk/
|
||||
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
|
||||
PKG_MIRROR_HASH:=ceb8e0e399f79b1b663594fcf9642e1efc40e696a7604daf709c77da9b6ec52f
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_KMOD_BUILD_DIR:=$(PKG_BUILD_DIR)/batman/linux/modules
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/batmand/Default
|
||||
URL:=http://www.open-mesh.org/
|
||||
MAINTAINER:=Marek Lindner <lindner_marek@yahoo.de>
|
||||
endef
|
||||
|
||||
define Package/batmand
|
||||
URL:=https://www.open-mesh.org/
|
||||
MAINTAINER:=Corinna "Elektra" Aichele <onelektra@gmx.net>
|
||||
$(call Package/batmand/Default)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Routing and Redirection
|
||||
|
@ -40,16 +43,91 @@ define Package/batmand/description
|
|||
B.A.T.M.A.N. layer 3 routing daemon
|
||||
endef
|
||||
|
||||
MAKE_FLAGS += \
|
||||
EXTRA_CFLAGS='-DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA -DREVISION_VERSION=\"\ rv$(PKG_REV)\" -D_GNU_SOURCE' \
|
||||
define Package/vis
|
||||
$(call Package/batmand/Default)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Routing and Redirection
|
||||
DEPENDS:=+libpthread
|
||||
TITLE:=visualization server for B.A.T.M.A.N. layer 3
|
||||
endef
|
||||
|
||||
define Package/vis/description
|
||||
visualization server for B.A.T.M.A.N. layer 3
|
||||
endef
|
||||
|
||||
define KernelPackage/batgat
|
||||
$(call Package/batmand/Default)
|
||||
SUBMENU:=Network Support
|
||||
DEPENDS:=+batmand @BROKEN
|
||||
TITLE:=B.A.T.M.A.N. gateway module
|
||||
FILES:=$(PKG_KMOD_BUILD_DIR)/batgat.$(LINUX_KMOD_SUFFIX)
|
||||
AUTOLOAD:=$(call AutoLoad,50,batgat)
|
||||
endef
|
||||
|
||||
|
||||
define KernelPackage/batgat/description
|
||||
Kernel gateway module for B.A.T.M.A.N. for better tunnel performance
|
||||
endef
|
||||
|
||||
MAKE_BATMAND_ARGS += \
|
||||
EXTRA_CFLAGS='$(TARGET_CFLAGS) $(PKG_EXTRA_CFLAGS)' \
|
||||
CCFLAGS="$(TARGET_CFLAGS)" \
|
||||
OFLAGS="$(TARGET_CFLAGS)" \
|
||||
REVISION="$(PKG_REV)" \
|
||||
CC="$(TARGET_CC)" \
|
||||
NODEBUG=1 \
|
||||
UNAME="Linux" \
|
||||
batmand
|
||||
INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
|
||||
STRIP="/bin/true" \
|
||||
batmand install
|
||||
|
||||
MAKE_VIS_ARGS += \
|
||||
EXTRA_CFLAGS='$(TARGET_CFLAGS) $(PKG_EXTRA_CFLAGS)' \
|
||||
CCFLAGS="$(TARGET_CFLAGS)" \
|
||||
OFLAGS="$(TARGET_CFLAGS)" \
|
||||
REVISION="$(PKG_REV)" \
|
||||
CC="$(TARGET_CC)" \
|
||||
NODEBUG=1 \
|
||||
UNAME="Linux" \
|
||||
INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
|
||||
STRIP="/bin/true" \
|
||||
vis install
|
||||
|
||||
MAKE_BATGAT_ARGS += \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
PATH="$(TARGET_PATH)" \
|
||||
SUBDIRS="$(PKG_KMOD_BUILD_DIR)" \
|
||||
LINUX_VERSION="$(LINUX_VERSION)" \
|
||||
REVISION="$(PKG_REV)" modules
|
||||
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
ifneq ($(DEVELOPER)$(CONFIG_PACKAGE_batmand),)
|
||||
BUILD_BATMAND := $(MAKE) -C $(PKG_BUILD_DIR)/batman $(MAKE_BATMAND_ARGS)
|
||||
endif
|
||||
|
||||
ifneq ($(DEVELOPER)$(CONFIG_PACKAGE_vis),)
|
||||
BUILD_VIS := $(MAKE) -C $(PKG_BUILD_DIR)/vis $(MAKE_VIS_ARGS)
|
||||
endif
|
||||
|
||||
ifneq ($(DEVELOPER)$(CONFIG_PACKAGE_kmod-batgat),)
|
||||
BUILD_BATGAT := $(MAKE) -C "$(LINUX_DIR)" $(MAKE_BATGAT_ARGS)
|
||||
endif
|
||||
|
||||
define Build/Compile
|
||||
$(BUILD_BATMAND)
|
||||
$(BUILD_VIS)
|
||||
cp $(PKG_KMOD_BUILD_DIR)/Makefile.kbuild $(PKG_KMOD_BUILD_DIR)/Makefile
|
||||
$(BUILD_BATGAT)
|
||||
endef
|
||||
|
||||
define Package/batmand/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/batmand $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/batmand $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) ./files/etc/init.d/batmand $(1)/etc/init.d
|
||||
$(INSTALL_DATA) ./files/etc/config/batmand $(1)/etc/config
|
||||
endef
|
||||
|
@ -58,4 +136,17 @@ define Package/batmand/conffiles
|
|||
/etc/config/batmand
|
||||
endef
|
||||
|
||||
define Package/vis/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/vis $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) ./files/etc/init.d/vis $(1)/etc/init.d
|
||||
$(INSTALL_DATA) ./files/etc/config/vis $(1)/etc/config
|
||||
endef
|
||||
|
||||
define Package/vis/conffiles
|
||||
/etc/config/vis
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,batmand))
|
||||
$(eval $(call BuildPackage,vis))
|
||||
$(eval $(call KernelPackage,batgat))
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
config batmand general
|
||||
option interface ath0
|
||||
option hna
|
||||
option gateway_class
|
||||
option hna
|
||||
option gateway_class
|
||||
option originator_interval
|
||||
option preferred_gateway
|
||||
option preferred_gateway
|
||||
option routing_class
|
||||
option visualisation_srv
|
||||
option policy_routing_script
|
||||
option disable_client_nat
|
||||
option disable_aggregation
|
||||
|
||||
|
|
|
@ -1,44 +1,27 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
START=90
|
||||
USE_PROCD=1
|
||||
|
||||
batmand_start() {
|
||||
local config="$1"
|
||||
local batman_args
|
||||
local interface
|
||||
local hnas
|
||||
local gateway_class
|
||||
local originator_interval
|
||||
local preferred_gateway
|
||||
local routing_class
|
||||
local visualisation_srv
|
||||
local local policy_routing_script
|
||||
local disable_client_nat
|
||||
local disable_aggregation
|
||||
|
||||
[ "$config" = "general" ] || return 1
|
||||
|
||||
config_get interface "$config" interface
|
||||
start () {
|
||||
interface=$(uci get batmand.general.interface)
|
||||
if [ "$interface" = "" ]; then
|
||||
echo $1 Error, you must specify at least a network interface
|
||||
return 1
|
||||
exit
|
||||
fi
|
||||
|
||||
config_get hnas "$config" hna
|
||||
config_get gateway_class "$config" gateway_class
|
||||
config_get originator_interval "$config" originator_interval
|
||||
config_get preferred_gateway "$config" preferred_gateway
|
||||
config_get routing_class "$config" routing_class
|
||||
config_get visualisation_srv "$config" visualisation_srv
|
||||
config_get policy_routing_script "$config" policy_routing_script
|
||||
config_get disable_client_nat "$config" disable_client_nat
|
||||
config_get disable_aggregation "$config" disable_aggregation
|
||||
|
||||
hnas=$(uci get batmand.general.hna)
|
||||
gateway_class=$(uci get batmand.general.gateway_class)
|
||||
originator_interval=$(uci get batmand.general.originator_interval)
|
||||
preferred_gateway=$(uci get batmand.general.preferred_gateway)
|
||||
routing_class=$(uci get batmand.general.routing_class)
|
||||
visualisation_srv=$(uci get batmand.general.visualisation_srv)
|
||||
policy_routing_script=$(uci get batmand.general.policy_routing_script)
|
||||
disable_client_nat=$(uci get batmand.general.disable_client_nat)
|
||||
disable_aggregation=$(uci get batmand.general.disable_aggregation)
|
||||
batman_args=""
|
||||
|
||||
for hna in $hnas; do
|
||||
batman_args=${batman_args}'-a '$hna' '
|
||||
done
|
||||
for hna in $hnas
|
||||
do
|
||||
batman_args=${batman_args}'-a '$hna' '
|
||||
done
|
||||
|
||||
if [ $gateway_class ]; then
|
||||
batman_args=${batman_args}'-g '$gateway_class' '
|
||||
|
@ -55,37 +38,29 @@ batmand_start() {
|
|||
if [ $routing_class ]; then
|
||||
batman_args=${batman_args}'-r '$routing_class' '
|
||||
fi
|
||||
|
||||
|
||||
if [ $visualisation_srv ]; then
|
||||
batman_args=${batman_args}'-s '$visualisation_srv' '
|
||||
fi
|
||||
|
||||
|
||||
if [ $policy_routing_script ]; then
|
||||
batman_args=${batman_args}'--policy-routing-script '$policy_routing_script' '
|
||||
fi
|
||||
|
||||
|
||||
if [ $disable_client_nat ]; then
|
||||
batman_args=${batman_args}'--disable-client-nat '
|
||||
fi
|
||||
|
||||
|
||||
if [ $disable_aggregation ]; then
|
||||
batman_args=${batman_args}'--disable-aggregation '
|
||||
fi
|
||||
|
||||
procd_open_instance "${config}"
|
||||
procd_set_param command /usr/sbin/batmand
|
||||
procd_append_param command --no-detach
|
||||
procd_append_param command ${batman_args}
|
||||
procd_append_param command ${interface}
|
||||
procd_set_param netdev ${interface}
|
||||
procd_close_instance
|
||||
batman_args=${batman_args}$interface
|
||||
batmand $batman_args >/dev/null 2>&1
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load "batmand"
|
||||
config_foreach batmand_start batmand
|
||||
stop () {
|
||||
killall batmand
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "batmand"
|
||||
}
|
||||
|
||||
|
|
19
batmand/files/etc/init.d/vis
Normal file
19
batmand/files/etc/init.d/vis
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
START=90
|
||||
|
||||
start () {
|
||||
interface=$(uci get vis.general.interface)
|
||||
if [ "$interface" = "" ]; then
|
||||
echo $1 Error, you must specify at least a network interface
|
||||
exit
|
||||
fi
|
||||
vis_args=$interface
|
||||
|
||||
vis $vis_args >/dev/null 2>&1
|
||||
}
|
||||
|
||||
stop () {
|
||||
killall vis
|
||||
}
|
||||
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
From: Sven Eckelmann <sven@narfation.org>
|
||||
Date: Sun, 1 Dec 2013 14:39:00 +0100
|
||||
Subject: Allow one to disable forking to background in debug_mode 0
|
||||
|
||||
---
|
||||
posix/init.c | 19 ++++++++++++++-----
|
||||
1 file changed, 14 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/posix/init.c
|
||||
+++ b/posix/init.c
|
||||
@@ -44,6 +44,7 @@
|
||||
#define IOCSETDEV 1
|
||||
|
||||
int8_t stop;
|
||||
+int no_detach = 0;
|
||||
|
||||
|
||||
|
||||
@@ -159,6 +160,7 @@ void apply_init_args( int argc, char *ar
|
||||
{"purge-timeout", required_argument, 0, 'q'},
|
||||
{"disable-aggregation", no_argument, 0, 'x'},
|
||||
{"disable-client-nat", no_argument, 0, 'z'},
|
||||
+ {"no-detach", no_argument, 0, 'D'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
@@ -169,7 +171,7 @@ void apply_init_args( int argc, char *ar
|
||||
if ( strstr( SOURCE_VERSION, "-" ) != NULL )
|
||||
printf( "WARNING: You are using the unstable batman branch. If you are interested in *using* batman get the latest stable release !\n" );
|
||||
|
||||
- while ( ( optchar = getopt_long( argc, argv, "a:A:bcd:hHio:g:p:r:s:vV", long_options, &option_index ) ) != -1 ) {
|
||||
+ while ( ( optchar = getopt_long( argc, argv, "a:A:bcd:hHio:g:p:r:s:vVD", long_options, &option_index ) ) != -1 ) {
|
||||
|
||||
switch ( optchar ) {
|
||||
|
||||
@@ -381,6 +383,11 @@ void apply_init_args( int argc, char *ar
|
||||
found_args++;
|
||||
break;
|
||||
|
||||
+ case 'D':
|
||||
+ no_detach = 1;
|
||||
+ found_args++;
|
||||
+ break;
|
||||
+
|
||||
case 'h':
|
||||
default:
|
||||
usage();
|
||||
@@ -539,12 +546,14 @@ void apply_init_args( int argc, char *ar
|
||||
/* daemonize */
|
||||
if (debug_level == 0) {
|
||||
|
||||
- if (my_daemon() < 0) {
|
||||
+ if (!no_detach) {
|
||||
+ if (my_daemon() < 0) {
|
||||
|
||||
- printf("Error - can't fork to background: %s\n", strerror(errno));
|
||||
- restore_defaults();
|
||||
- exit(EXIT_FAILURE);
|
||||
+ printf("Error - can't fork to background: %s\n", strerror(errno));
|
||||
+ restore_defaults();
|
||||
+ exit(EXIT_FAILURE);
|
||||
|
||||
+ }
|
||||
}
|
||||
|
||||
openlog("batmand", LOG_PID, LOG_DAEMON);
|
47
batmand/patches/100-2.6.36.patch
Normal file
47
batmand/patches/100-2.6.36.patch
Normal file
|
@ -0,0 +1,47 @@
|
|||
---
|
||||
batman/linux/modules/gateway.c | 19 +++++++++++++++++++
|
||||
1 file changed, 19 insertions(+)
|
||||
|
||||
--- batmand-r1439.orig/batman/linux/modules/gateway.c
|
||||
+++ batmand-r1439/batman/linux/modules/gateway.c
|
||||
@@ -29,6 +29,7 @@ static struct class *batman_class;
|
||||
static int batgat_open(struct inode *inode, struct file *filp);
|
||||
static int batgat_release(struct inode *inode, struct file *file);
|
||||
static int batgat_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg );
|
||||
+static long batgat_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg );
|
||||
|
||||
|
||||
static void udp_data_ready(struct sock *sk, int len);
|
||||
@@ -53,7 +54,11 @@ static int proc_clients_read(char *buf,
|
||||
static struct file_operations fops = {
|
||||
.open = batgat_open,
|
||||
.release = batgat_release,
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
|
||||
+ .unlocked_ioctl = batgat_ioctl_unlocked,
|
||||
+#else
|
||||
.ioctl = batgat_ioctl,
|
||||
+#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -166,6 +171,20 @@ static int batgat_release(struct inode *
|
||||
}
|
||||
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
|
||||
+#include <linux/smp_lock.h>
|
||||
+static long batgat_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg )
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ lock_kernel();
|
||||
+ ret = batgat_ioctl(file->f_path.dentry->d_inode, file, cmd, arg);
|
||||
+ unlock_kernel();
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
static int batgat_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg )
|
||||
{
|
||||
uint8_t tmp_ip[4];
|
129
bird2/Makefile
129
bird2/Makefile
|
@ -1,129 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2009-2017 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:=bird2
|
||||
PKG_VERSION:=2.14
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=bird-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=ftp://bird.network.cz/pub/bird
|
||||
PKG_HASH:=b0b9f6f8566541b9be4af1f0cac675c5a3785601a55667a7ec3d7de29735a786
|
||||
|
||||
PKG_MAINTAINER:=Toke Høiland-Jørgensen <toke@toke.dk>
|
||||
PKG_LICENSE:=GPL-2.0-or-later
|
||||
|
||||
PKG_BUILD_DEPENDS:=ncurses readline
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/bird-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/bird2/Default/description
|
||||
BIRD is an internet routing daemon which manages TCP/IP routing tables
|
||||
with support of modern routing protocols, easy to use configuration
|
||||
interface and powerful route filtering language. It is lightweight and
|
||||
efficient and therefore appropriate for small embedded routers.
|
||||
|
||||
endef
|
||||
|
||||
define Package/bird2
|
||||
TITLE:=The BIRD Internet Routing Daemon (v2)
|
||||
URL:=http://bird.network.cz/
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Routing and Redirection
|
||||
DEPENDS:=+libpthread
|
||||
CONFLICTS:=bird1-ipv4 bird1-ipv6 bird4 bird6
|
||||
endef
|
||||
|
||||
define Package/bird2c
|
||||
TITLE:=The BIRD command-line client (v2)
|
||||
URL:=http://bird.network.cz/
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Routing and Redirection
|
||||
DEPENDS:=+bird2 +libreadline +libncurses
|
||||
CONFLICTS:=bird1c-ipv4 bird1c-ipv6 birdc4 birdc6
|
||||
endef
|
||||
|
||||
define Package/bird2cl
|
||||
TITLE:=The BIRD lightweight command-line client (v2)
|
||||
URL:=http://bird.network.cz/
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Routing and Redirection
|
||||
DEPENDS:=+bird2
|
||||
CONFLICTS:=bird1cl-ipv4 bird1cl-ipv6 birdcl4 birdcl6
|
||||
endef
|
||||
|
||||
define Package/bird2/description
|
||||
$(call Package/bird2/Default/description)
|
||||
|
||||
BIRD supports OSPFv2, RIPv2, Babel and BGP protocols for IPv4 and
|
||||
OSPFv3, RIPng, Babel and BGP protocols for IPv6.
|
||||
|
||||
In BGP, BIRD supports communities, multiprotocol extensions, MD5
|
||||
authentication, 32bit AS numbers and could act as a route server or a
|
||||
route reflector. BIRD also supports multiple RIBs, multiple kernel
|
||||
routing tables and redistribution between the protocols with a powerful
|
||||
configuration syntax.
|
||||
|
||||
This is the 2.0 branch of Bird which integrates support for IPv4 and IPv6
|
||||
into a single branch, and also adds support for the Babel routing protocol.
|
||||
endef
|
||||
|
||||
define Package/bird2c/description
|
||||
$(call Package/bird2/Default/description)
|
||||
|
||||
This is a BIRD command-line client. It is used to send commands to BIRD,
|
||||
commands can perform simple actions such as enabling/disabling of
|
||||
protocols, telling BIRD to show various information, telling it to show
|
||||
a routing table filtered by a filter, or asking BIRD to reconfigure.
|
||||
|
||||
Unless you can't afford dependency on ncurses and readline, you
|
||||
should install BIRD command-line client together with BIRD.
|
||||
endef
|
||||
|
||||
define Package/bird2cl/description
|
||||
$(call Package/bird2/Default/description)
|
||||
|
||||
This is a BIRD lightweight command-line client. It is used to send commands
|
||||
to BIRD, commands can perform simple actions such as enabling/disabling of
|
||||
protocols, telling BIRD to show various information, telling it to show
|
||||
a routing table filtered by a filter, or asking BIRD to reconfigure.
|
||||
endef
|
||||
|
||||
CONFIGURE_ARGS += --disable-libssh
|
||||
|
||||
define Package/bird2/conffiles
|
||||
/etc/bird.conf
|
||||
/etc/bird4.conf
|
||||
/etc/bird6.conf
|
||||
endef
|
||||
|
||||
define Package/bird2/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bird $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DATA) ./files/bird.conf $(1)/etc/
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/bird.init $(1)/etc/init.d/bird
|
||||
endef
|
||||
|
||||
define Package/bird2c/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/birdc $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/bird2cl/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/birdcl $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bird2))
|
||||
$(eval $(call BuildPackage,bird2c))
|
||||
$(eval $(call BuildPackage,bird2cl))
|
|
@ -1,332 +0,0 @@
|
|||
/*
|
||||
* This is an example configuration file for MB-BGP setting
|
||||
*/
|
||||
|
||||
|
||||
log syslog all;
|
||||
# debug protocols all;
|
||||
|
||||
router id 192.168.1.1;
|
||||
|
||||
ipv4 table master4;
|
||||
ipv6 table master6;
|
||||
|
||||
ipv4 table mcast4;
|
||||
ipv6 table mcast6;
|
||||
|
||||
ipv4 table mtab4;
|
||||
ipv6 table mtab6;
|
||||
|
||||
vpn4 table vpntab4;
|
||||
vpn6 table vpntab6;
|
||||
|
||||
vpn4 table vpn4mc;
|
||||
vpn6 table vpn6mc;
|
||||
|
||||
flow4 table flowtab4;
|
||||
flow6 table flowtab6;
|
||||
|
||||
|
||||
protocol device {
|
||||
}
|
||||
|
||||
protocol kernel kernel4 {
|
||||
ipv4 {
|
||||
export all;
|
||||
};
|
||||
}
|
||||
|
||||
protocol kernel kernel6 {
|
||||
ipv6 {
|
||||
export all;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
protocol static static4 {
|
||||
ipv4;
|
||||
|
||||
route 10.10.0.0/24 via 192.168.1.2;
|
||||
route 10.10.1.0/24 via 192.168.1.2 { bgp_large_community.add((10,20,30)); bgp_large_community.add((10,(20*3),10)); };
|
||||
}
|
||||
|
||||
protocol static static6 {
|
||||
ipv6;
|
||||
|
||||
route 2001:db8:10:10::/64 via 2001:db8:1:1::10;
|
||||
route 2001:db8:10:11::/64 via 2001:db8:1:1::10;
|
||||
|
||||
route 2001:db8:1:1::/64 via fe80::ec9b:67ff:fe60:fd5d % ve1;
|
||||
}
|
||||
|
||||
# VPNv4 routes with MPLS labels
|
||||
protocol static statvpn4 {
|
||||
vpn4;
|
||||
|
||||
route 10:10 10.20.0.0/24 via 192.168.1.2 mpls 210;
|
||||
route 10:10 10.20.1.0/24 via 192.168.1.2 mpls 210;
|
||||
route 10:20 10.20.0.0/24 via 192.168.1.2 mpls 220;
|
||||
route 10:20 10.20.1.0/24 via 192.168.1.2 mpls 220;
|
||||
}
|
||||
|
||||
protocol static statvpn6 {
|
||||
vpn6;
|
||||
|
||||
route 10:10 2001:db8:20:10::/64 via 2001:db8:1:1::10 mpls 200/210;
|
||||
route 10:10 2001:db8:20:11::/64 via 2001:db8:1:1::10 mpls 200/210;
|
||||
route 10:20 2001:db8:20:10::/64 via 2001:db8:1:1::10 mpls 200/220;
|
||||
route 10:20 2001:db8:20:11::/64 via 2001:db8:1:1::10 mpls 200/220;
|
||||
}
|
||||
|
||||
# RFC 5575 flow specification
|
||||
protocol static flowstat4 {
|
||||
flow4;
|
||||
|
||||
route flow4 {
|
||||
dst 10.0.0.0/8;
|
||||
proto = 23;
|
||||
dport > 24 && < 30 || 40..50,60..70,80;
|
||||
sport > 24 && < 30 || = 40 || 50,60..70,80;
|
||||
icmp type 80;
|
||||
icmp code 90;
|
||||
tcp flags 0x03/0x0f;
|
||||
length 2048..65535;
|
||||
dscp = 63;
|
||||
fragment dont_fragment, is_fragment || !first_fragment;
|
||||
};
|
||||
|
||||
route flow4 {
|
||||
dst 11.0.0.0/8;
|
||||
proto = 0x12;
|
||||
sport > 0x5678 && < 0x9abc || 0xdef0 || 0x1234,0x5678,0x9abc..0xdef0;
|
||||
dport = 50;
|
||||
tcp flags 0x000/0xf00;
|
||||
};
|
||||
|
||||
route flow4 {
|
||||
dst 12.0.0.0/32;
|
||||
tcp flags ! 0/0x999;
|
||||
};
|
||||
|
||||
route flow4 {
|
||||
dst 220.0.254.0/24;
|
||||
tcp flags 0x99/0x999;
|
||||
};
|
||||
|
||||
route flow4 {
|
||||
dst 220.0.254.192/28;
|
||||
tcp flags ! 0xfff/0xfff;
|
||||
};
|
||||
|
||||
route flow4 {
|
||||
dst 15.0.0.0/8;
|
||||
tcp flags ! 0x999/0x999;
|
||||
};
|
||||
}
|
||||
|
||||
protocol static flowstat6 {
|
||||
flow6;
|
||||
|
||||
route flow6 {
|
||||
dst fec0:1122:3344:5566::1/128;
|
||||
src 0000:0000:0000:0001:1234:5678:9800:0000/101 offset 63;
|
||||
next header = 23;
|
||||
sport 24..30, 42 || 50,60,70..80;
|
||||
dport = 50;
|
||||
tcp flags 0x03/0x0f, !0/0xff || 0x33/0x33;
|
||||
fragment !is_fragment || !first_fragment;
|
||||
label 0xaaaa/0xaaaa && 0x33/0x33;
|
||||
};
|
||||
|
||||
route flow6 {
|
||||
dst fec0:1122:3344:5566::1/128;
|
||||
src ::1:1234:5678:9800:0/101 offset 63;
|
||||
next header = 23;
|
||||
dport = 50;
|
||||
sport > 24 && < 30 || = 40 || = 50 || = 60 || >= 70 && <= 80;
|
||||
tcp flags 0x3/0x3 && 0x0/0xc;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
protocol pipe {
|
||||
table master4;
|
||||
peer table mcast4;
|
||||
import none;
|
||||
export where source = RTS_OSPF;
|
||||
}
|
||||
|
||||
protocol pipe {
|
||||
table master6;
|
||||
peer table mcast6;
|
||||
import none;
|
||||
export where source = RTS_OSPF;
|
||||
}
|
||||
|
||||
protocol ospf v2 ospf4 {
|
||||
ipv4 {
|
||||
import all;
|
||||
# export where source = RTS_STATIC;
|
||||
};
|
||||
|
||||
area 0 {
|
||||
interface "ve0" { stub; };
|
||||
interface "ve1" { hello 5; type ptp; };
|
||||
interface "ve2" { hello 5; type bcast; ttl security; };
|
||||
interface "ve3" { hello 5; type bcast; ttl security; };
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
protocol ospf v3 ospf6 {
|
||||
ipv6 {
|
||||
import all;
|
||||
# export where source = RTS_STATIC;
|
||||
};
|
||||
|
||||
area 0 {
|
||||
interface "ve0" { stub; };
|
||||
interface "ve1" { hello 5; type ptp; };
|
||||
interface "ve2" { hello 5; type bcast; };
|
||||
};
|
||||
}
|
||||
|
||||
protocol bgp {
|
||||
local 192.168.11.1 as 1000;
|
||||
neighbor 192.168.11.2 as 2000;
|
||||
# local 192.168.1.1 as 1000;
|
||||
# neighbor 192.168.2.1 as 2000;
|
||||
# multihop;
|
||||
# rr client;
|
||||
# strict bind;
|
||||
# debug all;
|
||||
|
||||
# regular IPv4 unicast (1/1)
|
||||
ipv4 {
|
||||
# connects to master4 table by default
|
||||
import all;
|
||||
export where source ~ [ RTS_STATIC, RTS_BGP ];
|
||||
};
|
||||
|
||||
# regular IPv6 unicast (2/1)
|
||||
ipv6 {
|
||||
# connects to master6 table by default
|
||||
import all;
|
||||
export where source ~ [ RTS_STATIC, RTS_BGP ];
|
||||
# next hop address 2001:db8:1:1::1;
|
||||
};
|
||||
|
||||
# IPv4 multicast topology (1/2)
|
||||
ipv4 multicast {
|
||||
# explicit IPv4 table
|
||||
table mcast4;
|
||||
import all;
|
||||
export all;
|
||||
};
|
||||
|
||||
# IPv6 multicast topology (2/2)
|
||||
ipv6 multicast {
|
||||
# explicit IPv6 table
|
||||
table mcast6;
|
||||
import all;
|
||||
export all;
|
||||
# next hop address 2001:db8:1:1::1;
|
||||
};
|
||||
|
||||
# IPv4 with MPLS labels (1/4)
|
||||
ipv4 mpls {
|
||||
# explicit IPv4 table
|
||||
table mtab4;
|
||||
import all;
|
||||
export all;
|
||||
};
|
||||
|
||||
# IPv6 with MPLS labels (2/4)
|
||||
ipv6 mpls {
|
||||
# explicit IPv6 table
|
||||
table mtab6;
|
||||
import all;
|
||||
export all;
|
||||
# allows IPv4 next hops (6PE)
|
||||
# extended next hop;
|
||||
};
|
||||
|
||||
# VPNv4 with MPLS labels (1/128)
|
||||
vpn4 mpls {
|
||||
# connects to vpntab4 table by default
|
||||
import all;
|
||||
export all;
|
||||
};
|
||||
|
||||
# VPNv6 with MPLS labels (2/128)
|
||||
vpn6 mpls {
|
||||
# connects to vpntab6 table by default
|
||||
import all;
|
||||
export all;
|
||||
};
|
||||
|
||||
# VPNv4 multicast topology (1/129)
|
||||
vpn4 multicast {
|
||||
table vpn4mc;
|
||||
import all;
|
||||
export all;
|
||||
};
|
||||
|
||||
# VPNv6 multicast topology (2/129)
|
||||
vpn6 multicast {
|
||||
table vpn6mc;
|
||||
import all;
|
||||
export all;
|
||||
};
|
||||
|
||||
# IPv4 Flowspec (1/133)
|
||||
flow4 {
|
||||
# connects to flowtab4 table by default
|
||||
import all;
|
||||
export all;
|
||||
};
|
||||
|
||||
# IPv6 Flowspec (2/133)
|
||||
flow6 {
|
||||
# connects to flowtab6 table by default
|
||||
import all;
|
||||
export all;
|
||||
};
|
||||
}
|
||||
|
||||
protocol bgp {
|
||||
local 192.168.1.1 as 1000;
|
||||
neighbor 192.168.3.1 as 1000;
|
||||
multihop;
|
||||
rr client;
|
||||
|
||||
ipv4 {
|
||||
import all;
|
||||
export where source ~ [ RTS_STATIC, RTS_BGP ];
|
||||
};
|
||||
|
||||
ipv6 {
|
||||
import all;
|
||||
export where source ~ [ RTS_STATIC, RTS_BGP ];
|
||||
next hop address 2001:db8:1:1::1;
|
||||
};
|
||||
}
|
||||
|
||||
protocol bgp {
|
||||
local 2001:db8:1:1::1 as 1000;
|
||||
neighbor 2001:db8:4:1::1 as 1000;
|
||||
multihop;
|
||||
rr client;
|
||||
|
||||
ipv4 {
|
||||
import all;
|
||||
export where source ~ [ RTS_STATIC, RTS_BGP ];
|
||||
next hop address 192.168.4.1;
|
||||
};
|
||||
|
||||
ipv6 {
|
||||
import all;
|
||||
export where source ~ [ RTS_STATIC, RTS_BGP ];
|
||||
};
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2010-2017 OpenWrt.org
|
||||
|
||||
USE_PROCD=1
|
||||
START=70
|
||||
STOP=10
|
||||
|
||||
BIRD_BIN="/usr/sbin/bird"
|
||||
BIRD_CONF="/etc/bird.conf"
|
||||
BIRD_PID_FILE="/var/run/bird.pid"
|
||||
|
||||
start_service() {
|
||||
mkdir -p /var/run
|
||||
procd_open_instance
|
||||
procd_set_param command $BIRD_BIN -f -c $BIRD_CONF -P $BIRD_PID_FILE
|
||||
procd_set_param file "$BIRD_CONF"
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
procd_send_signal bird
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
--- a/proto/ospf/topology.h
|
||||
+++ b/proto/ospf/topology.h
|
||||
@@ -41,7 +41,7 @@ struct top_hash_entry
|
||||
u8 mode; /* LSA generated during RT calculation (LSA_RTCALC or LSA_STALE)*/
|
||||
u8 nhs_reuse; /* Whether nhs nodes can be reused during merging.
|
||||
See a note in rt.c:add_cand() */
|
||||
-};
|
||||
+} PACKED;
|
||||
|
||||
|
||||
/* Prevents ospf_hash_find() to ignore the entry, for p->lsrqh and p->lsrth */
|
148
bmx6/Makefile
Normal file
148
bmx6/Makefile
Normal file
|
@ -0,0 +1,148 @@
|
|||
# Copyright (C) 2011 Fundacio Privada per a la Xarxa Oberta, Lliure i Neutral guifi.net
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# The full GNU General Public License is included in this distribution in
|
||||
# the file called "COPYING".
|
||||
#
|
||||
# Contibutors:
|
||||
# Axel Neumann, Simó Albert i Beltran, Pau Escrich
|
||||
#
|
||||
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bmx6
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
|
||||
PKG_SOURCE_URL:=git://bmx6.net/bmx6.git
|
||||
#PKG_SOURCE_URL:=git://github.com/axn/bmx6.git
|
||||
|
||||
PKG_REV:=c0076183ce28fe15285c8faa51920e74633776fe
|
||||
PKG_VERSION:=r2013041901
|
||||
PKG_RELEASE:=4
|
||||
|
||||
PKG_SOURCE_VERSION:=$(PKG_REV)
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
TARGET_CFLAGS += $(FPIC)
|
||||
|
||||
MAKE_ARGS += \
|
||||
EXTRA_CFLAGS="$(TARGET_CFLAGS) -I. -I$(STAGING_DIR)/usr/include -DNO_DEBUG_ALL -DNO_DEBUG_DUMP" \
|
||||
EXTRA_LDFLAGS="-L$(STAGING_DIR)/usr/lib " \
|
||||
REVISION_VERSION="$(PKG_REV)" \
|
||||
CC="$(TARGET_CC)" \
|
||||
INSTALL_DIR="$(PKG_INSTALL_DIR)" \
|
||||
STRIP="/bin/false" \
|
||||
build_all
|
||||
|
||||
define Package/bmx6/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Routing and Redirection
|
||||
TITLE:=BMX6 layer 3 routing daemon
|
||||
URL:=http://bmx6.net/
|
||||
MAINTAINER:=Axel Neumann <neumann@cgws.de>
|
||||
DEPENDS:=+kmod-ip6-tunnel +kmod-iptunnel6
|
||||
endef
|
||||
|
||||
define Package/bmx6/description
|
||||
BMX6 layer 3 routing daemon supporting IPv4, IPv6, and IPv4 over IPv6
|
||||
endef
|
||||
|
||||
define Package/bmx6
|
||||
$(call Package/bmx6/Default)
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/bmx6-uci-config
|
||||
$(call Package/bmx6/Default)
|
||||
DEPENDS:=bmx6 +libuci
|
||||
TITLE:=configuration plugin based on uci (recommended!)
|
||||
endef
|
||||
|
||||
|
||||
define Package/bmx6-json
|
||||
$(call Package/bmx6/Default)
|
||||
DEPENDS:=bmx6 +libjson
|
||||
TITLE:=json plugin based on jsonc
|
||||
endef
|
||||
|
||||
define Package/bmx6-sms
|
||||
$(call Package/bmx6/Default)
|
||||
DEPENDS:=bmx6
|
||||
TITLE:=sms plugin
|
||||
endef
|
||||
|
||||
define Package/bmx6-quagga
|
||||
$(call Package/bmx6/Default)
|
||||
DEPENDS:=bmx6 +qmp-quagga @BROKEN
|
||||
TITLE:=bmx6 quagga plugin to redistribute/export routes (needs manet/bmx6 patched quagga 0.99.21)
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
mkdir -p $(PKG_INSTALL_DIR)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS)
|
||||
endef
|
||||
|
||||
|
||||
define Package/bmx6/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bmx6 $(1)/usr/sbin/bmx6
|
||||
endef
|
||||
|
||||
|
||||
define Package/bmx6-uci-config/conffiles
|
||||
/etc/config/bmx6
|
||||
endef
|
||||
|
||||
|
||||
define Package/bmx6-uci-config/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib $(1)/etc/config $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx6_uci_config/bmx6_config.so $(1)/usr/lib/bmx6_config.so
|
||||
$(INSTALL_BIN) ./files/etc/init.d/bmx6 $(1)/etc/init.d/bmx6
|
||||
$(INSTALL_DATA) ./files/etc/config/bmx6 $(1)/etc/config/bmx6
|
||||
endef
|
||||
|
||||
define Package/bmx6-json/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx6_json/bmx6_json.so $(1)/usr/lib/bmx6_json.so
|
||||
endef
|
||||
|
||||
define Package/bmx6-sms/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx6_sms/bmx6_sms.so $(1)/usr/lib/bmx6_sms.so
|
||||
endef
|
||||
|
||||
define Package/bmx6-quagga/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx6_quagga/bmx6_quagga.so $(1)/usr/lib/bmx6_quagga.so
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bmx6))
|
||||
$(eval $(call BuildPackage,bmx6-uci-config))
|
||||
$(eval $(call BuildPackage,bmx6-json))
|
||||
$(eval $(call BuildPackage,bmx6-sms))
|
||||
$(eval $(call BuildPackage,bmx6-quagga))
|
||||
|
82
bmx6/files/etc/config/bmx6
Normal file
82
bmx6/files/etc/config/bmx6
Normal file
|
@ -0,0 +1,82 @@
|
|||
|
||||
# for more information:
|
||||
# http://bmx6.net/projects/bmx6/wiki
|
||||
# options execute: bmx6 --help
|
||||
|
||||
config 'bmx6' 'general'
|
||||
# option 'runtimeDir' '/var/run/bmx6'
|
||||
# option 'tun4Address' '10.202.0.116/32'
|
||||
# option 'tun4Address' '10.254.10.0/32'
|
||||
# option 'tun6Address' '2012:0:0:1000::1/64'
|
||||
|
||||
#config 'ipVersion' 'ipVersion'
|
||||
# option 'ipVersion' '6' # default is 4
|
||||
# option 'throwRules' '0'
|
||||
|
||||
|
||||
#config 'plugin'
|
||||
# option 'plugin' 'bmx6_config.so'
|
||||
|
||||
|
||||
|
||||
#config 'plugin'
|
||||
# option 'plugin' 'bmx6_json.so'
|
||||
|
||||
|
||||
|
||||
#config 'plugin'
|
||||
# option 'plugin' 'bmx6_sms.so'
|
||||
|
||||
|
||||
config 'dev' 'mesh_1'
|
||||
option 'dev' 'eth0.12'
|
||||
|
||||
config 'dev' 'mesh_2'
|
||||
option 'dev' 'ath0.12'
|
||||
|
||||
|
||||
|
||||
#config 'hna' 'my_global_prefix'
|
||||
# option 'hna' '2012:0:0:74:0:0:0:0/64'
|
||||
|
||||
|
||||
#config 'tunOut'
|
||||
# option 'tunOut' 'ip6'
|
||||
# option 'network' '2012::/16'
|
||||
# option 'exportDistance' '0'
|
||||
|
||||
#config 'tunOut'
|
||||
# option 'tunOut' 'ip4'
|
||||
# option 'network' '10.254.0.0/16'
|
||||
# option 'exportDistance' '0' # requires quagga plugin !
|
||||
# option 'minPrefixLen' '27'
|
||||
|
||||
|
||||
|
||||
#config 'plugin'
|
||||
# option 'plugin' 'bmx6_quagga.so'
|
||||
|
||||
|
||||
|
||||
#config 'redistribute'
|
||||
# option 'redistribute' 'ospf6'
|
||||
# option 'network' '10.0.0.0/8'
|
||||
# option 'minPrefixLen' '10'
|
||||
# option 'bandwidth' '10000000'
|
||||
# option 'ospf6' '1'
|
||||
# option 'aggregatePrefixLen' '16'
|
||||
|
||||
#config 'redistribute'
|
||||
# option 'redistribute' 'bgp'
|
||||
# option 'network' '0.0.0.0/0'
|
||||
# option 'minPrefixLen' '0'
|
||||
# option 'maxPrefixLen' '24'
|
||||
# option 'bandwidth' '10000000'
|
||||
# option 'bgp' '1'
|
||||
# option 'aggregatePrefixLen' '8'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
40
bmx6/files/etc/init.d/bmx6
Executable file
40
bmx6/files/etc/init.d/bmx6
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2011 Fundacio Privada per a la Xarxa Oberta, Lliure i Neutral guifi.net
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# The full GNU General Public License is included in this distribution in
|
||||
# the file called "COPYING".
|
||||
|
||||
START=91
|
||||
|
||||
BIN=/usr/sbin/bmx6
|
||||
CONF=/etc/config/bmx6
|
||||
PID=/var/run/bmx6/pid
|
||||
|
||||
|
||||
start() {
|
||||
cd /root/
|
||||
ulimit -c 20000
|
||||
$BIN -f $CONF -d0 > /dev/null &
|
||||
}
|
||||
|
||||
stop() {
|
||||
start-stop-daemon -p $PID -K
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop; sleep 3; start
|
||||
}
|
163
bmx7/Makefile
163
bmx7/Makefile
|
@ -1,163 +0,0 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bmx7
|
||||
PKG_VERSION:=7.1.1
|
||||
PKG_RELEASE:=5
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/bmx-routing/bmx7/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=5f88df1c95e5cb842a6016bb1604e3e7f6097c63c5c9916edc3c84e96d4f5f65
|
||||
|
||||
PKG_MAINTAINER:=Axel Neumann <neumann@cgws.de>
|
||||
PKG_LICENSE:=GPL-2.0-or-later
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TARGET_CFLAGS += $(FPIC)
|
||||
|
||||
MAKE_ARGS += EXTRA_CFLAGS="$(TARGET_CFLAGS) \
|
||||
-I. \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-DCRYPTLIB=MBEDTLS_2_8_0 \
|
||||
-DCORE_LIMIT=20000 \
|
||||
-DTRAFFIC_DUMP \
|
||||
-DNO_TRACE_FUNCTION_CALLS \
|
||||
-DBMX7_LIB_IWINFO" \
|
||||
EXTRA_LDFLAGS="$(TARGET_LDFLAGS) \
|
||||
-L$(STAGING_DIR)/usr/lib -liwinfo" \
|
||||
GIT_REV="$(PKG_REV)" \
|
||||
CC="$(TARGET_CC)" \
|
||||
INSTALL_DIR="$(PKG_INSTALL_DIR)" \
|
||||
build_all
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/bmx7/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Routing and Redirection
|
||||
TITLE:=BMX7 layer 3 routing daemon
|
||||
URL:=https://github.com/bmx-routing/bmx7
|
||||
DEPENDS:=+zlib +libmbedtls +libiwinfo
|
||||
endef
|
||||
|
||||
define Package/bmx7/description
|
||||
BMX7 routing daemon supporting securely-entrusted IPv6 (and IPv4in6) routing
|
||||
endef
|
||||
|
||||
define Package/bmx7
|
||||
$(call Package/bmx7/Default)
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/bmx7-uci-config
|
||||
$(call Package/bmx7/Default)
|
||||
DEPENDS:=bmx7 +libuci
|
||||
TITLE:=configuration plugin based on uci (recommended!)
|
||||
endef
|
||||
|
||||
define Package/bmx7-iwinfo
|
||||
$(call Package/bmx7/Default)
|
||||
DEPENDS:=bmx7 +libiwinfo
|
||||
TITLE:=link characteristics plugin via libiwinfo (recommended!)
|
||||
endef
|
||||
|
||||
define Package/bmx7-topology
|
||||
$(call Package/bmx7/Default)
|
||||
DEPENDS:=bmx7
|
||||
TITLE:=topology plugin
|
||||
endef
|
||||
|
||||
define Package/bmx7-json
|
||||
$(call Package/bmx7/Default)
|
||||
DEPENDS:=bmx7 +libjson-c
|
||||
TITLE:=json plugin based on json-c
|
||||
endef
|
||||
|
||||
define Package/bmx7-sms
|
||||
$(call Package/bmx7/Default)
|
||||
DEPENDS:=bmx7
|
||||
TITLE:=sms plugin
|
||||
endef
|
||||
|
||||
define Package/bmx7-tun
|
||||
$(call Package/bmx7/Default)
|
||||
DEPENDS:=bmx7 +kmod-ip6-tunnel +kmod-iptunnel6 +kmod-tun
|
||||
TITLE:=ipip-based tunnel plugin (recommended!)
|
||||
endef
|
||||
|
||||
define Package/bmx7-table
|
||||
$(call Package/bmx7/Default)
|
||||
DEPENDS:=bmx7 +bmx7-tun
|
||||
TITLE:=plugin to announce routes from tables via tunnels
|
||||
endef
|
||||
|
||||
define Package/bmx7/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/bmx7 $(1)/usr/sbin/bmx7
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) $(MAKE_ARGS)
|
||||
endef
|
||||
|
||||
define Package/bmx7-uci-config/conffiles
|
||||
/etc/config/bmx7
|
||||
/etc/bmx7
|
||||
endef
|
||||
|
||||
define Package/bmx7-uci-config/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib $(1)/etc/config $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_uci_config/bmx7_config.so \
|
||||
$(1)/usr/lib/bmx7_config.so
|
||||
$(INSTALL_BIN) ./files/etc/init.d/bmx7 $(1)/etc/init.d/bmx7
|
||||
$(INSTALL_DATA) ./files/etc/config/bmx7 $(1)/etc/config/bmx7
|
||||
endef
|
||||
|
||||
define Package/bmx7-iwinfo/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_iwinfo/bmx7_iwinfo.so \
|
||||
$(1)/usr/lib/bmx7_iwinfo.so
|
||||
endef
|
||||
|
||||
define Package/bmx7-topology/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_topology/bmx7_topology.so \
|
||||
$(1)/usr/lib/bmx7_topology.so
|
||||
endef
|
||||
|
||||
define Package/bmx7-json/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_json/bmx7_json.so \
|
||||
$(1)/usr/lib/bmx7_json.so
|
||||
endef
|
||||
|
||||
define Package/bmx7-sms/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_sms/bmx7_sms.so \
|
||||
$(1)/usr/lib/bmx7_sms.so
|
||||
endef
|
||||
|
||||
define Package/bmx7-tun/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_tun/bmx7_tun.so \
|
||||
$(1)/usr/lib/bmx7_tun.so
|
||||
endef
|
||||
|
||||
define Package/bmx7-table/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_table/bmx7_table.so \
|
||||
$(1)/usr/lib/bmx7_table.so
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bmx7))
|
||||
$(eval $(call BuildPackage,bmx7-uci-config))
|
||||
$(eval $(call BuildPackage,bmx7-iwinfo))
|
||||
$(eval $(call BuildPackage,bmx7-topology))
|
||||
$(eval $(call BuildPackage,bmx7-json))
|
||||
$(eval $(call BuildPackage,bmx7-sms))
|
||||
$(eval $(call BuildPackage,bmx7-table))
|
||||
$(eval $(call BuildPackage,bmx7-tun))
|
|
@ -1,47 +0,0 @@
|
|||
# for more information:
|
||||
# https://github.com/bmx-routing/bmx7/
|
||||
# options execute: bmx7 --help
|
||||
|
||||
config 'bmx7' 'general'
|
||||
# option 'runtimeDir' '/var/run/bmx7'
|
||||
# option 'trustedNodesDir' '/etc/bmx7/trustedNodes'
|
||||
|
||||
#config 'plugin'
|
||||
# option 'plugin' 'bmx7_config.so'
|
||||
|
||||
#config 'plugin'
|
||||
# option 'plugin' 'bmx7_json.so'
|
||||
|
||||
#config 'plugin'
|
||||
# option 'plugin' 'bmx7_sms.so'
|
||||
|
||||
#config 'plugin'
|
||||
# option 'plugin' 'bmx7_iwinfo.so'
|
||||
|
||||
config 'dev' 'mesh_1'
|
||||
option 'dev' 'br-lan'
|
||||
|
||||
config 'dev' 'mesh_2'
|
||||
option 'dev' 'wlan0'
|
||||
|
||||
#config 'plugin'
|
||||
# option 'plugin' 'bmx7_tun.so'
|
||||
|
||||
#config 'plugin'
|
||||
# option 'plugin' 'bmx7_table.so'
|
||||
|
||||
#config 'tunDev' default
|
||||
# option 'tunDev' 'default'
|
||||
# option 'tun6Address' '2012:0:0:6666::1/64'
|
||||
# option 'tun4Address' '10.66.66.1/24'
|
||||
|
||||
|
||||
#config 'tunOut'
|
||||
# option 'tunOut' 'ip6'
|
||||
# option 'network' '2012::/16'
|
||||
# option 'exportDistance' '0'
|
||||
|
||||
#config 'tunOut'
|
||||
# option 'tunOut' 'ip4'
|
||||
# option 'network' '10.0.0.0/9'
|
||||
# option 'minPrefixLen' '27'
|
|
@ -1,28 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
START=91
|
||||
USE_PROCD=1
|
||||
|
||||
BIN=/usr/sbin/bmx7
|
||||
CONF=/etc/config/bmx7
|
||||
|
||||
start_service() {
|
||||
cd /root/ || return
|
||||
while pgrep -f mac80211.sh ; do sleep 1; done
|
||||
|
||||
procd_open_instance "bmx7"
|
||||
procd_set_param command "$BIN"
|
||||
procd_append_param command -f "$CONF" -d0
|
||||
procd_set_param limits core=20000
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
"$BIN" -c configReload
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "bmx7"
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
--- a/src/bmx.h
|
||||
+++ b/src/bmx.h
|
||||
@@ -290,7 +290,7 @@ enum ADGSN {
|
||||
#define SUCCESS 0
|
||||
#define FAILURE -1
|
||||
|
||||
-const void* FAILURE_PTR;
|
||||
+extern const void* FAILURE_PTR;
|
||||
|
||||
|
||||
#define MAX_SELECT_TIMEOUT_MS 1100 /* MUST be smaller than (1000/2) to fit into max tv_usec */
|
|
@ -1,38 +0,0 @@
|
|||
--- a/src/schedule.c
|
||||
+++ b/src/schedule.c
|
||||
@@ -375,7 +375,9 @@ loop4Event:
|
||||
continue;
|
||||
}
|
||||
|
||||
+#ifdef SIOCGSTAMP
|
||||
ioctl(pb.i.iif->rx_mcast_sock, SIOCGSTAMP, &(pb.i.tv_stamp));
|
||||
+#endif
|
||||
|
||||
rx_packet(&pb);
|
||||
|
||||
@@ -401,7 +403,9 @@ loop4Event:
|
||||
continue;
|
||||
}
|
||||
|
||||
+#ifdef SIOCGSTAMP
|
||||
ioctl(pb.i.iif->rx_fullbrc_sock, SIOCGSTAMP, &(pb.i.tv_stamp));
|
||||
+#endif
|
||||
|
||||
rx_packet(&pb);
|
||||
|
||||
@@ -451,10 +455,15 @@ loop4Event:
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+#ifdef SIOCGSTAMP
|
||||
if (tv_stamp == NULL)
|
||||
ioctl(pb.i.iif->unicast_sock, SIOCGSTAMP, &(pb.i.tv_stamp));
|
||||
else
|
||||
timercpy(&(pb.i.tv_stamp), tv_stamp);
|
||||
+#else
|
||||
+ if (tv_stamp)
|
||||
+ timercpy(&(pb.i.tv_stamp), tv_stamp);
|
||||
+#endif
|
||||
|
||||
rx_packet(&pb);
|
||||
|
75
bmxd/Makefile
Normal file
75
bmxd/Makefile
Normal file
|
@ -0,0 +1,75 @@
|
|||
#
|
||||
# Copyright (C) 2008 Freifunk Leipzig
|
||||
# Copyright (C) 2008-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:=bmxd
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=git://github.com/axn/bmxd.git
|
||||
PKG_REV:=9c1d12b554dccd2efde249f5e44a7d4de59ce1a8
|
||||
PKG_VERSION:=r2012011001
|
||||
#PKG_RELEASE:=1
|
||||
PKG_SOURCE_VERSION:=$(PKG_REV)
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
|
||||
|
||||
PKG_EXTRA_CFLAGS:=-DNODEBUGALL
|
||||
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/bmxd/Default
|
||||
URL:=http://www.bmx6.net/
|
||||
MAINTAINER:=Axel Neumann <neumann@cgws.de>
|
||||
endef
|
||||
|
||||
define Package/bmxd
|
||||
$(call Package/bmxd/Default)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Routing and Redirection
|
||||
DEPENDS:=+kmod-tun
|
||||
TITLE:=B.a.t.M.a.n. eXperimental (BMX) layer 3 routing daemon
|
||||
endef
|
||||
|
||||
define Package/bmxd/conffiles
|
||||
/etc/config/bmxd
|
||||
endef
|
||||
|
||||
|
||||
define Package/bmxd/description
|
||||
B.a.t.M.a.n. eXperimental (BMX) layer 3 routing daemon
|
||||
endef
|
||||
|
||||
MAKE_ARGS += \
|
||||
EXTRA_CFLAGS="$(TARGET_CFLAGS) $(PKG_EXTRA_CFLAGS)" \
|
||||
CCFLAGS="$(TARGET_CFLAGS)" \
|
||||
OFLAGS="$(TARGET_CFLAGS)" \
|
||||
REVISION="$(PKG_REV)" \
|
||||
CC="$(TARGET_CC)" \
|
||||
NODEBUG=1 \
|
||||
UNAME="Linux" \
|
||||
INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
|
||||
STRIP="/bin/true" \
|
||||
bmxd install
|
||||
|
||||
define Build/Compile
|
||||
mkdir -p $(PKG_INSTALL_DIR)/usr/sbin
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS)
|
||||
endef
|
||||
|
||||
define Package/bmxd/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bmxd $(1)/usr/sbin/bmxd
|
||||
$(INSTALL_BIN) ./files/etc/init.d/bmxd $(1)/etc/init.d
|
||||
$(INSTALL_DATA) ./files/etc/config/bmxd $(1)/etc/config
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bmxd))
|
9
bmxd/files/etc/config/bmxd
Normal file
9
bmxd/files/etc/config/bmxd
Normal file
|
@ -0,0 +1,9 @@
|
|||
config bmxd general
|
||||
option interface 'ath0'
|
||||
# option announce
|
||||
# option gateway_class
|
||||
# option originator_interval
|
||||
# option preferred_gateway
|
||||
# option routing_class
|
||||
# option visualisation_srv
|
||||
# option misc 'base-port=14305'
|
51
bmxd/files/etc/init.d/bmxd
Normal file
51
bmxd/files/etc/init.d/bmxd
Normal file
|
@ -0,0 +1,51 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
START=91
|
||||
. /lib/config/uci.sh
|
||||
uci_load bmxd
|
||||
start () {
|
||||
interface="$(uci get bmxd.general.interface)"
|
||||
if [ "$interface" = "" ]; then
|
||||
echo $1 Error, you must specify at least a network interface
|
||||
exit
|
||||
fi
|
||||
announce=$(uci get bmxd.general.announce)
|
||||
gateway_class=$(uci get bmxd.general.gateway_class)
|
||||
originator_interval=$(uci get bmxd.general.originator_interval)
|
||||
preferred_gateway=$(uci get bmxd.general.preferred_gateway)
|
||||
routing_class=$(uci get bmxd.general.routing_class)
|
||||
visualisation_srv=$(uci get bmxd.general.visualisation_srv)
|
||||
misc="$(uci get bmxd.general.misc)"
|
||||
bmx_args=""
|
||||
|
||||
if [ $announce ]; then
|
||||
bmx_args=${bmx_args}'-a '$announce' '
|
||||
fi
|
||||
|
||||
if [ $gateway_class ]; then
|
||||
bmx_args=${bmx_args}'-g '$gateway_class' '
|
||||
fi
|
||||
|
||||
if [ $originator_interval ]; then
|
||||
bmx_args=${bmx_args}'-o '$originator_interval' '
|
||||
fi
|
||||
|
||||
if [ $preferred_gateway ]; then
|
||||
bmx_args=${bmx_args}'-p '$preferred_gateway' '
|
||||
fi
|
||||
|
||||
if [ $routing_class ]; then
|
||||
bmx_args=${bmx_args}'-r '$routing_class' '
|
||||
fi
|
||||
|
||||
if [ $visualisation_srv ]; then
|
||||
bmx_args=${bmx_args}'-s '$visualisation_srv' '
|
||||
fi
|
||||
|
||||
|
||||
bmx_args="$misc ${bmx_args} $interface"
|
||||
bmxd $bmx_args >/dev/null 2>&1
|
||||
}
|
||||
|
||||
stop () {
|
||||
killall bmxd
|
||||
}
|
146
cjdns/Makefile
146
cjdns/Makefile
|
@ -1,146 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2014,2015 Hyperboria.net
|
||||
#
|
||||
# You may redistribute this program and/or modify it under the terms of
|
||||
# the GNU General Public License as published by the Free Software Foundation,
|
||||
# either version 3 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=cjdns
|
||||
PKG_VERSION:=v21.1
|
||||
PKG_RELEASE:=5
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/cjdelisle/cjdns/tar.gz/$(PKG_NAME)-$(PKG_VERSION)?
|
||||
PKG_HASH:=a6158ce7847159aa44e86f74ccc7b6ded6910a230ed8f3830db53cda5838f0b0
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_MAINTAINER:=William Fleurant <meshnet@protonmail.com>
|
||||
PKG_LICENSE:=GPL-3.0-or-later
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/cjdns
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Routing and Redirection
|
||||
TITLE:=Encrypted near-zero-conf mesh routing protocol
|
||||
URL:=https://github.com/cjdelisle/cjdns
|
||||
DEPENDS:=@!arc @IPV6 +kmod-tun +libnl-tiny +libpthread +librt \
|
||||
+libuci-lua +lua-bencode +dkjson +luasocket +lua-sha2
|
||||
endef
|
||||
|
||||
define Package/cjdns/description
|
||||
Cjdns implements an encrypted IPv6 network using public-key cryptography \
|
||||
for address allocation and a distributed hash table for routing. \
|
||||
This provides near-zero-configuration networking, and prevents many \
|
||||
of the security and scalability issues that plague existing networks.
|
||||
endef
|
||||
|
||||
define Package/cjdns-tests
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Routing and Redirection
|
||||
TITLE:=cjdns test cases
|
||||
URL:=https://github.com/cjdelisle/cjdns
|
||||
DEPENDS:=+libpthread +librt @!arc
|
||||
endef
|
||||
|
||||
define Package/cjdns-test/description
|
||||
Builds cjdns test cases binary test_testcjdroute_c
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
PKG_DO_VARS:=CJDNS_RELEASE_VERSION=$(PKG_SOURCE_VERSION)
|
||||
|
||||
ifneq ($(CONFIG_KERNEL_SECCOMP_FILTER),y)
|
||||
PKG_DO_VARS+= Seccomp_NO=1
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_USE_UCLIBC),)
|
||||
PKG_DO_VARS+= UCLIBC=1
|
||||
endif
|
||||
|
||||
define Build/Compile
|
||||
$(INSTALL_DIR) $(PKG_BUILD_DIR)/tmp
|
||||
(cd $(PKG_BUILD_DIR) && \
|
||||
CROSS="true" \
|
||||
CC="$(TARGET_CC_NOCACHE)" \
|
||||
AR="$(TARGET_AR)" \
|
||||
RANLIB="$(TARGET_RANLIB)" \
|
||||
CFLAGS="$(TARGET_CFLAGS) -U_FORTIFY_SOURCE -Wno-error=array-bounds -Wno-error=stringop-overflow -Wno-error=stringop-overread" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
SYSTEM="linux" \
|
||||
TARGET_ARCH="$(CONFIG_ARCH)" \
|
||||
SSP_SUPPORT="$(CONFIG_SSP_SUPPORT)" \
|
||||
GYP_ADDITIONAL_ARGS="-f make-linux" \
|
||||
CJDNS_BUILD_TMPDIR="$(PKG_BUILD_DIR)/tmp" \
|
||||
$(PKG_DO_VARS) \
|
||||
exec ./do)
|
||||
endef
|
||||
|
||||
define Package/cjdns/install
|
||||
$(INSTALL_DIR) \
|
||||
$(1)/usr/sbin \
|
||||
$(1)/usr/bin \
|
||||
$(1)/etc/config \
|
||||
$(1)/etc/init.d \
|
||||
$(1)/etc/uci-defaults \
|
||||
$(1)/usr/lib/lua/cjdns
|
||||
|
||||
$(INSTALL_BIN) \
|
||||
./files/cjdrouteconf \
|
||||
$(1)/usr/bin
|
||||
|
||||
$(INSTALL_BIN) \
|
||||
$(PKG_BUILD_DIR)/cjdroute \
|
||||
$(1)/usr/sbin
|
||||
|
||||
$(INSTALL_BIN) \
|
||||
$(PKG_BUILD_DIR)/publictoip6 \
|
||||
$(1)/usr/bin
|
||||
|
||||
$(INSTALL_BIN) \
|
||||
./files/cjdns.init \
|
||||
$(1)/etc/init.d/cjdns
|
||||
|
||||
$(INSTALL_BIN) \
|
||||
./files/cjdns.defaults \
|
||||
$(1)/etc/uci-defaults/cjdns
|
||||
|
||||
$(CP) \
|
||||
./lua/cjdns/* \
|
||||
$(1)/usr/lib/lua/cjdns
|
||||
endef
|
||||
|
||||
define Package/cjdns/postinst
|
||||
#!/bin/sh
|
||||
if [ -z $${IPKG_INSTROOT} ] ; then
|
||||
( . /etc/uci-defaults/cjdns ) && rm -f /etc/uci-defaults/cjdns
|
||||
/etc/init.d/cjdns enabled || /etc/init.d/cjdns enable
|
||||
exit 0
|
||||
fi
|
||||
endef
|
||||
|
||||
define Package/cjdns-tests/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) \
|
||||
$(PKG_BUILD_DIR)/build_linux/test_testcjdroute_c \
|
||||
$(1)/usr/bin
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,cjdns))
|
||||
$(eval $(call BuildPackage,cjdns-tests))
|
|
@ -1,120 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# if there is an existing config, our work is already done
|
||||
uci get cjdns.cjdns.ipv6 >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
|
||||
# register commit handler
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@cjdns[-1]
|
||||
add ucitrack cjdns
|
||||
set ucitrack.@cjdns[-1].init=cjdns
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
# generate configuration
|
||||
touch /etc/config/cjdns
|
||||
cjdroute --genconf | cjdroute --cleanconf | cjdrouteconf set
|
||||
|
||||
# make sure config is present (might fail for any reason)
|
||||
uci get cjdns.cjdns.ipv6 >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# enable auto-peering on ethernet interface lan, if existing
|
||||
ifname=$(uci -q get network.lan.device || \
|
||||
([ "$(uci -q get network.lan.type)" == "bridge" ] && echo br-lan) || \
|
||||
uci -q get network.lan.ifname)
|
||||
if [ -n "$ifname" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
add cjdns eth_interface
|
||||
set cjdns.@eth_interface[-1].beacon=2
|
||||
set cjdns.@eth_interface[-1].bind=$ifname
|
||||
EOF
|
||||
fi
|
||||
# set the tun interface name
|
||||
uci set cjdns.cjdns.tun_device=tuncjdns
|
||||
|
||||
# create the network interface
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set network.cjdns=interface
|
||||
set network.cjdns.device=tuncjdns
|
||||
set network.cjdns.proto=none
|
||||
EOF
|
||||
|
||||
# firewall rules by @dangowrt -- thanks <3
|
||||
|
||||
# create the firewall zone
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
add firewall zone
|
||||
set firewall.@zone[-1].name=cjdns
|
||||
add_list firewall.@zone[-1].network=cjdns
|
||||
set firewall.@zone[-1].input=REJECT
|
||||
set firewall.@zone[-1].output=ACCEPT
|
||||
set firewall.@zone[-1].forward=REJECT
|
||||
set firewall.@zone[-1].conntrack=1
|
||||
set firewall.@zone[-1].family=ipv6
|
||||
EOF
|
||||
|
||||
# allow ICMP from cjdns zone, e.g. ping6
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
add firewall rule
|
||||
set firewall.@rule[-1].name='Allow-ICMPv6-cjdns'
|
||||
set firewall.@rule[-1].src=cjdns
|
||||
set firewall.@rule[-1].proto=icmp
|
||||
add_list firewall.@rule[-1].icmp_type=echo-request
|
||||
add_list firewall.@rule[-1].icmp_type=echo-reply
|
||||
add_list firewall.@rule[-1].icmp_type=destination-unreachable
|
||||
add_list firewall.@rule[-1].icmp_type=packet-too-big
|
||||
add_list firewall.@rule[-1].icmp_type=time-exceeded
|
||||
add_list firewall.@rule[-1].icmp_type=bad-header
|
||||
add_list firewall.@rule[-1].icmp_type=unknown-header-type
|
||||
set firewall.@rule[-1].limit='1000/sec'
|
||||
set firewall.@rule[-1].family=ipv6
|
||||
set firewall.@rule[-1].target=ACCEPT
|
||||
EOF
|
||||
|
||||
# allow SSH from cjdns zone, needs to be explicitly enabled
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
add firewall rule
|
||||
set firewall.@rule[-1].enabled=0
|
||||
set firewall.@rule[-1].name='Allow-SSH-cjdns'
|
||||
set firewall.@rule[-1].src=cjdns
|
||||
set firewall.@rule[-1].proto=tcp
|
||||
set firewall.@rule[-1].dest_port=22
|
||||
set firewall.@rule[-1].target=ACCEPT
|
||||
EOF
|
||||
|
||||
# allow LuCI access from cjdns zone, needs to be explicitly enabled
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
add firewall rule
|
||||
set firewall.@rule[-1].enabled=0
|
||||
set firewall.@rule[-1].name='Allow-HTTP-cjdns'
|
||||
set firewall.@rule[-1].src=cjdns
|
||||
set firewall.@rule[-1].proto=tcp
|
||||
set firewall.@rule[-1].dest_port=80
|
||||
set firewall.@rule[-1].target=ACCEPT
|
||||
EOF
|
||||
|
||||
# allow UDP peering from wan zone, if it exists
|
||||
uci show network.wan >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
peeringPort=`uci get cjdns.@udp_interface[0].port`
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
add firewall rule
|
||||
set firewall.@rule[-1].name='Allow-cjdns-wan'
|
||||
set firewall.@rule[-1].src=wan
|
||||
set firewall.@rule[-1].proto=udp
|
||||
set firewall.@rule[-1].dest_port=$peeringPort
|
||||
set firewall.@rule[-1].target=ACCEPT
|
||||
EOF
|
||||
fi
|
||||
|
||||
uci commit cjdns
|
||||
uci commit firewall
|
||||
uci commit network
|
||||
|
||||
fi
|
||||
|
||||
exit 0
|
|
@ -1,32 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=90
|
||||
STOP=85
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
start_service()
|
||||
{
|
||||
[ -f /etc/uci-defaults/cjdns ] && ( . /etc/uci-defaults/cjdns )
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param respawn
|
||||
procd_set_param command /bin/ash -c "cjdrouteconf get | tee /tmp/etc/cjdroute.conf | cjdroute --nobg | logger -t cjdns"
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop_service()
|
||||
{
|
||||
killall cjdroute
|
||||
}
|
||||
|
||||
reload_service()
|
||||
{
|
||||
# cat /tmp/etc/cjdroute.conf | cjdrouteconf reload
|
||||
restart
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger cjdns
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
#!/usr/bin/env lua
|
||||
|
||||
dkjson = require("dkjson")
|
||||
cjdns = require("cjdns")
|
||||
require("cjdns/uci")
|
||||
|
||||
function help()
|
||||
print("JSON interface to /etc/config/cjdns\n\nExamples: \
|
||||
cjdrouteconf get > /tmp/etc/cjdroute.conf \
|
||||
cat /tmp/etc/cjdroute.conf | cjdrouteconf set \
|
||||
uci changes \
|
||||
cjdrouteconf get | cjdroute")
|
||||
end
|
||||
|
||||
if arg[1] == "get" then
|
||||
local json = dkjson.encode(cjdns.uci.get(), { indent = true })
|
||||
print(json)
|
||||
elseif arg[1] == "set" then
|
||||
local json = io.stdin:read("*a")
|
||||
local obj, pos, err = dkjson.decode(json, 1, nil)
|
||||
|
||||
if obj then
|
||||
cjdns.uci.set(obj)
|
||||
else
|
||||
print("dkjson: " .. err .. " (try cjdroute --cleanconf)")
|
||||
os.exit(1)
|
||||
end
|
||||
else
|
||||
help()
|
||||
end
|
|
@ -1,105 +0,0 @@
|
|||
-- Cjdns admin module for Lua
|
||||
-- Written by Philip Horger
|
||||
|
||||
common = require 'cjdns/common'
|
||||
|
||||
AdminInterface = {}
|
||||
AdminInterface.__index = AdminInterface
|
||||
common.AdminInterface = AdminInterface
|
||||
|
||||
function AdminInterface.new(properties)
|
||||
properties = properties or {}
|
||||
|
||||
properties.host = properties.host or "127.0.0.1"
|
||||
properties.port = properties.port or 11234
|
||||
properties.password = properties.password or nil
|
||||
properties.config = properties.config or common.ConfigFile.new("/etc/cjdroute.conf", false)
|
||||
properties.timeout = properties.timeout or 2
|
||||
|
||||
properties.udp = common.UDPInterface.new(properties)
|
||||
|
||||
return setmetatable(properties, AdminInterface)
|
||||
end
|
||||
|
||||
function AdminInterface:send(object)
|
||||
local bencoded, err = bencode.encode(object)
|
||||
if err then
|
||||
return nil, err
|
||||
end
|
||||
|
||||
local sock_obj = assert(socket.udp())
|
||||
sock_obj:settimeout(self.timeout)
|
||||
|
||||
local _, err = sock_obj:sendto(bencoded, self.host, self.port)
|
||||
if err then
|
||||
return nil, err
|
||||
end
|
||||
|
||||
return sock_obj
|
||||
end
|
||||
|
||||
function AdminInterface:recv(sock_obj)
|
||||
local retrieved, err = sock_obj:receive()
|
||||
if not retrieved then
|
||||
return nil, "ai:recv > " .. err
|
||||
end
|
||||
local bencoded, err = bencode.decode(retrieved)
|
||||
if bencoded then
|
||||
return bencoded
|
||||
else
|
||||
return nil, "ai:recv > " .. err
|
||||
end
|
||||
end
|
||||
|
||||
function AdminInterface:call(request)
|
||||
local sock_obj, err = self:send(request)
|
||||
if err then
|
||||
return nil, "ai:call > " .. err
|
||||
end
|
||||
|
||||
return self:recv(sock_obj)
|
||||
end
|
||||
|
||||
function AdminInterface:getCookie()
|
||||
local cookie_response, err = self:call({ q = "cookie" })
|
||||
if not cookie_response then
|
||||
return nil, "ai:getCookie > " .. err
|
||||
end
|
||||
return cookie_response.cookie
|
||||
end
|
||||
|
||||
function AdminInterface:auth(request)
|
||||
local funcname = request.q
|
||||
local args = {}
|
||||
for k, v in pairs(request) do
|
||||
args[k] = v
|
||||
end
|
||||
|
||||
-- Step 1: Get cookie
|
||||
local cookie, err = self:getCookie()
|
||||
if err then
|
||||
return nil, err
|
||||
end
|
||||
|
||||
-- Step 2: Calculate hash1 (password + cookie)
|
||||
local plaintext1 = self.password .. cookie
|
||||
local hash1 = sha2.sha256hex(plaintext1)
|
||||
|
||||
-- Step 3: Calculate hash2 (intermediate stage request)
|
||||
local request = {
|
||||
q = "auth",
|
||||
aq = funcname,
|
||||
args = args,
|
||||
hash = hash1,
|
||||
cookie = cookie
|
||||
}
|
||||
local plaintext2, err = bencode.encode(request)
|
||||
if err then
|
||||
return nil, err
|
||||
end
|
||||
local hash2 = sha2.sha256hex(plaintext2)
|
||||
|
||||
-- Step 4: Update hash in request, then ship it out
|
||||
request.hash = hash2
|
||||
return self:call(request)
|
||||
end
|
|
@ -1,7 +0,0 @@
|
|||
-- Cjdns admin module for Lua
|
||||
-- Written by Philip Horger
|
||||
|
||||
-- This table is preserved over multiple imports, and collects
|
||||
-- submodules import-by-import via init.lua.
|
||||
|
||||
return {}
|
|
@ -1,12 +0,0 @@
|
|||
-- Cjdns admin module for Lua
|
||||
-- Written by Philip Horger
|
||||
|
||||
bencode = require "bencode" -- https://bitbucket.org/wilhelmy/lua-bencode/
|
||||
dkjson = require "dkjson" -- http://dkolf.de/src/dkjson-lua.fsl/home
|
||||
socket = require "socket" -- http://w3.impa.br/~diego/software/luasocket/
|
||||
sha2 = require "sha2" -- https://code.google.com/p/sha2/
|
||||
|
||||
require "cjdns/admin"
|
||||
require "cjdns/udp"
|
||||
|
||||
return require "cjdns/common"
|
|
@ -1,294 +0,0 @@
|
|||
common = require("cjdns/common")
|
||||
uci = require("uci")
|
||||
|
||||
UCI = {}
|
||||
common.uci = UCI
|
||||
|
||||
--- Return the configuration defaults as a table suitable for JSON output
|
||||
--
|
||||
-- Mostly taken from cjdroute --genconf
|
||||
-- @return table with configuration defaults
|
||||
function UCI.defaults()
|
||||
return {
|
||||
security = {
|
||||
{ setuser = "nobody", keepNetAdmin = 1 },
|
||||
{ chroot = "/var/run/" },
|
||||
{ nofiles = 0 },
|
||||
{ noforks = 1 },
|
||||
{ seccomp = 0 },
|
||||
{ setupComplete = 1 }
|
||||
},
|
||||
router = {
|
||||
supernodes = {},
|
||||
ipTunnel = { outgoingConnections = {}, allowedConnections = {} },
|
||||
interface = { type = "TUNInterface" }
|
||||
},
|
||||
interfaces = { UDPInterface = {}, ETHInterface = {} },
|
||||
authorizedPasswords = {},
|
||||
logging = { logTo = "stdout" }
|
||||
}
|
||||
end
|
||||
|
||||
--- Return the cjdns configuration as a table suitable for JSON output
|
||||
--
|
||||
-- Iterates over cjdns, eth_interface, udp_interface, eth_peer, udp_peer,
|
||||
-- and password sections. Doesn't include IPTunnel related options yet.
|
||||
-- @return table with cjdns configuration
|
||||
function UCI.get()
|
||||
local obj = UCI.defaults()
|
||||
|
||||
local cursor = uci.cursor()
|
||||
|
||||
local config = cursor:get_all("cjdns", "cjdns")
|
||||
if not config then return obj end
|
||||
|
||||
obj.ipv6 = config.ipv6
|
||||
obj.publicKey = config.public_key
|
||||
obj.privateKey = config.private_key
|
||||
obj.admin = {
|
||||
bind = config.admin_address .. ":" .. config.admin_port,
|
||||
password = config.admin_password }
|
||||
|
||||
if config.tun_device and string.len(config.tun_device) > 0 then
|
||||
obj.router.interface.tunDevice = config.tun_device
|
||||
end
|
||||
|
||||
cursor:foreach("cjdns", "supernodes", function(supernodes)
|
||||
table.insert(obj.router.supernodes, supernodes.public_key)
|
||||
end)
|
||||
|
||||
for i,section in pairs(obj.security) do
|
||||
if type(section.seccomp) == "number" then
|
||||
obj.security[i].seccomp = tonumber(config.seccomp)
|
||||
end
|
||||
end
|
||||
|
||||
cursor:foreach("cjdns", "iptunnel_outgoing", function(outgoing)
|
||||
table.insert(obj.router.ipTunnel.outgoingConnections, outgoing.public_key)
|
||||
end)
|
||||
|
||||
cursor:foreach("cjdns", "iptunnel_allowed", function(allowed)
|
||||
entry = { publicKey = allowed.public_key }
|
||||
if allowed.ipv4 then
|
||||
entry["ip4Address"] = allowed.ipv4
|
||||
end
|
||||
if allowed.ipv6 then
|
||||
entry["ip6Address"] = allowed.ipv6
|
||||
end
|
||||
table.insert(obj.router.ipTunnel.allowedConnections, entry)
|
||||
end)
|
||||
|
||||
cursor:foreach("cjdns", "eth_interface", function(eth_interface)
|
||||
table.insert(obj.interfaces.ETHInterface, {
|
||||
bind = eth_interface.bind,
|
||||
beacon = tonumber(eth_interface.beacon),
|
||||
connectTo = {}
|
||||
})
|
||||
end)
|
||||
|
||||
cursor:foreach("cjdns", "udp_interface", function(udp_interface)
|
||||
table.insert(obj.interfaces.UDPInterface, {
|
||||
bind = udp_interface.address .. ":" .. udp_interface.port,
|
||||
connectTo = {}
|
||||
})
|
||||
end)
|
||||
|
||||
cursor:foreach("cjdns", "eth_peer", function(eth_peer)
|
||||
if not eth_peer.address == "" then
|
||||
local i = tonumber(eth_peer.interface)
|
||||
obj.interfaces.ETHInterface[i].connectTo[eth_peer.address] = {
|
||||
publicKey = eth_peer.public_key,
|
||||
password = eth_peer.password
|
||||
}
|
||||
end
|
||||
end)
|
||||
|
||||
cursor:foreach("cjdns", "udp_peer", function(udp_peer)
|
||||
local bind = udp_peer.address .. ":" .. udp_peer.port
|
||||
local i = tonumber(udp_peer.interface)
|
||||
obj.interfaces.UDPInterface[i].connectTo[bind] = {
|
||||
user = udp_peer.user,
|
||||
publicKey = udp_peer.public_key,
|
||||
password = udp_peer.password
|
||||
}
|
||||
end)
|
||||
|
||||
cursor:foreach("cjdns", "password", function(password)
|
||||
table.insert(obj.authorizedPasswords, {
|
||||
password = password.password,
|
||||
user = password.user,
|
||||
contact = password.contact
|
||||
})
|
||||
end)
|
||||
|
||||
return obj
|
||||
end
|
||||
|
||||
--- Parse and save updated configuration from JSON input
|
||||
--
|
||||
-- Transforms general settings, ETHInterface, UDPInterface, connectTo, and
|
||||
-- authorizedPasswords fields into UCI sections, and replaces the UCI config's
|
||||
-- contents with them.
|
||||
-- @param table JSON input
|
||||
-- @return Boolean whether saving succeeded
|
||||
function UCI.set(obj)
|
||||
local cursor = uci.cursor()
|
||||
|
||||
for i, section in pairs(cursor:get_all("cjdns")) do
|
||||
cursor:delete("cjdns", section[".name"])
|
||||
end
|
||||
|
||||
local admin_address, admin_port = string.match(obj.admin.bind, "^(.*):(.*)$")
|
||||
UCI.cursor_section(cursor, "cjdns", "cjdns", "cjdns", {
|
||||
ipv6 = obj.ipv6,
|
||||
public_key = obj.publicKey,
|
||||
private_key = obj.privateKey,
|
||||
admin_password = obj.admin.password,
|
||||
admin_address = admin_address,
|
||||
admin_port = admin_port
|
||||
})
|
||||
|
||||
if obj.router.interface.tunDevice then
|
||||
UCI.cursor_section(cursor, "cjdns", "cjdns", "cjdns", {
|
||||
tun_device = tostring(obj.router.interface.tunDevice)
|
||||
})
|
||||
end
|
||||
|
||||
if obj.security then
|
||||
for i,section in pairs(obj.security) do
|
||||
for key,value in pairs(section) do
|
||||
if key == "seccomp" then
|
||||
UCI.cursor_section(cursor, "cjdns", "cjdns", "cjdns", {
|
||||
seccomp = tonumber(value)
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if obj.router.ipTunnel.outgoingConnections then
|
||||
for i,public_key in pairs(obj.router.ipTunnel.outgoingConnections) do
|
||||
UCI.cursor_section(cursor, "cjdns", "iptunnel_outgoing", nil, {
|
||||
public_key = public_key
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
if obj.router.ipTunnel.allowedConnections then
|
||||
for i,allowed in pairs(obj.router.ipTunnel.allowedConnections) do
|
||||
entry = { public_key = allowed.publicKey }
|
||||
if allowed.ip4Address then
|
||||
entry["ipv4"] = allowed.ip4Address
|
||||
end
|
||||
if allowed.ip6Address then
|
||||
entry["ipv6"] = allowed.ip6Address
|
||||
end
|
||||
|
||||
UCI.cursor_section(cursor, "cjdns", "iptunnel_allowed", nil, entry)
|
||||
end
|
||||
end
|
||||
|
||||
if obj.interfaces.ETHInterface then
|
||||
for i,interface in pairs(obj.interfaces.ETHInterface) do
|
||||
UCI.cursor_section(cursor, "cjdns", "eth_interface", nil, {
|
||||
bind = interface.bind,
|
||||
beacon = tostring(interface.beacon)
|
||||
})
|
||||
|
||||
if interface.connectTo then
|
||||
for peer_address,peer in pairs(interface.connectTo) do
|
||||
UCI.cursor_section(cursor, "cjdns", "eth_peer", nil, {
|
||||
interface = i,
|
||||
address = peer_address,
|
||||
public_key = peer.publicKey,
|
||||
password = peer.password
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if obj.interfaces.UDPInterface then
|
||||
for i,interface in pairs(obj.interfaces.UDPInterface) do
|
||||
local address, port = string.match(interface.bind, "^(.*):(.*)$")
|
||||
UCI.cursor_section(cursor, "cjdns", "udp_interface", nil, {
|
||||
address = address,
|
||||
port = port
|
||||
})
|
||||
|
||||
if interface.connectTo then
|
||||
for peer_bind,peer in pairs(interface.connectTo) do
|
||||
local peer_address, peer_port = string.match(peer_bind, "^(.*):(.*)$")
|
||||
UCI.cursor_section(cursor, "cjdns", "udp_peer", nil, {
|
||||
interface = i,
|
||||
address = peer_address,
|
||||
port = peer_port,
|
||||
user = peer.user,
|
||||
public_key = peer.publicKey,
|
||||
password = peer.password
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if obj.authorizedPasswords then
|
||||
for i,password in pairs(obj.authorizedPasswords) do
|
||||
local user = password.user
|
||||
if not user or string.len(user) == 0 then
|
||||
user = "user-" .. UCI.random_string(6)
|
||||
end
|
||||
|
||||
UCI.cursor_section(cursor, "cjdns", "password", nil, {
|
||||
password = password.password,
|
||||
user = user,
|
||||
contact = password.contact
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
return cursor:save("cjdns")
|
||||
end
|
||||
|
||||
--- Simple backport of Cursor:section from luci.model.uci
|
||||
--
|
||||
-- Backport reason: we don't wanna depend on LuCI.
|
||||
-- @param Cursor the UCI cursor to operate on
|
||||
-- @param string name of the config
|
||||
-- @param string type of the section
|
||||
-- @param string name of the section (optional)
|
||||
-- @param table config values
|
||||
function UCI.cursor_section(cursor, config, type, section, values)
|
||||
if section then
|
||||
cursor:set(config, section, type)
|
||||
else
|
||||
section = cursor:add("cjdns", type)
|
||||
end
|
||||
|
||||
for k,v in pairs(values) do
|
||||
cursor:set(config, section, k, v)
|
||||
end
|
||||
end
|
||||
|
||||
function UCI.makeInterface()
|
||||
local cursor = uci.cursor()
|
||||
|
||||
local config = cursor:get_all("cjdns", "cjdns")
|
||||
if not config then return nil end
|
||||
|
||||
return common.AdminInterface.new({
|
||||
host = config.admin_address,
|
||||
port = config.admin_port,
|
||||
password = config.admin_password,
|
||||
config = UCI.get(),
|
||||
timeout = 2
|
||||
})
|
||||
end
|
||||
|
||||
function UCI.random_string(length)
|
||||
-- tr -cd 'A-Za-z0-9' < /dev/urandom
|
||||
local urandom = io.popen("tr -cd 'A-Za-z0-9' 2> /dev/null < /dev/urandom", "r")
|
||||
local string = urandom:read(length)
|
||||
urandom:close()
|
||||
return string
|
||||
end
|
|
@ -1,102 +0,0 @@
|
|||
-- Cjdns admin module for Lua
|
||||
-- Written by Philip Horger
|
||||
|
||||
common = require 'cjdns/common'
|
||||
|
||||
UDPInterface = {}
|
||||
UDPInterface.__index = UDPInterface
|
||||
common.UDPInterface = UDPInterface
|
||||
|
||||
function UDPInterface.new(ai, config, ptype)
|
||||
properties = {
|
||||
ai = ai,
|
||||
config = config or ai.config,
|
||||
ptype = ptype or "ai"
|
||||
}
|
||||
|
||||
return setmetatable(properties, UDPInterface)
|
||||
end
|
||||
|
||||
function UDPInterface:call(name, args)
|
||||
local func = self[name .. "_" .. self.ptype]
|
||||
return func(self, unpack(args))
|
||||
end
|
||||
|
||||
function UDPInterface:newBind(...)
|
||||
return self:call("newBind", arg)
|
||||
end
|
||||
|
||||
function UDPInterface:beginConnection(...)
|
||||
return self:call("beginConnection", arg)
|
||||
end
|
||||
|
||||
function UDPInterface:newBind_ai(address)
|
||||
local response, err = self.ai:auth({
|
||||
q = "UDPInterface_new",
|
||||
bindAddress = address
|
||||
})
|
||||
if not response then
|
||||
return nil, err
|
||||
elseif response.error ~= "none" then
|
||||
return nil, response.error
|
||||
elseif response.interfaceNumber then
|
||||
return response.interfaceNumber
|
||||
else
|
||||
return nil, "bad response format"
|
||||
end
|
||||
end
|
||||
|
||||
function UDPInterface:newBind_config(address)
|
||||
local udpif = self.config.contents.interfaces.UDPInterface
|
||||
local new_interface = {
|
||||
bind = address,
|
||||
connectTo = {}
|
||||
}
|
||||
table.insert(udpif, new_interface)
|
||||
return (#udpif - 1), new_interface
|
||||
end
|
||||
|
||||
function UDPInterface:newBind_perm(...)
|
||||
return
|
||||
self:newBind_config(unpack(arg)),
|
||||
self:newBind_ai(unpack(arg))
|
||||
end
|
||||
|
||||
function UDPInterface:beginConnection_ai(pubkey, addr, password, interface)
|
||||
local request = {
|
||||
q = "UDPInterface_beginConnection",
|
||||
publicKey = pubkey,
|
||||
address = addr,
|
||||
password = password
|
||||
}
|
||||
if interface then
|
||||
request.interfaceNumber = interface
|
||||
end
|
||||
|
||||
local response, err = self.ai:auth(request)
|
||||
if not response then
|
||||
return nil, err
|
||||
elseif response.error == "none" then
|
||||
-- Unfortunately, no real success indicator either.
|
||||
return "No error"
|
||||
else
|
||||
return nil, response.error
|
||||
end
|
||||
end
|
||||
|
||||
function UDPInterface:beginConnection_config(pubkey, addr, password, interface)
|
||||
local udpif = self.config.contents.interfaces.UDPInterface
|
||||
local connections = udpif[(interface or 0) + 1].connectTo
|
||||
local this_conn = {
|
||||
password = password,
|
||||
publicKey = pubkey
|
||||
}
|
||||
connections[addr] = this_conn
|
||||
return this_conn -- allows adding metadata fields afterwards
|
||||
end
|
||||
|
||||
function UDPInterface:beginConnection_perm(...)
|
||||
return
|
||||
self:beginConnection_config(unpack(arg)),
|
||||
self:beginConnection_ai(unpack(arg))
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
--- a/node_build/builder.js
|
||||
+++ b/node_build/builder.js
|
||||
@@ -277,8 +277,8 @@ const execJs = function (js, ctx, file,
|
||||
js = '"use strict";' + qs.join("'");
|
||||
|
||||
const to = setTimeout(function () {
|
||||
- throw new Error("Inline JS did not return after 120 seconds [" + js + "]");
|
||||
- }, 120000);
|
||||
+ throw new Error("Inline JS did not return after 5 minutes [" + js + "]");
|
||||
+ }, 300000);
|
||||
|
||||
nThen(function (waitFor) {
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
--- a/node_build/FindPython.js
|
||||
+++ b/node_build/FindPython.js
|
||||
@@ -23,7 +23,7 @@ var Fs = require('fs');
|
||||
// de-prioritize because the testing script accepts ANY python3 version
|
||||
// (as of this writing, we don't know what python3 versions actually work)
|
||||
// whereas we know that python2.7 is the only working python2 version.
|
||||
-var PYTHONS = ["python3.7", "python3", "python2.7", "python2", "python"];
|
||||
+var PYTHONS = ["python2", "python2.7", "python3.7", "python3.8", "python3.9", "python3"]
|
||||
|
||||
var SCRIPT = [
|
||||
'import sys',
|
|
@ -1,23 +0,0 @@
|
|||
--- a/net/SwitchPinger_admin.c
|
||||
+++ b/net/SwitchPinger_admin.c
|
||||
@@ -78,8 +78,10 @@ static void adminPing(Dict* args, void*
|
||||
uint32_t timeout = (timeoutPtr) ? *timeoutPtr : DEFAULT_TIMEOUT;
|
||||
uint64_t path;
|
||||
String* err = NULL;
|
||||
+ String* pathNotParsable = String_CONST("path was not parsable.");
|
||||
+ String* noOpenSlots = String_CONST("no open slots to store ping, try later.");
|
||||
if (pathStr->len != 19 || AddrTools_parsePath(&path, (uint8_t*) pathStr->bytes)) {
|
||||
- err = String_CONST("path was not parsable.");
|
||||
+ err = pathNotParsable;
|
||||
} else {
|
||||
struct SwitchPinger_Ping* ping = SwitchPinger_newPing(path,
|
||||
data,
|
||||
@@ -89,7 +91,7 @@ static void adminPing(Dict* args, void*
|
||||
context->switchPinger);
|
||||
if (keyPing && *keyPing) { ping->type = SwitchPinger_Type_KEYPING; }
|
||||
if (!ping) {
|
||||
- err = String_CONST("no open slots to store ping, try later.");
|
||||
+ err = noOpenSlots;
|
||||
} else {
|
||||
ping->onResponseContext = Allocator_clone(ping->pingAlloc, (&(struct Ping) {
|
||||
.context = context,
|
|
@ -1,15 +0,0 @@
|
|||
--- a/node_build/dependencies/libuv/build/gyp/pylib/gyp/common.py
|
||||
+++ b/node_build/dependencies/libuv/build/gyp/pylib/gyp/common.py
|
||||
@@ -4,7 +4,11 @@
|
||||
|
||||
from __future__ import with_statement
|
||||
|
||||
-import collections
|
||||
+try:
|
||||
+ # Python 3.10
|
||||
+ from six.moves import collections_abc as collections
|
||||
+except ImportError:
|
||||
+ import collections
|
||||
import errno
|
||||
import filecmp
|
||||
import os.path
|
165
hnetd/Makefile
165
hnetd/Makefile
|
@ -1,165 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2012-2014 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:=hnetd
|
||||
PKG_SOURCE_DATE:=2018-12-21
|
||||
PKG_SOURCE_VERSION:=c43766610ed30194b048bc070a3c433aec731c40
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/sbyx/hnetd
|
||||
PKG_MIRROR_HASH:=a41baa2e3d7930cc88073b0b3f6e1fa6a4abd9fd663f2577cfde1564fa07f8f2
|
||||
|
||||
PKG_MAINTAINER:=Steven Barth <cyrus@openwrt.org>
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
# Spammy debug builds for now
|
||||
CMAKE_OPTIONS += -DL_LEVEL=7
|
||||
|
||||
# OpenWRT target
|
||||
CMAKE_OPTIONS += -DBACKEND=openwrt
|
||||
|
||||
ifeq ($(BUILD_VARIANT),openssl)
|
||||
CMAKE_OPTIONS += -DDTLS_OPENSSL=1
|
||||
endif
|
||||
|
||||
define Package/hnetd/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=HNCP Homenet daemon - $(2)
|
||||
URL:=https://github.com/sbyx/hnetd
|
||||
DEPENDS:=+odhcpd +odhcp6c +netifd $(3)
|
||||
DEPENDS+=@IPV6
|
||||
VARIANT:=$1
|
||||
endef
|
||||
|
||||
Package/hnetd-nossl=$(call Package/hnetd/Default,nossl,no authentication)
|
||||
Package/hnetd-openssl=$(call Package/hnetd/Default,openssl,authentication via OpenSSL,+libopenssl)
|
||||
|
||||
define Package/hnet-full
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=HNCP Homenet metapackage
|
||||
URL:=https://github.com/sbyx/hnetd
|
||||
DEPENDS:=+hnetd-nossl +luci-app-hnet +ip
|
||||
# Routing
|
||||
DEPENDS+=+babeld
|
||||
# Service discovery
|
||||
DEPENDS+=+ohybridproxy +zonestitcher
|
||||
# Distributed PCP support
|
||||
DEPENDS+=+miniupnpd +minimalist-pcproxy
|
||||
endef
|
||||
|
||||
define Package/hnet-full-secure
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=HNCP Homenet metapackage (w/ SSL)
|
||||
URL:=https://github.com/sbyx/hnetd
|
||||
DEPENDS:=+hnetd-openssl +luci-app-hnet +ip
|
||||
# Routing
|
||||
DEPENDS+=+babeld
|
||||
# Service discovery
|
||||
DEPENDS+=+ohybridproxy +zonestitcher
|
||||
# Distributed PCP support
|
||||
DEPENDS+=+miniupnpd +minimalist-pcproxy
|
||||
endef
|
||||
|
||||
define Package/hnet-full-l2tp
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=HNCP Homenet metapackage (w/ L2TP)
|
||||
URL:=https://github.com/sbyx/hnetd
|
||||
DEPENDS:=+hnetd-nossl +luci-app-hnet +ip-full +kmod-l2tp-eth
|
||||
# Routing
|
||||
DEPENDS+=+babeld
|
||||
# Service discovery
|
||||
DEPENDS+=+ohybridproxy +zonestitcher
|
||||
# Distributed PCP support
|
||||
DEPENDS+=+miniupnpd +minimalist-pcproxy
|
||||
endef
|
||||
|
||||
define Package/luci-app-hnet
|
||||
SECTION:=luci
|
||||
CATEGORY:=LuCI
|
||||
SUBMENU:=3. Applications
|
||||
TITLE:=HNCP Homenet configuration and visualization
|
||||
# DEPENDS:=+hnetd
|
||||
# TBD - how to express dependency on 'some' hnetd?
|
||||
endef
|
||||
|
||||
define Package/hnetd-$(BUILD_VARIANT)/description
|
||||
This package provides a daemon which implementats distributed prefix assignment
|
||||
and service discovery for a home network consisting of multiple routers
|
||||
connected to multiple service providers. It provides a netifd protocol "hnet"
|
||||
for use in /etc/config/network.
|
||||
endef
|
||||
|
||||
define Package/hnetd-$(BUILD_VARIANT)/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/hnetd $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/lib/netifd/proto
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt/hnet.sh $(1)/lib/netifd/proto
|
||||
ln -s hnetd $(1)/usr/sbin/hnet-ifresolve
|
||||
ln -s hnetd $(1)/usr/sbin/hnet-trust
|
||||
ln -s hnetd $(1)/usr/sbin/hnet-dump
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/hnetd.init $(1)/etc/init.d/hnetd
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DATA) ./files/hnet.config $(1)/etc/config/hnet
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/ohp.script $(1)/usr/sbin/hnetd-ohp-script
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/ddz.script $(1)/usr/sbin/hnetd-ddz-script
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/pcp.script $(1)/usr/sbin/hnetd-pcp-script
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/hnetd-routing $(1)/usr/sbin/hnetd-routing
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/hnetd.defaults $(1)/etc/uci-defaults/x-hnetd.defaults
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/multicast.script $(1)/usr/sbin/hnet-multicast
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt/autowifi.script $(1)/usr/sbin/autowifi
|
||||
endef
|
||||
|
||||
define Package/hnet-full/install
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/hnet-full-secure/install
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/hnet-full-l2tp/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/tunnel.script $(1)/usr/sbin/hnetd-tunnel
|
||||
endef
|
||||
|
||||
define Package/luci-app-hnet/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci
|
||||
$(INSTALL_DIR) $(1)/www
|
||||
$(CP) -R $(PKG_BUILD_DIR)/openwrt/luci/luasrc/* $(1)/usr/lib/lua/luci/
|
||||
$(CP) -R $(PKG_BUILD_DIR)/openwrt/luci/htdocs/* $(1)/www/
|
||||
endef
|
||||
|
||||
define Package/hnetd-$(BUILD_VARIANT)/postinst
|
||||
#!/bin/sh
|
||||
[ -n "$${IPKG_INSTROOT}" ] || {
|
||||
(. /etc/uci-defaults/x-hnetd.defaults) && rm -f /etc/uci-defaults/x-hnetd.defaults
|
||||
[ -x /etc/init.d/dnsmasq ] && /etc/init.d/dnsmasq restart
|
||||
/etc/init.d/hnetd enable
|
||||
/etc/init.d/hnetd start
|
||||
}
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,hnetd-nossl))
|
||||
$(eval $(call BuildPackage,hnetd-openssl))
|
||||
$(eval $(call BuildPackage,hnet-full))
|
||||
$(eval $(call BuildPackage,hnet-full-secure))
|
||||
$(eval $(call BuildPackage,hnet-full-l2tp))
|
||||
$(eval $(call BuildPackage,luci-app-hnet))
|
|
@ -1,29 +0,0 @@
|
|||
config security security
|
||||
# Simplest security mode:
|
||||
# option password foo
|
||||
# Trust consensus and CA-based share these options:
|
||||
# option certificate_file /etc/hnetd-cert.pem
|
||||
# option private_key_file /etc/hnetd-key.pem
|
||||
# Then to enable trust consensus:
|
||||
# option trust_store /etc/hnetd-trust.dat
|
||||
# Or CA-based authentication:
|
||||
# option trust_certificate_file /etc/ca-cert.pem
|
||||
|
||||
config pa pa
|
||||
# option ip4prefix 10.0.0.0/8
|
||||
# option ip4mode ifuplink
|
||||
# option ulaprefix fd12:3456:789A::/48
|
||||
# option ulamode off
|
||||
option persistent_store /etc/hnet-pa.store
|
||||
|
||||
config sd sd
|
||||
# option router_name openwrt
|
||||
# option domain_name home.
|
||||
|
||||
|
||||
# Wifi allows for very basic wifi autoconfiguration
|
||||
# Warning: This feature is unstable
|
||||
config wifi wifi
|
||||
# option enable 0
|
||||
# option ssid ssidtest
|
||||
# option password test
|
|
@ -1,12 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Why we tune dnsmasq?
|
||||
# localservice=0 => other hnetd instances can query for local names
|
||||
# boguspriv=0 => allow reverse resolution of RFC1918 w/o local hosts entries
|
||||
|
||||
uci batch <<EOF
|
||||
set dhcp.odhcpd.maindhcp=1
|
||||
set dhcp.@dnsmasq[0].localservice=0
|
||||
set dhcp.@dnsmasq[0].boguspriv=0
|
||||
commit dhcp
|
||||
EOF
|
|
@ -1,127 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
# XXX - is there something that should cause reload? or can we just
|
||||
# use info from netifd and let it handle dynamic changes? let's hope
|
||||
# so..
|
||||
|
||||
START=90
|
||||
STOP=10
|
||||
USE_PROCD=1
|
||||
|
||||
DNSMASQ_DIR=/tmp/dnsmasq.d
|
||||
DNSMASQ_SCRIPT=/etc/init.d/dnsmasq
|
||||
OHP_SCRIPT=/usr/sbin/hnetd-ohp-script
|
||||
OHP_BINARY=/usr/sbin/ohybridproxy
|
||||
DDZ_SCRIPT=/usr/sbin/hnetd-ddz-script
|
||||
DDZ_BINARY=/usr/sbin/zonestitcher
|
||||
PCP_SCRIPT=/usr/sbin/hnetd-pcp-script
|
||||
PCP_BINARY=/usr/sbin/minimalist-pcproxy
|
||||
MULTICAST_SCRIPT=/usr/sbin/hnet-multicast
|
||||
WIFI_SCRIPT=/usr/sbin/autowifi
|
||||
|
||||
start_service() {
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/network.sh
|
||||
config_load hnet
|
||||
|
||||
mkdir -p $DNSMASQ_DIR
|
||||
procd_open_instance
|
||||
procd_set_param command /usr/sbin/hnetd
|
||||
|
||||
# SD parts are here (make configurable?)
|
||||
if [ -f $OHP_BINARY -a -f $DNSMASQ_SCRIPT ]
|
||||
then
|
||||
mkdir -p $DNSMASQ_DIR
|
||||
procd_append_param command -d $DNSMASQ_SCRIPT
|
||||
procd_append_param command -f $DNSMASQ_DIR/hnet.conf
|
||||
procd_append_param command -o $OHP_SCRIPT
|
||||
HOSTNAME=`cat /proc/sys/kernel/hostname`
|
||||
if [ -n "$HOSTNAME" ]
|
||||
then
|
||||
procd_append_param command -n "$HOSTNAME"
|
||||
fi
|
||||
if [ -f $DDZ_BINARY ]
|
||||
then
|
||||
procd_append_param command -z $DDZ_SCRIPT
|
||||
fi
|
||||
fi
|
||||
|
||||
# Enable multicast if present and installed
|
||||
if [ -f "$MULTICAST_SCRIPT" ]
|
||||
then
|
||||
$MULTICAST_SCRIPT status && procd_append_param command -M "$MULTICAST_SCRIPT"
|
||||
fi
|
||||
|
||||
config_get enableval wifi enable
|
||||
if [ -f "$WIFI_SCRIPT" -a "$enableval" = "1" ]; then
|
||||
wifiopt=$WIFI_SCRIPT
|
||||
config_get ssidval wifi ssid
|
||||
config_get passval wifi password
|
||||
if [ -n "$ssidval" -a -n "$passval" ]; then
|
||||
wifiopt=${wifiopt},${ssidval}:${passval}
|
||||
fi
|
||||
procd_append_param command -w "$wifiopt"
|
||||
fi
|
||||
|
||||
# Enable PCP, if it's present
|
||||
if [ -f $PCP_BINARY -a -f $PCP_SCRIPT ]
|
||||
then
|
||||
procd_append_param command -c $PCP_SCRIPT
|
||||
fi
|
||||
|
||||
# State file
|
||||
config_get val pa persistent_store
|
||||
procd_append_param command -s ${val:-/tmp/hnetd.pa_state}
|
||||
|
||||
# Routing script
|
||||
procd_append_param command -r /usr/sbin/hnetd-routing
|
||||
|
||||
[ -x /usr/sbin/hnetd-tunnel ] && \
|
||||
procd_append_param command -t /usr/sbin/hnetd-tunnel
|
||||
|
||||
# Prefix assignment (pa)
|
||||
config_get val pa ip4prefix
|
||||
[ -n "$val" ] && procd_append_param command --ip4prefix $val
|
||||
|
||||
config_get val pa ip4mode
|
||||
[ -n "$val" ] && procd_append_param command --ip4mode $val
|
||||
|
||||
config_get val pa ulaprefix
|
||||
[ -n "$val" ] && procd_append_param command --ulaprefix $val
|
||||
|
||||
config_get val pa ulamode
|
||||
[ -n "$val" ] && procd_append_param command --ulamode $val
|
||||
|
||||
# Service discovery (sd)
|
||||
config_get val sd router_name
|
||||
[ -n "$val" ] && procd_append_param command -n $val
|
||||
|
||||
config_get val sd domain_name
|
||||
[ -n "$val" ] && procd_append_param command -m $val
|
||||
|
||||
# Security (needs security-enabled build)
|
||||
config_get val security password
|
||||
[ -n "$val" ] && procd_append_param command --password $val
|
||||
|
||||
config_get val security certificate_file
|
||||
[ -n "$val" ] && procd_append_param command --certificate $val
|
||||
|
||||
config_get val security private_key_file
|
||||
[ -n "$val" ] && procd_append_param command --privatekey $val
|
||||
|
||||
config_get val security trust_store
|
||||
[ -n "$val" ] && procd_append_param command --trust $val
|
||||
|
||||
config_get val security trust_certificate_file
|
||||
[ -n "$val" ] && procd_append_param command --verify-path $val
|
||||
|
||||
# For more verbose logging, uncomment this:
|
||||
#procd_append_param command --loglevel 7
|
||||
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "hnet"
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
--- a/src/dtls.c
|
||||
+++ b/src/dtls.c
|
||||
@@ -698,8 +698,10 @@ dtls dtls_create(uint16_t port)
|
||||
if (!_ssl_initialized)
|
||||
{
|
||||
_ssl_initialized = true;
|
||||
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
SSL_load_error_strings();
|
||||
SSL_library_init();
|
||||
+#endif
|
||||
}
|
||||
if (!d)
|
||||
goto fail;
|
||||
@@ -711,9 +713,9 @@ dtls dtls_create(uint16_t port)
|
||||
goto fail;
|
||||
|
||||
#ifdef USE_ONE_CONTEXT
|
||||
- SSL_CTX *ctx = SSL_CTX_new(DTLSv1_method());
|
||||
+ SSL_CTX *ctx = SSL_CTX_new(DTLS_method());
|
||||
#else
|
||||
- SSL_CTX *ctx = SSL_CTX_new(DTLSv1_server_method());
|
||||
+ SSL_CTX *ctx = SSL_CTX_new(DTLS_server_method());
|
||||
#endif /* USE_ONE_CONTEXT */
|
||||
if (!ctx)
|
||||
{
|
||||
@@ -1002,6 +1004,7 @@ _client_psk(SSL *ssl,
|
||||
|
||||
bool dtls_set_psk(dtls d, const char *psk, size_t psk_len)
|
||||
{
|
||||
+#ifndef OPENSSL_NO_PSK
|
||||
free(d->psk);
|
||||
d->psk = malloc(psk_len);
|
||||
if (!d->psk)
|
||||
@@ -1011,6 +1014,9 @@ bool dtls_set_psk(dtls d, const char *ps
|
||||
SSL_CTX_set_psk_client_callback(d->ssl_client_ctx, _client_psk);
|
||||
SSL_CTX_set_psk_server_callback(d->ssl_server_ctx, _server_psk);
|
||||
return true;
|
||||
+#else
|
||||
+ return false;
|
||||
+#endif
|
||||
}
|
||||
|
||||
bool dtls_cert_to_pem_buf(dtls_cert cert, char *buf, int buf_len)
|
|
@ -1,10 +0,0 @@
|
|||
--- a/src/hnetd.h
|
||||
+++ b/src/hnetd.h
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
+#undef __unused
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
339
luci-app-bmx6/COPYING
Normal file
339
luci-app-bmx6/COPYING
Normal file
|
@ -0,0 +1,339 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
61
luci-app-bmx6/Makefile
Normal file
61
luci-app-bmx6/Makefile
Normal file
|
@ -0,0 +1,61 @@
|
|||
# Copyright (C) 2011 Pau Escrich <pau@dabax.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# The full GNU General Public License is included in this distribution in
|
||||
# the file called "COPYING".
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-bmx6
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/luci-app-bmx6
|
||||
SECTION:=luci
|
||||
CATEGORY:=LuCI
|
||||
SUBMENU:=3. Applications
|
||||
TITLE:= bmx6 configuration, status and visualization module
|
||||
DEPENDS:=+luci-lib-json +luci-mod-admin-core +luci-lib-httpclient +bmx6
|
||||
MAINTAINER:= Pau Escrich <p4u@dabax.net>
|
||||
endef
|
||||
|
||||
define Package/luci-app-bmx6/description
|
||||
bmx6 web module for LuCi web interface
|
||||
endef
|
||||
|
||||
define Package/luci-app-bmx6/conffiles
|
||||
/etc/config/luci-bmx6
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/luci-app-bmx6/install
|
||||
$(CP) ./files/* $(1)/
|
||||
chmod 755 $(1)/www/cgi-bin/bmx6-info
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,luci-app-bmx6))
|
||||
|
7
luci-app-bmx6/files/etc/config/luci-bmx6
Normal file
7
luci-app-bmx6/files/etc/config/luci-bmx6
Normal file
|
@ -0,0 +1,7 @@
|
|||
config 'bmx6' 'luci'
|
||||
option ignore '0'
|
||||
option place 'admin network BMX6'
|
||||
#option place 'qmp Mesh'
|
||||
option position '3'
|
||||
#option json 'http://127.0.0.1/cgi-bin/bmx6-info?'
|
||||
option json 'exec:/www/cgi-bin/bmx6-info -s'
|
329
luci-app-bmx6/files/usr/lib/lua/luci/controller/bmx6.lua
Normal file
329
luci-app-bmx6/files/usr/lib/lua/luci/controller/bmx6.lua
Normal file
|
@ -0,0 +1,329 @@
|
|||
--[[
|
||||
Copyright (C) 2011 Pau Escrich <pau@dabax.net>
|
||||
Contributors Jo-Philipp Wich <xm@subsignal.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
The full GNU General Public License is included in this distribution in
|
||||
the file called "COPYING".
|
||||
--]]
|
||||
|
||||
local bmx6json = require("luci.model.bmx6json")
|
||||
|
||||
module("luci.controller.bmx6", package.seeall)
|
||||
|
||||
function index()
|
||||
local place = {}
|
||||
local ucim = require "luci.model.uci"
|
||||
local uci = ucim.cursor()
|
||||
|
||||
-- checking if ignore is on
|
||||
if uci:get("luci-bmx6","luci","ignore") == "1" then
|
||||
return nil
|
||||
end
|
||||
|
||||
-- getting value from uci database
|
||||
local uci_place = uci:get("luci-bmx6","luci","place")
|
||||
|
||||
-- default values
|
||||
if uci_place == nil then
|
||||
place = {"bmx6"}
|
||||
else
|
||||
local util = require "luci.util"
|
||||
place = util.split(uci_place," ")
|
||||
end
|
||||
|
||||
-- getting position of menu
|
||||
local uci_position = uci:get("luci-bmx6","luci","position")
|
||||
|
||||
---------------------------
|
||||
-- Starting with the pages
|
||||
---------------------------
|
||||
|
||||
--- status (default)
|
||||
entry(place,call("action_nodes_j"),place[#place],tonumber(uci_position))
|
||||
|
||||
table.insert(place,"Status")
|
||||
entry(place,call("action_status_j"),"Status",0)
|
||||
table.remove(place)
|
||||
|
||||
-- not visible
|
||||
table.insert(place,"nodes_nojs")
|
||||
entry(place, call("action_nodes"), nil)
|
||||
table.remove(place)
|
||||
|
||||
--- nodes
|
||||
table.insert(place,"Nodes")
|
||||
entry(place,call("action_nodes_j"),"Nodes",1)
|
||||
table.remove(place)
|
||||
|
||||
--- links
|
||||
table.insert(place,"Links")
|
||||
entry(place,call("action_links"),"Links",2).leaf = true
|
||||
table.remove(place)
|
||||
|
||||
-- Tunnels
|
||||
table.insert(place,"Tunnels")
|
||||
entry(place,call("action_tunnels_j"), "Tunnels", 3).leaf = true
|
||||
table.remove(place)
|
||||
|
||||
-- Gateways (deprecated)
|
||||
--table.insert(place,"Gateways")
|
||||
--entry(place,call("action_gateways_j"),"Gateways").leaf = true
|
||||
--table.remove(place)
|
||||
|
||||
--- Chat
|
||||
table.insert(place,"Chat")
|
||||
entry(place,call("action_chat"),"Chat",5)
|
||||
table.remove(place)
|
||||
|
||||
--- Graph
|
||||
table.insert(place,"Graph")
|
||||
entry(place, template("bmx6/graph"), "Graph",4)
|
||||
table.remove(place)
|
||||
|
||||
--- Topology (hidden)
|
||||
table.insert(place,"topology")
|
||||
entry(place, call("action_topology"), nil)
|
||||
table.remove(place)
|
||||
|
||||
--- configuration (CBI)
|
||||
table.insert(place,"Configuration")
|
||||
entry(place, cbi("bmx6/main"), "Configuration",6).dependent=false
|
||||
|
||||
table.insert(place,"General")
|
||||
entry(place, cbi("bmx6/main"), "General",1)
|
||||
table.remove(place)
|
||||
|
||||
table.insert(place,"Advanced")
|
||||
entry(place, cbi("bmx6/advanced"), "Advanced",5)
|
||||
table.remove(place)
|
||||
|
||||
table.insert(place,"Interfaces")
|
||||
entry(place, cbi("bmx6/interfaces"), "Interfaces",2)
|
||||
table.remove(place)
|
||||
|
||||
table.insert(place,"Tunnels")
|
||||
entry(place, cbi("bmx6/tunnels"), "Tunnels",3)
|
||||
table.remove(place)
|
||||
|
||||
table.insert(place,"Plugins")
|
||||
entry(place, cbi("bmx6/plugins"), "Plugins",6)
|
||||
table.remove(place)
|
||||
|
||||
table.insert(place,"HNAv6")
|
||||
entry(place, cbi("bmx6/hna"), "HNAv6",4)
|
||||
table.remove(place)
|
||||
|
||||
table.remove(place)
|
||||
|
||||
end
|
||||
|
||||
function action_status()
|
||||
local status = bmx6json.get("status").status or nil
|
||||
local interfaces = bmx6json.get("interfaces").interfaces or nil
|
||||
|
||||
if status == nil or interfaces == nil then
|
||||
luci.template.render("bmx6/error", {txt="Cannot fetch data from bmx6 json"})
|
||||
else
|
||||
luci.template.render("bmx6/status", {status=status,interfaces=interfaces})
|
||||
end
|
||||
end
|
||||
|
||||
function action_status_j()
|
||||
luci.template.render("bmx6/status_j", {})
|
||||
end
|
||||
|
||||
|
||||
function action_nodes()
|
||||
local orig_list = bmx6json.get("originators").originators or nil
|
||||
|
||||
if orig_list == nil then
|
||||
luci.template.render("bmx6/error", {txt="Cannot fetch data from bmx6 json"})
|
||||
return nil
|
||||
end
|
||||
|
||||
local originators = {}
|
||||
local desc = nil
|
||||
local orig = nil
|
||||
local name = ""
|
||||
local ipv4 = ""
|
||||
|
||||
for _,o in ipairs(orig_list) do
|
||||
orig = bmx6json.get("originators/"..o.name) or {}
|
||||
desc = bmx6json.get("descriptions/"..o.name) or {}
|
||||
|
||||
if string.find(o.name,'.') then
|
||||
name = luci.util.split(o.name,'.')[1]
|
||||
else
|
||||
name = o.name
|
||||
end
|
||||
|
||||
table.insert(originators,{name=name,orig=orig,desc=desc})
|
||||
end
|
||||
|
||||
luci.template.render("bmx6/nodes", {originators=originators})
|
||||
end
|
||||
|
||||
function action_nodes_j()
|
||||
local http = require "luci.http"
|
||||
local link_non_js = "/cgi-bin/luci" .. http.getenv("PATH_INFO") .. '/nodes_nojs'
|
||||
|
||||
luci.template.render("bmx6/nodes_j", {link_non_js=link_non_js})
|
||||
end
|
||||
|
||||
function action_gateways_j()
|
||||
luci.template.render("bmx6/gateways_j", {})
|
||||
end
|
||||
|
||||
function action_tunnels_j()
|
||||
luci.template.render("bmx6/tunnels_j", {})
|
||||
end
|
||||
|
||||
|
||||
function action_links(host)
|
||||
local links = bmx6json.get("links", host)
|
||||
local devlinks = {}
|
||||
local _,l
|
||||
|
||||
if links ~= nil then
|
||||
links = links.links
|
||||
for _,l in ipairs(links) do
|
||||
devlinks[l.viaDev] = {}
|
||||
end
|
||||
for _,l in ipairs(links) do
|
||||
l.globalId = luci.util.split(l.globalId,'.')[1]
|
||||
table.insert(devlinks[l.viaDev],l)
|
||||
end
|
||||
end
|
||||
|
||||
luci.template.render("bmx6/links", {links=devlinks})
|
||||
end
|
||||
|
||||
function action_topology()
|
||||
local originators = bmx6json.get("originators/all")
|
||||
local o,i,l,i2
|
||||
local first = true
|
||||
local topology = '[ '
|
||||
local cache = '/tmp/bmx6-topology.json'
|
||||
local offset = 60
|
||||
|
||||
local cachefd = io.open(cache,r)
|
||||
local update = false
|
||||
|
||||
if cachefd ~= nil then
|
||||
local lastupdate = tonumber(cachefd:read("*line")) or 0
|
||||
if os.time() >= lastupdate + offset then
|
||||
update = true
|
||||
else
|
||||
topology = cachefd:read("*all")
|
||||
end
|
||||
cachefd:close()
|
||||
end
|
||||
|
||||
if cachefd == nil or update then
|
||||
for i,o in ipairs(originators) do
|
||||
local links = bmx6json.get("links",o.primaryIp)
|
||||
if links then
|
||||
if first then
|
||||
first = false
|
||||
else
|
||||
topology = topology .. ', '
|
||||
end
|
||||
|
||||
topology = topology .. '{ "globalId": "%s", "links": [' %o.globalId:match("^[^%.]+")
|
||||
|
||||
local first2 = true
|
||||
|
||||
for i2,l in ipairs(links.links) do
|
||||
if first2 then
|
||||
first2 = false
|
||||
else
|
||||
topology = topology .. ', '
|
||||
end
|
||||
|
||||
topology = topology .. '{ "globalId": "%s", "rxRate": %s, "txRate": %s }'
|
||||
%{ l.globalId:match("^[^%.]+"), l.rxRate, l.txRate }
|
||||
|
||||
end
|
||||
|
||||
topology = topology .. ']}'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
topology = topology .. ' ]'
|
||||
|
||||
-- Upgrading the content of the cache file
|
||||
cachefd = io.open(cache,'w+')
|
||||
cachefd:write(os.time()..'\n')
|
||||
cachefd:write(topology)
|
||||
cachefd:close()
|
||||
end
|
||||
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write(topology)
|
||||
end
|
||||
|
||||
|
||||
function action_chat()
|
||||
local sms_dir = "/var/run/bmx6/sms"
|
||||
local rcvd_dir = sms_dir .. "/rcvdSms"
|
||||
local send_file = sms_dir .. "/sendSms/chat"
|
||||
local sms_list = bmx6json.get("rcvdSms")
|
||||
local sender = ""
|
||||
local sms_file = ""
|
||||
local chat = {}
|
||||
local to_send = nil
|
||||
local sent = ""
|
||||
local fd = nil
|
||||
|
||||
if luci.sys.call("test -d " .. sms_dir) ~= 0 then
|
||||
luci.template.render("bmx6/error", {txt="sms plugin disabled or some problem with directory " .. sms_dir})
|
||||
return nil
|
||||
end
|
||||
|
||||
sms_list = luci.util.split(luci.util.exec("ls "..rcvd_dir.."/*:chat"))
|
||||
|
||||
for _,sms_path in ipairs(sms_list) do
|
||||
if #sms_path > #rcvd_dir then
|
||||
sms_file = luci.util.split(sms_path,'/')
|
||||
sms_file = sms_file[#sms_file]
|
||||
sender = luci.util.split(sms_file,':')[1]
|
||||
|
||||
-- Trying to clean the name
|
||||
if string.find(sender,".") ~= nil then
|
||||
sender = luci.util.split(sender,".")[1]
|
||||
end
|
||||
|
||||
fd = io.open(sms_path,"r")
|
||||
chat[sender] = fd:read()
|
||||
fd:close()
|
||||
end
|
||||
end
|
||||
|
||||
to_send = luci.http.formvalue("toSend")
|
||||
if to_send ~= nil and #to_send > 1 then
|
||||
fd = io.open(send_file,"w")
|
||||
fd:write(to_send)
|
||||
fd:close()
|
||||
sent = to_send
|
||||
else
|
||||
sent = luci.util.exec("cat "..send_file)
|
||||
end
|
||||
|
||||
luci.template.render("bmx6/chat", {chat=chat,sent=sent})
|
||||
end
|
||||
|
219
luci-app-bmx6/files/usr/lib/lua/luci/model/bmx6json.lua
Normal file
219
luci-app-bmx6/files/usr/lib/lua/luci/model/bmx6json.lua
Normal file
|
@ -0,0 +1,219 @@
|
|||
--[[
|
||||
Copyright (C) 2011 Pau Escrich <pau@dabax.net>
|
||||
Contributors Jo-Philipp Wich <xm@subsignal.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
The full GNU General Public License is included in this distribution in
|
||||
the file called "COPYING".
|
||||
--]]
|
||||
|
||||
local ltn12 = require("luci.ltn12")
|
||||
local json = require("luci.json")
|
||||
local util = require("luci.util")
|
||||
local uci = require("luci.model.uci")
|
||||
local sys = require("luci.sys")
|
||||
local template = require("luci.template")
|
||||
local http = require("luci.http")
|
||||
local string = require("string")
|
||||
local table = require("table")
|
||||
local nixio = require("nixio")
|
||||
local nixiofs = require("nixio.fs")
|
||||
local ipairs = ipairs
|
||||
|
||||
module "luci.model.bmx6json"
|
||||
|
||||
-- Returns a LUA object from bmx6 JSON daemon
|
||||
|
||||
function get(field, host)
|
||||
local url
|
||||
if host ~= nil then
|
||||
if host:match(":") then
|
||||
url = 'http://[%s]/cgi-bin/bmx6-info?' % host
|
||||
else
|
||||
url = 'http://%s/cgi-bin/bmx6-info?' % host
|
||||
end
|
||||
else
|
||||
url = uci.cursor():get("luci-bmx6","luci","json")
|
||||
end
|
||||
|
||||
if url == nil then
|
||||
print_error("bmx6 json url not configured, cannot fetch bmx6 daemon data",true)
|
||||
return nil
|
||||
end
|
||||
|
||||
local json_url = util.split(url,":")
|
||||
local raw = ""
|
||||
|
||||
if json_url[1] == "http" then
|
||||
raw,err = wget(url..field,1000)
|
||||
else
|
||||
|
||||
if json_url[1] == "exec" then
|
||||
raw = sys.exec(json_url[2]..' '..field)
|
||||
else
|
||||
print_error("bmx6 json url not recognized, cannot fetch bmx6 daemon data. Use http: or exec:",true)
|
||||
return nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local data = nil
|
||||
|
||||
if raw and raw:len() > 10 then
|
||||
local decoder = json.Decoder()
|
||||
ltn12.pump.all(ltn12.source.string(raw), decoder:sink())
|
||||
data = decoder:get()
|
||||
-- else
|
||||
-- print_error("Cannot get data from bmx6 daemon",true)
|
||||
-- return nil
|
||||
end
|
||||
|
||||
return data
|
||||
end
|
||||
|
||||
function print_error(txt,popup)
|
||||
util.perror(txt)
|
||||
sys.call("logger -t bmx6json " .. txt)
|
||||
|
||||
if popup then
|
||||
http.write('<script type="text/javascript">alert("Some error detected, please check it: '..txt..'");</script>')
|
||||
else
|
||||
http.write("<h1>Dammit! some error detected</h1>")
|
||||
http.write("bmx6-luci: " .. txt)
|
||||
http.write('<p><FORM><INPUT TYPE="BUTTON" VALUE="Go Back" ONCLICK="history.go(-1)"></FORM></p>')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function text2html(txt)
|
||||
txt = string.gsub(txt,"<","{")
|
||||
txt = string.gsub(txt,">","}")
|
||||
txt = util.striptags(txt)
|
||||
return txt
|
||||
end
|
||||
|
||||
|
||||
function wget(url, timeout)
|
||||
local rfd, wfd = nixio.pipe()
|
||||
local pid = nixio.fork()
|
||||
if pid == 0 then
|
||||
rfd:close()
|
||||
nixio.dup(wfd, nixio.stdout)
|
||||
|
||||
local candidates = { "/usr/bin/wget", "/bin/wget" }
|
||||
local _, bin
|
||||
for _, bin in ipairs(candidates) do
|
||||
if nixiofs.access(bin, "x") then
|
||||
nixio.exec(bin, "-q", "-O", "-", url)
|
||||
end
|
||||
end
|
||||
return
|
||||
else
|
||||
wfd:close()
|
||||
rfd:setblocking(false)
|
||||
|
||||
local buffer = { }
|
||||
local err1, err2
|
||||
|
||||
while true do
|
||||
local ready = nixio.poll({{ fd = rfd, events = nixio.poll_flags("in") }}, timeout)
|
||||
if not ready then
|
||||
nixio.kill(pid, nixio.const.SIGKILL)
|
||||
err1 = "timeout"
|
||||
break
|
||||
end
|
||||
|
||||
local rv = rfd:read(4096)
|
||||
if rv then
|
||||
-- eof
|
||||
if #rv == 0 then
|
||||
break
|
||||
end
|
||||
|
||||
buffer[#buffer+1] = rv
|
||||
else
|
||||
-- error
|
||||
if nixio.errno() ~= nixio.const.EAGAIN and
|
||||
nixio.errno() ~= nixio.const.EWOULDBLOCK then
|
||||
err1 = "error"
|
||||
err2 = nixio.errno()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
nixio.waitpid(pid, "nohang")
|
||||
if not err1 then
|
||||
return table.concat(buffer)
|
||||
else
|
||||
return nil, err1, err2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function getOptions(name)
|
||||
-- Getting json and Checking if bmx6-json is avaiable
|
||||
local options = get("options")
|
||||
if options == nil or options.OPTIONS == nil then
|
||||
m.message = "bmx6-json plugin is not running or some mistake in luci-bmx6 configuration, check /etc/config/luci-bmx6"
|
||||
return nil
|
||||
else
|
||||
options = options.OPTIONS
|
||||
end
|
||||
|
||||
-- Filtering by the option name
|
||||
local i,_
|
||||
local namedopt = nil
|
||||
if name ~= nil then
|
||||
for _,i in ipairs(options) do
|
||||
if i.name == name and i.CHILD_OPTIONS ~= nil then
|
||||
namedopt = i.CHILD_OPTIONS
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return namedopt
|
||||
end
|
||||
|
||||
-- Rturns a help string formated to be used in HTML scope
|
||||
function getHtmlHelp(opt)
|
||||
if opt == nil then return nil end
|
||||
|
||||
local help = ""
|
||||
if opt.help ~= nil then
|
||||
help = text2html(opt.help)
|
||||
end
|
||||
if opt.syntax ~= nil then
|
||||
help = help .. "<br/><b>Syntax: </b>" .. text2html(opt.syntax)
|
||||
end
|
||||
|
||||
return help
|
||||
end
|
||||
|
||||
function testandreload()
|
||||
local test = sys.call('bmx6 -c --test > /tmp/bmx6-luci.err.tmp')
|
||||
if test ~= 0 then
|
||||
return sys.exec("cat /tmp/bmx6-luci.err.tmp")
|
||||
end
|
||||
|
||||
local err = sys.call('bmx6 -c --configReload > /tmp/bmx6-luci.err.tmp')
|
||||
if err ~= 0 then
|
||||
return sys.exec("cat /tmp/bmx6-luci.err.tmp")
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
--[[
|
||||
Copyright (C) 2011 Pau Escrich <pau@dabax.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
The full GNU General Public License is included in this distribution in
|
||||
the file called "COPYING".
|
||||
--]]
|
||||
|
||||
m = Map("bmx6", "bmx6")
|
||||
|
||||
local bmx6json = require("luci.model.bmx6json")
|
||||
local util = require("luci.util")
|
||||
local http = require("luci.http")
|
||||
local sys = require("luci.sys")
|
||||
|
||||
local options = bmx6json.get("options")
|
||||
if options == nil or options.OPTIONS == nil then
|
||||
m.message = "bmx6-json plugin is not running or some mistake in luci-bmx6 configuration, check /etc/config/luci-bmx6"
|
||||
options = {}
|
||||
else
|
||||
options = options.OPTIONS
|
||||
end
|
||||
|
||||
local general = m:section(NamedSection,"general","general","General Options")
|
||||
|
||||
local name = ""
|
||||
local help = ""
|
||||
local value = nil
|
||||
local _,o
|
||||
|
||||
for _,o in ipairs(options) do
|
||||
if o.name ~= nil and o.CHILD_OPTIONS == nil and o.configurable == 1 then
|
||||
help = ""
|
||||
name = o.name
|
||||
|
||||
if o.help ~= nil then
|
||||
help = bmx6json.text2html(o.help)
|
||||
end
|
||||
|
||||
if o.syntax ~= nil then
|
||||
help = help .. "<br/><strong>Syntax: </strong>" .. bmx6json.text2html(o.syntax)
|
||||
end
|
||||
|
||||
if o.def ~= nil then
|
||||
help = help .. "<strong> Default: </strong>" .. o.def
|
||||
end
|
||||
|
||||
value = general:option(Value,name,name,help)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function m.on_commit(self,map)
|
||||
local err = sys.call('bmx6 -c --configReload > /tmp/bmx6-luci.err.tmp')
|
||||
if err ~= 0 then
|
||||
m.message = sys.exec("cat /tmp/bmx6-luci.err.tmp")
|
||||
end
|
||||
end
|
||||
|
||||
return m
|
||||
|
47
luci-app-bmx6/files/usr/lib/lua/luci/model/cbi/bmx6/hna.lua
Normal file
47
luci-app-bmx6/files/usr/lib/lua/luci/model/cbi/bmx6/hna.lua
Normal file
|
@ -0,0 +1,47 @@
|
|||
--[[
|
||||
Copyright (C) 2011 Pau Escrich <pau@dabax.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
The full GNU General Public License is included in this distribution in
|
||||
the file called "COPYING".
|
||||
--]]
|
||||
|
||||
local sys = require("luci.sys")
|
||||
|
||||
m = Map("bmx6", "bmx6")
|
||||
|
||||
local hna = m:section(TypedSection,"unicastHna","IPv6 HNA")
|
||||
hna.addremove = true
|
||||
hna.anonymous = true
|
||||
local hna_option = hna:option(Value,"unicastHna", "IPv6 Host Network Announcement. Syntax <NETADDR>/<PREFIX>")
|
||||
|
||||
--function hna_option:validate(value)
|
||||
-- local err = sys.call('bmx6 -c --test -a ' .. value)
|
||||
-- if err ~= 0 then
|
||||
-- return nil
|
||||
-- end
|
||||
-- return value
|
||||
--end
|
||||
|
||||
function m.on_commit(self,map)
|
||||
local err = sys.call('bmx6 -c --configReload > /tmp/bmx6-luci.err.tmp')
|
||||
if err ~= 0 then
|
||||
m.message = sys.exec("cat /tmp/bmx6-luci.err.tmp")
|
||||
end
|
||||
end
|
||||
|
||||
return m
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
--[[
|
||||
Copyright (C) 2011 Pau Escrich <pau@dabax.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
The full GNU General Public License is included in this distribution in
|
||||
the file called "COPYING".
|
||||
--]]
|
||||
|
||||
local sys = require("luci.sys")
|
||||
local bmx6json = require("luci.model.bmx6json")
|
||||
local m = Map("bmx6", "bmx6")
|
||||
|
||||
local eth_int = sys.net.devices()
|
||||
local interfaces = m:section(TypedSection,"dev","Devices","")
|
||||
interfaces.addremove = true
|
||||
interfaces.anonymous = true
|
||||
|
||||
local intlv = interfaces:option(ListValue,"dev","Device")
|
||||
|
||||
for _,i in ipairs(eth_int) do
|
||||
intlv:value(i,i)
|
||||
end
|
||||
|
||||
-- Getting json and looking for device section
|
||||
local json = bmx6json.get("options")
|
||||
|
||||
if json == nil or json.OPTIONS == nil then
|
||||
m.message = "bmx6-json plugin is not running or some mistake in luci-bmx6 configuration, check /etc/config/luci-bmx6"
|
||||
json = {}
|
||||
else
|
||||
json = json.OPTIONS
|
||||
end
|
||||
|
||||
local dev = {}
|
||||
for _,j in ipairs(json) do
|
||||
if j.name == "dev" and j.CHILD_OPTIONS ~= nil then
|
||||
dev = j.CHILD_OPTIONS
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
local help = ""
|
||||
local name = ""
|
||||
|
||||
for _,o in ipairs(dev) do
|
||||
if o.name ~= nil then
|
||||
help = ""
|
||||
name = o.name
|
||||
if o.help ~= nil then
|
||||
help = bmx6json.text2html(o.help)
|
||||
end
|
||||
|
||||
if o.syntax ~= nil then
|
||||
help = help .. "<br/><strong>Syntax: </strong>" .. bmx6json.text2html(o.syntax)
|
||||
end
|
||||
|
||||
value = interfaces:option(Value,name,name,help)
|
||||
value.optional = true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return m
|
||||
|
108
luci-app-bmx6/files/usr/lib/lua/luci/model/cbi/bmx6/main.lua
Normal file
108
luci-app-bmx6/files/usr/lib/lua/luci/model/cbi/bmx6/main.lua
Normal file
|
@ -0,0 +1,108 @@
|
|||
--[[
|
||||
Copyright (C) 2011 Pau Escrich <pau@dabax.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
The full GNU General Public License is included in this distribution in
|
||||
the file called "COPYING".
|
||||
--]]
|
||||
|
||||
local sys = require("luci.sys")
|
||||
local bmx6json = require("luci.model.bmx6json")
|
||||
|
||||
m = Map("bmx6", "bmx6")
|
||||
|
||||
-- Getting json and Checking if bmx6-json is avaiable
|
||||
local options = bmx6json.get("options")
|
||||
if options == nil or options.OPTIONS == nil then
|
||||
m.message = "bmx6-json plugin is not running or some mistake in luci-bmx6 configuration, check /etc/config/luci-bmx6"
|
||||
else
|
||||
options = options.OPTIONS
|
||||
end
|
||||
|
||||
-- Getting a list of interfaces
|
||||
local eth_int = luci.sys.net.devices()
|
||||
|
||||
-- Getting the most important options from general
|
||||
local general = m:section(NamedSection,"general","general","General")
|
||||
general.addremove = false
|
||||
general:option(Value,"globalPrefix","Global ip prefix","Specify global prefix for interfaces: NETADDR/LENGTH. If you are using IPv6 leave blank to let bmx6 autoassign an ULA IPv6 address.")
|
||||
|
||||
if m:get("ipVersion","ipVersion") == "6" then
|
||||
general:option(Value,"tun4Address","IPv4 address or range","specify default IPv4 tunnel address and announced range")
|
||||
end
|
||||
|
||||
-- IP section
|
||||
-- ipVersion section is important, we are allways showing it
|
||||
local ipV = m:section(NamedSection,"ipVersion","ipVersion","IP options")
|
||||
ipV.addremove = false
|
||||
local lipv = ipV:option(ListValue,"ipVersion","IP version")
|
||||
lipv:value("4","4")
|
||||
lipv:value("6","6")
|
||||
lipv.default = "6"
|
||||
|
||||
-- rest of ip options are optional, getting them from json
|
||||
local ipoptions = {}
|
||||
for _,o in ipairs(options) do
|
||||
if o.name == "ipVersion" and o.CHILD_OPTIONS ~= nil then
|
||||
ipoptions = o.CHILD_OPTIONS
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
local help = ""
|
||||
local name = ""
|
||||
local value = nil
|
||||
|
||||
for _,o in ipairs(ipoptions) do
|
||||
if o.name ~= nil then
|
||||
help = ""
|
||||
name = o.name
|
||||
if o.help ~= nil then
|
||||
help = bmx6json.text2html(o.help)
|
||||
end
|
||||
|
||||
if o.syntax ~= nil then
|
||||
help = help .. "<br/><strong>Syntax: </strong>" .. bmx6json.text2html(o.syntax)
|
||||
end
|
||||
|
||||
if o.def ~= nil then
|
||||
help = help .. "<br/><strong> Default: </strong>" .. bmx6json.text2html(o.def)
|
||||
end
|
||||
|
||||
value = ipV:option(Value,name,name,help)
|
||||
value.optional = true
|
||||
end
|
||||
end
|
||||
|
||||
-- Interfaces section
|
||||
local interfaces = m:section(TypedSection,"dev","Devices","")
|
||||
interfaces.addremove = true
|
||||
interfaces.anonymous = true
|
||||
local intlv = interfaces:option(ListValue,"dev","Device")
|
||||
|
||||
for _,i in ipairs(eth_int) do
|
||||
intlv:value(i,i)
|
||||
end
|
||||
|
||||
function m.on_commit(self,map)
|
||||
local err = sys.call('bmx6 -c --configReload > /tmp/bmx6-luci.err.tmp')
|
||||
if err ~= 0 then
|
||||
m.message = sys.exec("cat /tmp/bmx6-luci.err.tmp")
|
||||
end
|
||||
end
|
||||
|
||||
return m
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
--[[
|
||||
Copyright (C) 2011 Pau Escrich <pau@dabax.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
The full GNU General Public License is included in this distribution in
|
||||
the file called "COPYING".
|
||||
--]]
|
||||
local sys = require("luci.sys")
|
||||
|
||||
m = Map("bmx6", "bmx6")
|
||||
plugins_dir = {"/usr/lib/","/var/lib","/lib"}
|
||||
|
||||
plugin = m:section(TypedSection,"plugin","Plugin")
|
||||
plugin.addremove = true
|
||||
plugin.anonymous = true
|
||||
plv = plugin:option(ListValue,"plugin", "Plugin")
|
||||
|
||||
for _,d in ipairs(plugins_dir) do
|
||||
pl = luci.sys.exec("cd "..d..";ls bmx6_*")
|
||||
if #pl > 6 then
|
||||
for _,v in ipairs(luci.util.split(pl,"\n")) do
|
||||
plv:value(v,v)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.on_commit(self,map)
|
||||
local err = sys.call('/etc/init.d/bmx6 restart')
|
||||
if err ~= 0 then
|
||||
m.message = sys.exec("Cannot restart bmx6")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return m
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
--[[
|
||||
Copyright (C) 2011 Pau Escrich <pau@dabax.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
The full GNU General Public License is included in this distribution in
|
||||
the file called "COPYING".
|
||||
--]]
|
||||
|
||||
local sys = require("luci.sys")
|
||||
local bmx6json = require("luci.model.bmx6json")
|
||||
|
||||
m = Map("bmx6", "bmx6")
|
||||
|
||||
-- tunOut
|
||||
local tunnelsOut = m:section(TypedSection,"tunOut",translate("Networks to fetch"),translate("Tunnel announcements to fetch if possible"))
|
||||
tunnelsOut.addremove = true
|
||||
tunnelsOut.anonymous = true
|
||||
tunnelsOut:option(Value,"tunOut","Name")
|
||||
tunnelsOut:option(Value,"network", translate("Network to fetch"))
|
||||
|
||||
local tunoptions = bmx6json.getOptions("tunOut")
|
||||
local _,o
|
||||
for _,o in ipairs(tunoptions) do
|
||||
if o.name ~= nil and o.name ~= "network" then
|
||||
help = bmx6json.getHtmlHelp(o)
|
||||
value = tunnelsOut:option(Value,o.name,o.name,help)
|
||||
value.optional = true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--tunIn
|
||||
local tunnelsIn = m:section(TypedSection,"tunInNet",translate("Networks to offer"),translate("Tunnels to announce in the network"))
|
||||
tunnelsIn.addremove = true
|
||||
tunnelsIn.anonymous = true
|
||||
|
||||
local net = tunnelsIn:option(Value,"tunInNet", translate("Network to offer"))
|
||||
net.default = "10.0.0.0/8"
|
||||
|
||||
local bwd = tunnelsIn:option(Value,"bandwidth",translate("Bandwidth (Bytes)"))
|
||||
bwd.default = "1000000"
|
||||
|
||||
local tuninoptions = bmx6json.getOptions("tunInNet")
|
||||
local _,o
|
||||
for _,o in ipairs(tuninoptions) do
|
||||
if o.name ~= nil and o.name ~= "tunInNet" and o.name ~= "bandwidth" then
|
||||
help = bmx6json.getHtmlHelp(o)
|
||||
value = tunnelsIn:option(Value,o.name,o.name,help)
|
||||
value.optional = true
|
||||
end
|
||||
end
|
||||
|
||||
function m.on_commit(self,map)
|
||||
--Not working. If test returns error the changes are still commited
|
||||
local msg = bmx6json.testandreload()
|
||||
if msg ~= nil then
|
||||
m.message = msg
|
||||
end
|
||||
end
|
||||
|
||||
return m
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
<script type="text/javascript">//<![CDATA[
|
||||
|
||||
XHR.poll(5, '/cgi-bin/bmx6-info', { '$neighbours': '' },
|
||||
function(x, st)
|
||||
{
|
||||
var originators = st.neighbours[0].originators;
|
||||
var descriptions = st.neighbours[1].descriptions;
|
||||
|
||||
var tb = document.getElementById('descriptions_table');
|
||||
|
||||
if ( originators.length != descriptions.length )
|
||||
{
|
||||
var tr = tb.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 7;
|
||||
td.innerHTML = '<em><br /><%:Some problem with JSON: lenght of originators and descriptions different. %></em>';
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( originators && descriptions && tb)
|
||||
{
|
||||
/* clear all rows */
|
||||
while( tb.rows.length > 1 )
|
||||
tb.deleteRow(1);
|
||||
|
||||
for( var i = 0; i < descriptions.length; i++ )
|
||||
{
|
||||
var tr = tb.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
|
||||
tr.insertCell(-1).innerHTML = descriptions[i].DESC_ADV.globalId.replace(/\.[^\.]+$/,"");
|
||||
|
||||
var extensions = descriptions[i].DESC_ADV.extensions;
|
||||
|
||||
//Looking for the extensions
|
||||
var hna6 = [];
|
||||
for( var e = 0; e < extensions.length; e++)
|
||||
{
|
||||
if( extensions[e].HNA6_EXTENSION )
|
||||
{
|
||||
hna6 = extensions[e].HNA6_EXTENSION;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Adding first HNA with prefix=128 as main address
|
||||
var ipstxt = '';
|
||||
var address;
|
||||
var prefix;
|
||||
|
||||
for( var e = 0; e < hna6.length; e++ )
|
||||
{
|
||||
address = hna6[e].address;
|
||||
prefix = hna6[e].prefixlen;
|
||||
if ( prefix == '128' )
|
||||
{
|
||||
ipstxt += address;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
tr.insertCell(-1).innerHTML = ipstxt;
|
||||
|
||||
tr.insertCell(-1).innerHTML = originators[i].viaDev;
|
||||
tr.insertCell(-1).innerHTML = originators[i].metric;
|
||||
tr.insertCell(-1).innerHTML = originators[i].lastDesc;
|
||||
tr.insertCell(-1).innerHTML = originators[i].lastRef;
|
||||
tr.insertCell(-1).innerHTML = originators[i].blocked;
|
||||
|
||||
}
|
||||
|
||||
if( tb.rows.length == 1 )
|
||||
{
|
||||
var tr = tb.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 7;
|
||||
td.innerHTML = '<em><br /><%:There are no nodes available.%></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]></script>
|
||||
|
||||
<div class="cbi-map">
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Mesh nodes%></legend>
|
||||
<table class="cbi-section-table" id="descriptions_table">
|
||||
<tr class="cbi-section-table-titles">
|
||||
<th class="cbi-section-table-cell"><%:Hostname%></th>
|
||||
<th class="cbi-section-table-cell"><%:Primary IP%></th>
|
||||
<th class="cbi-section-table-cell"><%:Via Device%></th>
|
||||
<th class="cbi-section-table-cell"><%:Metric%></th>
|
||||
<th class="cbi-section-table-cell"><%:Last Desc%></th>
|
||||
<th class="cbi-section-table-cell"><%:Last Ref%></th>
|
||||
<th class="cbi-section-table-cell"><%:Blocked%></th>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-row">
|
||||
<td colspan="7"><em><br /><%:Collecting data...%></em></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
|
||||
|
35
luci-app-bmx6/files/usr/lib/lua/luci/view/bmx6/chat.htm
Normal file
35
luci-app-bmx6/files/usr/lib/lua/luci/view/bmx6/chat.htm
Normal file
|
@ -0,0 +1,35 @@
|
|||
<%+header%>
|
||||
<meta http-equiv="refresh" content="60" />
|
||||
<h2><a id="content" name="content"><%:Chat%></a></h2>
|
||||
<p>This is sms a chat where all bmx6 nodes can participate. The data is replayed using routing packets, so there is a limit of 2040 bytes. Use it only to send short messages.</p>
|
||||
<p>Each participant can only send one sms at same time.</p>
|
||||
<br />
|
||||
|
||||
<strong>Received SMS</strong>
|
||||
<br />
|
||||
<pre style="background-color:#dadbe6;">
|
||||
<% for orig,sms in pairs(chat) do %>
|
||||
<u><%=orig%></u>:<%=sms%>
|
||||
<% end %>
|
||||
</pre>
|
||||
|
||||
<form action=".">
|
||||
<input type="submit" value="refresh" />
|
||||
</form>
|
||||
|
||||
<br />
|
||||
|
||||
<form action="." method="post">
|
||||
<input type="text" name="toSend" />
|
||||
<input type="submit" value="send sms" />
|
||||
</form>
|
||||
|
||||
<br />
|
||||
<table>
|
||||
<tr>
|
||||
<td><strong>Your last sms: </strong></td>
|
||||
<td><pre><%=sent%></pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<%+footer%>
|
||||
|
10
luci-app-bmx6/files/usr/lib/lua/luci/view/bmx6/error.htm
Normal file
10
luci-app-bmx6/files/usr/lib/lua/luci/view/bmx6/error.htm
Normal file
|
@ -0,0 +1,10 @@
|
|||
<%+header%>
|
||||
<h2><a id="content" name="content"><%:ERROR%></a></h2>
|
||||
<strong>Some error has occurred</strong>
|
||||
<br />
|
||||
<pre>
|
||||
<%=txt%>
|
||||
</pre>
|
||||
<br />
|
||||
<%+footer%>
|
||||
|
120
luci-app-bmx6/files/usr/lib/lua/luci/view/bmx6/gateways_j.htm
Normal file
120
luci-app-bmx6/files/usr/lib/lua/luci/view/bmx6/gateways_j.htm
Normal file
|
@ -0,0 +1,120 @@
|
|||
<%+header%>
|
||||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
|
||||
var displayExtraInfo = function ( id ) {
|
||||
|
||||
document.getElementById('extra-info').innerHTML = document.getElementById(id).innerHTML;
|
||||
}
|
||||
XHR.poll(5, '/cgi-bin/bmx6-info', { 'descriptions/all': '' },
|
||||
function(x, st)
|
||||
{
|
||||
var tb = document.getElementById('descriptions_table');
|
||||
var rowcount = 0;
|
||||
var tunicon = "<%=resource%>/icons/tunnel.png";
|
||||
/* clear all rows */
|
||||
while( tb.rows.length > 1 ) tb.deleteRow(1);
|
||||
|
||||
for ( var k in st )
|
||||
{
|
||||
var description = st[k].DESC_ADV;
|
||||
var tun4in6;
|
||||
|
||||
for ( var k in description.extensions )
|
||||
{
|
||||
var value = description.extensions[k];
|
||||
|
||||
if ( value.TUN4IN6_NET_EXTENSION )
|
||||
{
|
||||
tun4in6 = value.TUN4IN6_NET_EXTENSION;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( tun4in6 )
|
||||
{
|
||||
var nodename = description.globalId.replace(/\..+$/,'');
|
||||
|
||||
for( var i = 0; i < tun4in6.length; i++ )
|
||||
{
|
||||
var tr = tb.insertRow(-1);
|
||||
var network = tun4in6[i].network;
|
||||
var network_len = tun4in6[i].networklen;
|
||||
var network_bw = tun4in6[i].bandwidth;
|
||||
|
||||
if ( network_len >= 32 ) continue;
|
||||
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((rowcount++ % 2) + 1);
|
||||
tr.insertCell(-1).innerHTML = String.format('<a href="/cgi-bin/bmx6control?function=gwselect&node=%s"><img src="%s" /></a>',nodename,tunicon);
|
||||
tr.insertCell(-1).innerHTML = nodename;
|
||||
tr.insertCell(-1).innerHTML = network + '/' + network_len;
|
||||
tr.insertCell(-1).innerHTML = network_bw;
|
||||
|
||||
|
||||
}
|
||||
|
||||
if( tb.rows.length == 1 )
|
||||
{
|
||||
var tr = tb.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 4;
|
||||
td.innerHTML = '<em><br /><%:There are no gateways announced in the network.%></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]></script>
|
||||
|
||||
<style>
|
||||
|
||||
div.hideme{
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.info{
|
||||
background: #FFF;
|
||||
border: solid 1px;
|
||||
height: 80px;
|
||||
display: block;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
div.inforow{
|
||||
text-align:left;
|
||||
display:inline-block;
|
||||
width:20%;
|
||||
margin:5px;
|
||||
vertical-align:top;
|
||||
|
||||
}
|
||||
|
||||
#extra-info ul { list-style: none outside none; margin-left: 0em; }
|
||||
|
||||
</style>
|
||||
<div class="cbi-map">
|
||||
|
||||
<h2>Originators</h2>
|
||||
<div class="cbi-map-descr"></div>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Mesh gateways%></legend>
|
||||
<table class="cbi-section-table" id="descriptions_table">
|
||||
<tr class="cbi-section-table-titles">
|
||||
<th class="cbi-section-table-cell"></th>
|
||||
<th class="cbi-section-table-cell"><%:Node%></th>
|
||||
<th class="cbi-section-table-cell"><%:Network%></th>
|
||||
<th class="cbi-section-table-cell"><%:Bandwidth%></th>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-row">
|
||||
<td colspan="4"><em><br /><%:Collecting data...%></em></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
|
||||
<%+footer%>
|
||||
|
110
luci-app-bmx6/files/usr/lib/lua/luci/view/bmx6/graph.htm
Normal file
110
luci-app-bmx6/files/usr/lib/lua/luci/view/bmx6/graph.htm
Normal file
|
@ -0,0 +1,110 @@
|
|||
<%#
|
||||
Copyright (C) 2011 Pau Escrich <pau@dabax.net>
|
||||
Contributors Jo-Philip
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
The full GNU General Public License is included in this distribution in
|
||||
the file called "COPYING".
|
||||
-%>
|
||||
|
||||
<%
|
||||
luci.http.prepare_content("text/html")
|
||||
|
||||
local location = { unpack(luci.dispatcher.context.path) }
|
||||
location[#location] = "topology"
|
||||
%>
|
||||
|
||||
<%+header%>
|
||||
|
||||
<script type="text/javascript" src="<%=resource%>/bmx6/js/raphael-min.js"></script>
|
||||
<script type="text/javascript" src="<%=resource%>/bmx6/js/dracula_graffle.js"></script>
|
||||
<script type="text/javascript" src="<%=resource%>/bmx6/js/jquery-1.4.2.min.js"></script>
|
||||
<script type="text/javascript" src="<%=resource%>/bmx6/js/dracula_graph.js"></script>
|
||||
|
||||
<button id="redraw" onclick="redraw();">  redraw  </button>
|
||||
|
||||
<div id="wait" style="text-align: center">
|
||||
<br /><br />
|
||||
<img src="<%=resource%>/icons/loading.gif" />
|
||||
<%:Collecting data...%>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="canvas" style="min-width:800px; min-height:800px"></div>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
var redraw;
|
||||
|
||||
XHR.get('<%=luci.dispatcher.build_url(unpack(location))%>', null,
|
||||
function(x, data)
|
||||
{
|
||||
var g = new Graph();
|
||||
var seen = { };
|
||||
|
||||
for (var i = 0; i < (data.length); i++)
|
||||
{
|
||||
// node->node
|
||||
if (data[i].globalId)
|
||||
{
|
||||
for (var j = 0; j < (data[i].links.length); j++)
|
||||
{
|
||||
var key = (data[i].globalId < data[i].links[j].globalId)
|
||||
? data[i].globalId + '|' + data[i].links[j].globalId
|
||||
: data[i].links[j].globalId + '|' + data[i].globalId;
|
||||
|
||||
var rxRate = data[i].links[j].rxRate;
|
||||
var txRate = data[i].links[j].txRate;
|
||||
|
||||
if (!seen[key] && rxRate>0 && txRate>0)
|
||||
{
|
||||
g.addEdge(data[i].globalId, data[i].links[j].globalId,
|
||||
{ label: rxRate + '/' + txRate,
|
||||
directed: false, stroke: '#aaaaaa', fill: '#ffffff',
|
||||
'label-style': { 'font-size': 8 }});
|
||||
seen[key] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//g.addEdge(data[i].router, data[i].neighbor,
|
||||
// { label: data[i].label, directed: true, stroke: '#aaaaaa' });
|
||||
// node->leaf
|
||||
//else if (data[i].router && data[i].gateway)
|
||||
// g.addEdge(data[i].router, data[i].gateway,
|
||||
// { label: 'leaf', stroke: '#cccccc' });
|
||||
}
|
||||
|
||||
var canvas = document.getElementById('canvas');
|
||||
|
||||
var layouter = new Graph.Layout.Spring(g);
|
||||
layouter.layout();
|
||||
|
||||
var divwait = document.getElementById("wait");
|
||||
divwait.parentNode.removeChild(divwait);
|
||||
|
||||
var renderer = new Graph.Renderer.Raphael(canvas.id, g, canvas.offsetWidth, canvas.offsetHeight);
|
||||
renderer.draw();
|
||||
|
||||
redraw = function() {
|
||||
layouter.layout();
|
||||
renderer.draw();
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
//]]></script>
|
||||
|
||||
|
||||
<%+footer%>
|
|
@ -0,0 +1,59 @@
|
|||
<%+header%>
|
||||
|
||||
<style type="text/css">
|
||||
table.int {
|
||||
border-width: 2px;
|
||||
border-spacing: ;
|
||||
border-style: inset;
|
||||
border-color: white;
|
||||
border-collapse: collapse;
|
||||
background-color: #dadbe6;
|
||||
}
|
||||
table.int tr {
|
||||
border-width: 5px;
|
||||
padding: 4px;
|
||||
border-style: solid;
|
||||
border-color: white;
|
||||
background-color: #dadbe9;
|
||||
}
|
||||
table.int td {
|
||||
border-width: 5px;
|
||||
padding: 4px;
|
||||
border-style: solid;
|
||||
border-color: white;
|
||||
background-color: #dadbe9;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h2><a id="content" name="content"><%:Interfaces%></a></h2>
|
||||
Interfaces where bmx6 is running
|
||||
<br />
|
||||
<br />
|
||||
<table class="int">
|
||||
<tr>
|
||||
<td><strong>Name</strong></td>
|
||||
<td><strong>State</strong></td>
|
||||
<td><strong>Type</strong></td>
|
||||
<td><strong>Rate (Min/Max)</strong></td>
|
||||
<td><strong>Local IP</strong></td>
|
||||
<td><strong>Global IP</strong></td>
|
||||
<td><strong>Multicast IP</strong></td>
|
||||
<td><strong>Primary</strong></td>
|
||||
</tr>
|
||||
<% for i,v in ipairs(data) do %>
|
||||
<tr>
|
||||
<td><%=v.devName%></td>
|
||||
<td><%=v.state%></td>
|
||||
<td><%=v.type%></td>
|
||||
<td><%=v.rateMin%>/<%=v.rateMax%></td>
|
||||
<td><%=v.llocalIp%></td>
|
||||
<td><%=v.globalIp%></td>
|
||||
<td><%=v.multicastIp%></td>
|
||||
<td><%=v.primary%></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
<%+footer%>
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue