├── .github ├── issue_template ├── pull_request_template └── workflows │ ├── check-autorelease-deprecation.yml │ ├── ci_helpers.sh │ ├── formal.yml │ └── multi-arch-test-build.yml ├── MAINTAINERS ├── README.md ├── ahcpd ├── Makefile └── files │ ├── ahcpd.config │ └── ahcpd.init ├── alfred ├── Config.in ├── Makefile └── files │ ├── alfred.config │ ├── alfred.init │ └── bat-hosts.lua ├── babel-pinger └── Makefile ├── babeld ├── Makefile ├── files │ ├── babeld.conf │ ├── babeld.config │ └── babeld.init ├── patches │ └── 600-add-ubus.patch └── src │ ├── ubus.c │ └── ubus.h ├── batctl └── Makefile ├── batman-adv ├── Config.in ├── Makefile ├── files │ ├── etc │ │ └── uci-defaults │ │ │ └── 99-migrate-batadv_hardif │ └── lib │ │ └── netifd │ │ └── proto │ │ ├── batadv.sh │ │ ├── batadv_hardif.sh │ │ └── batadv_vlan.sh ├── patches │ ├── 0001-fix-batadv_is_cfg80211_netdev.patch │ ├── 0002-Revert-batman-adv-Switch-to-linux-array_size.h.patch │ └── 0003-Revert-batman-adv-move-asm-unaligned.h-to-linux-unal.patch └── src │ └── compat-hacks.h ├── batmand ├── Makefile ├── files │ └── etc │ │ ├── config │ │ └── batmand │ │ └── init.d │ │ └── batmand └── patches │ ├── 0001-Allow-one-to-disable-forking-to-background-in-debug_.patch │ └── 0002-batmand-Add-missing-string.h-include.patch ├── bird2 ├── Makefile ├── files │ └── bird.init ├── patches │ └── 000-ospf-bus-error.patch └── test.sh ├── bird3 ├── Makefile ├── files │ └── bird.init └── test.sh ├── bmx7 ├── Makefile ├── files │ └── etc │ │ ├── config │ │ └── bmx7 │ │ └── init.d │ │ └── bmx7 └── patches │ └── 020-siocgstamp.patch ├── cjdns ├── Makefile ├── files │ ├── cjdns.defaults │ ├── cjdns.init │ ├── cjdrouteconf │ └── luci-app-cjdns.json ├── lua │ └── cjdns │ │ ├── admin.lua │ │ ├── common.lua │ │ ├── init.lua │ │ ├── uci.lua │ │ └── udp.lua └── patches │ ├── 001-five-mins-builder-zonk.patch │ ├── 020-prefer-python2.patch │ ├── 030-fix-invalid-pointer.patch │ └── 040-gyp-python_310.patch ├── hnetd ├── Makefile ├── files │ ├── hnet.config │ ├── hnetd.defaults │ └── hnetd.init └── patches │ ├── 010-openssl-deprecated.patch │ └── 020-unused.patch ├── luci-app-cjdns ├── Makefile ├── files │ └── luci-app-cjdns.json └── luasrc │ ├── controller │ └── cjdns.lua │ ├── model │ └── cbi │ │ └── cjdns │ │ ├── cjdrouteconf.lua │ │ ├── iptunnel.lua │ │ ├── overview.lua │ │ ├── peering.lua │ │ └── settings.lua │ └── view │ ├── admin_status │ └── index │ │ └── cjdns.htm │ └── cjdns │ ├── status.htm │ └── value.htm ├── luci-app-olsrd2 ├── Makefile ├── htdocs │ ├── cgi-bin-olsrd2-neigh.html │ └── luci-static │ │ └── resources │ │ └── view │ │ └── olsrd2 │ │ ├── attachednetwork.js │ │ ├── domain.js │ │ ├── global.js │ │ ├── interface.js │ │ ├── lan_import.js │ │ ├── log.js │ │ ├── luci.js │ │ ├── mesh.js │ │ ├── neighbors.js │ │ ├── node.js │ │ ├── olsrv2.js │ │ ├── olsrv2_lan.js │ │ └── overview.js └── root │ ├── etc │ └── config │ │ └── luci_olsrd2 │ ├── lib │ └── functions │ │ └── olsrd2.sh │ └── usr │ ├── libexec │ └── rpcd │ │ └── status.olsrd2 │ └── share │ ├── luci │ └── menu.d │ │ └── luci-app-olsrd2.json │ ├── rpcd │ └── acl.d │ │ └── luci-app-olsrd2.json │ └── ucitrack │ └── luci-app-olsrd2.json ├── mesh11sd └── Makefile ├── minimalist-pcproxy ├── Makefile └── files │ └── minimalist-pcproxy.defaults ├── naywatch ├── Makefile └── files │ ├── naywatch.config │ ├── naywatch.init │ └── naywatch.sh ├── ndppd ├── Makefile ├── files │ └── ndppd.init └── patches │ ├── 0001-Version-bump.patch │ ├── 0002-Fixes-strerror_r-GNU-XSI.patch │ └── 0003-fix-poll-header.patch ├── nodogsplash ├── Makefile └── files │ ├── etc │ ├── config │ │ └── nodogsplash │ ├── init.d │ │ └── nodogsplash │ └── uci-defaults │ │ └── 40_nodogsplash │ └── usr │ └── lib │ └── nodogsplash │ └── restart.sh ├── ohybridproxy ├── Makefile └── files │ ├── ohybridproxy.config │ ├── ohybridproxy.hotplug │ └── ohybridproxy.init ├── olsrd ├── Makefile ├── files │ ├── olsrd-neigh.sh │ ├── olsrd.config │ ├── olsrd.pud.position.conf │ ├── olsrd.sgw.speed.conf │ ├── olsrd.sh │ ├── olsrd4.init │ ├── olsrd6.config │ ├── olsrd6.init │ └── olsrd_secure_key ├── patches │ ├── 102-olsrd-prevent-storm-patches.patch │ └── 600-add-ubus-support.patch └── src │ └── src │ ├── ubus.c │ └── ubus.h ├── oonf-dlep-proxy ├── Makefile └── files │ ├── dlep_proxy.hotplug │ ├── dlep_proxy.init │ └── dlep_proxy.uci ├── oonf-dlep-radio ├── Makefile └── files │ ├── dlep_radio.hotplug │ ├── dlep_radio.init │ └── dlep_radio.uci ├── oonf-init-scripts ├── Makefile └── files │ ├── oonf_hotplug.sh │ └── oonf_init.sh ├── oonf-olsrd2 ├── Config.in ├── Makefile ├── files │ ├── olsrd2.hotplug │ ├── olsrd2.init │ └── olsrd2.uci └── patches │ └── 100-enable-lan-import-plugin.patch ├── opennds └── Makefile ├── pimbd ├── Makefile └── files │ ├── firewall-uci.sh │ ├── pimb.config │ └── pimbd.init ├── prince ├── Makefile ├── files │ ├── prince.conf │ └── prince.init └── patches │ └── 010-gcc10.patch └── vis ├── Makefile ├── files └── etc │ ├── config │ └── vis │ └── init.d │ └── vis └── patches └── 0001-Allow-one-to-disable-forking-to-background-in-debug_.patch /.github/issue_template: -------------------------------------------------------------------------------- 1 | Please make sure that the issue subject starts with `: ` 2 | 3 | Also make sure that the package is maintained in this repository and not in OpenWrt-base, OpenWrt-packages or OpenWrt-LuCI. 4 | 5 | Issues related to releases below 18.06 and forks are not supported or maintained and will be closed. 6 | 7 | # Issue template (remove lines from top till here) 8 | 9 | Maintainer: @\ (find it by checking history of the package Makefile) 10 | Environment: (put here arch, model, OpenWrt version) 11 | 12 | Description: 13 | 14 | ``` 15 | Formating code blocks by wrapping them with pairs of ``` 16 | ``` 17 | -------------------------------------------------------------------------------- /.github/pull_request_template: -------------------------------------------------------------------------------- 1 | Maintainer: me / @\ (find it by checking history of the package Makefile) 2 | Compile tested: (put here arch, model, OpenWrt version) 3 | Run tested: (put here arch, model, OpenWrt version, tests done) 4 | 5 | Description: 6 | -------------------------------------------------------------------------------- /.github/workflows/check-autorelease-deprecation.yml: -------------------------------------------------------------------------------- 1 | name: Check autorelease deprecation 2 | 3 | on: 4 | pull_request_target: 5 | types: [opened, synchronize, converted_to_draft, ready_for_review, edited] 6 | 7 | jobs: 8 | build: 9 | name: Check autorelease deprecation 10 | runs-on: ubuntu-latest 11 | strategy: 12 | fail-fast: false 13 | 14 | permissions: 15 | pull-requests: write 16 | 17 | steps: 18 | - uses: actions/checkout@v3 19 | with: 20 | ref: ${{ github.event.pull_request.head.sha }} 21 | fetch-depth: 0 22 | 23 | - name: Determine branch name 24 | run: | 25 | BRANCH="${GITHUB_BASE_REF#refs/heads/}" 26 | echo "Building for $BRANCH" 27 | echo "BRANCH=$BRANCH" >> $GITHUB_ENV 28 | 29 | - name: Determine changed packages 30 | run: | 31 | RET=0 32 | 33 | # only detect packages with changes 34 | PKG_ROOTS=$(find . -name Makefile | \ 35 | grep -v ".*/src/Makefile" | \ 36 | sed -e 's@./\(.*\)/Makefile@\1/@') 37 | CHANGES=$(git diff --diff-filter=d --name-only origin/$BRANCH...) 38 | 39 | for ROOT in $PKG_ROOTS; do 40 | for CHANGE in $CHANGES; do 41 | if [[ "$CHANGE" == "$ROOT"* ]]; then 42 | if grep -q '$(AUTORELEASE)' "$ROOT/Makefile"; then 43 | CONTAINS_AUTORELEASE+="$ROOT" 44 | fi 45 | break 46 | fi 47 | done 48 | done 49 | 50 | if [ -n "$CONTAINS_AUTORELEASE" ]; then 51 | RET=1 52 | cat > "$GITHUB_WORKSPACE/pr_comment.md" << EOF 53 | Please do no longer set *PKG_RELEASE* to *AUTORELEASE* as the 54 | feature is deprecated. Please use an integer instead. Below is a 55 | list of affected packages including correct *PKG_RELEASE*: 56 | 57 | EOF 58 | fi 59 | 60 | for ROOT in $CONTAINS_AUTORELEASE; do 61 | echo -n " - ${ROOT}Makefile: PKG_RELEASE:=" >> "$GITHUB_WORKSPACE/pr_comment.md" 62 | last_bump="$(git log --pretty=format:'%h %s' "$ROOT" | 63 | grep --max-count=1 -e ': [uU]pdate to ' -e ': [bB]ump to ' | 64 | cut -f 1 -d ' ')" 65 | 66 | if [ -n "$last_bump" ]; then 67 | echo -n $(($(git rev-list --count "$last_bump..HEAD" "$ROOT") + 2)) >> "$GITHUB_WORKSPACE/pr_comment.md" 68 | else 69 | echo -n $(($(git rev-list --count HEAD "$ROOT") + 2)) >> "$GITHUB_WORKSPACE/pr_comment.md" 70 | fi 71 | echo >> "$GITHUB_WORKSPACE/pr_comment.md" 72 | done 73 | 74 | exit $RET 75 | 76 | - name: Find Comment 77 | uses: peter-evans/find-comment@v2 78 | if: ${{ failure() }} 79 | id: fc 80 | with: 81 | issue-number: ${{ github.event.pull_request.number }} 82 | comment-author: 'github-actions[bot]' 83 | 84 | - name: Create or update comment 85 | uses: peter-evans/create-or-update-comment@v2 86 | if: ${{ failure() }} 87 | with: 88 | comment-id: ${{ steps.fc.outputs.comment-id }} 89 | issue-number: ${{ github.event.pull_request.number }} 90 | body-file: 'pr_comment.md' 91 | edit-mode: replace 92 | -------------------------------------------------------------------------------- /.github/workflows/ci_helpers.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | color_out() { 4 | printf "\e[0;$1m$PKG_NAME: %s\e[0;0m\n" "$2" 5 | } 6 | 7 | success() { 8 | color_out 32 "$1" 9 | } 10 | 11 | info() { 12 | color_out 36 "$1" 13 | } 14 | 15 | err() { 16 | color_out 31 "$1" 17 | } 18 | 19 | warn() { 20 | color_out 33 "$1" 21 | } 22 | 23 | err_die() { 24 | err "$1" 25 | exit 1 26 | } 27 | -------------------------------------------------------------------------------- /.github/workflows/formal.yml: -------------------------------------------------------------------------------- 1 | name: Test Formalities 2 | 3 | on: 4 | pull_request: 5 | 6 | jobs: 7 | build: 8 | name: Test Formalities 9 | runs-on: ubuntu-latest 10 | strategy: 11 | fail-fast: false 12 | 13 | steps: 14 | - uses: actions/checkout@v3 15 | with: 16 | ref: ${{ github.event.pull_request.head.sha }} 17 | fetch-depth: 0 18 | 19 | - name: Determine branch name 20 | run: | 21 | BRANCH="${GITHUB_BASE_REF#refs/heads/}" 22 | echo "Building for $BRANCH" 23 | echo "BRANCH=$BRANCH" >> $GITHUB_ENV 24 | 25 | - name: Test formalities 26 | run: | 27 | source .github/workflows/ci_helpers.sh 28 | 29 | RET=0 30 | for commit in $(git rev-list HEAD ^origin/$BRANCH); do 31 | info "=== Checking commit '$commit'" 32 | if git show --format='%P' -s $commit | grep -qF ' '; then 33 | err "Pull request should not include merge commits" 34 | RET=1 35 | fi 36 | 37 | subject="$(git show -s --format=%s $commit)" 38 | if echo "$subject" | grep -q -e '^[0-9A-Za-z,+/_-]\+: ' -e '^Revert '; then 39 | success "Commit subject line seems ok ($subject)" 40 | else 41 | err "Commit subject line MUST start with ': ' ($subject)" 42 | RET=1 43 | fi 44 | 45 | body="$(git show -s --format=%b $commit)" 46 | sob="$(git show -s --format='Signed-off-by: %aN <%aE>' $commit)" 47 | if echo "$body" | grep -qF "$sob"; then 48 | success "Signed-off-by match author" 49 | else 50 | err "Signed-off-by is missing or doesn't match author (should be '$sob')" 51 | RET=1 52 | fi 53 | done 54 | 55 | exit $RET 56 | -------------------------------------------------------------------------------- /.github/workflows/multi-arch-test-build.yml: -------------------------------------------------------------------------------- 1 | name: Feeds Package Test Build 2 | 3 | on: 4 | pull_request: 5 | 6 | jobs: 7 | build: 8 | name: Feeds Package Test Build 9 | uses: openwrt/actions-shared-workflows/.github/workflows/multi-arch-test-build.yml@main 10 | -------------------------------------------------------------------------------- /MAINTAINERS: -------------------------------------------------------------------------------- 1 | # _______ ________ __ 2 | # | |.-----.-----.-----.| | | |.----.| |_ 3 | # | - || _ | -__| || | | || _|| _| 4 | # |_______|| __|_____|__|__||________||__| |____| 5 | # |__| W I R E L E S S F R E E D O M 6 | # 7 | # People listed here are managing the OpenWrt routing feed, 8 | # use alphabetical order when updating the list. 9 | 10 | Axel "axn" Neumann 11 | Baptiste Jonglez 12 | Bastian Bittorf 13 | Corinna "Elektra" Aichele 14 | Gabriel Kerneis 15 | Gui Iribarren 16 | Jo-Philipp Wich 17 | Luka Perkov 18 | Marek Lindner 19 | Moritz Warning 20 | Nicolás Echániz 21 | Pau Escrich 22 | Saverio Proto 23 | Simon Wunderlich 24 | Steven Barth 25 | Vasilis "acinonyx" Tsiligiannis 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OpenWrt Routing Feed 2 | 3 | ## Description 4 | 5 | This OpenWrt package feed contains community maintained routing packages. 6 | 7 | ## Usage 8 | 9 | 10 | This repository is intended to be layered on-top of an OpenWrt buildroot. 11 | If you do not have an OpenWrt buildroot installed, see the documentation at: 12 | [OpenWrt Buildroot – Installation][1] on the OpenWrt support site. 13 | 14 | This feed is enabled by default. To install all its package definitions, run: 15 | 16 | ``` 17 | ./scripts/feeds update routing 18 | ./scripts/feeds install -a -p routing 19 | ``` 20 | 21 | [1]: https://openwrt.org/docs/guide-developer/build-system/install-buildsystem 22 | -------------------------------------------------------------------------------- /ahcpd/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2007-2011 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=ahcpd 11 | PKG_VERSION:=0.53 12 | PKG_RELEASE:=3 13 | 14 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 15 | PKG_SOURCE_URL:=https://www.irif.fr/~jch/software/files/ 16 | PKG_HASH:=a4622e817d2b2a9b878653f085585bd57f3838cc546cca6028d3b73ffcac0d52 17 | 18 | PKG_MAINTAINER:=Gabriel Kerneis 19 | PKG_LICENSE:=MIT 20 | PKG_LICENSE_FILES:=LICENCE 21 | 22 | include $(INCLUDE_DIR)/package.mk 23 | 24 | define Package/ahcpd 25 | SECTION:=net 26 | CATEGORY:=Network 27 | TITLE:=Ad-Hoc Configuration Protocol daemon 28 | URL:=https://www.irif.fr/~jch/software/ahcp/ 29 | DEPENDS:=@IPV6 +ip +librt 30 | endef 31 | 32 | define Package/ahcpd/description 33 | Ahcpd is a daemon for configuring an IPv6 network using the Ad-Hoc 34 | Configuration Protocol (AHCP). AHCP is designed for wireless mesh 35 | networks, where IPv6 autoconfiguration and DHCPv6 do not work, but may 36 | also be used on wired networks. 37 | endef 38 | 39 | define Package/ahcpd/conffiles 40 | /etc/config/ahcpd 41 | endef 42 | 43 | MAKE_FLAGS += \ 44 | EXTRA_DEFINES="$(TARGET_CFLAGS)" 45 | 46 | define Package/ahcpd/install 47 | $(INSTALL_DIR) $(1)/usr/bin 48 | $(INSTALL_DIR) $(1)/etc/ahcp 49 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/ahcp-config.sh $(1)/etc/ahcp/ 50 | $(INSTALL_DIR) $(1)/usr/sbin 51 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/ahcpd $(1)/usr/sbin/ 52 | $(INSTALL_DIR) $(1)/etc/config 53 | $(INSTALL_CONF) ./files/ahcpd.config $(1)/etc/config/ahcpd 54 | $(INSTALL_DIR) $(1)/etc/init.d 55 | $(INSTALL_BIN) ./files/ahcpd.init $(1)/etc/init.d/ahcpd 56 | endef 57 | 58 | $(eval $(call BuildPackage,ahcpd)) 59 | -------------------------------------------------------------------------------- /ahcpd/files/ahcpd.config: -------------------------------------------------------------------------------- 1 | package ahcpd 2 | 3 | config ahcpd 4 | # Choose ahcp mode: client (default), server or forwarder 5 | ## option 'mode' 'client' 6 | # Uncomment the following lines to enable ahcpd on the desired 7 | # interfaces. 8 | ## list 'interface' 'lan' 9 | ## list 'interface' 'wlan' 10 | 11 | # The following only makes sense in 'server' mode. 12 | # Tweak to suit your needs. 13 | ## list 'prefix' 'fde6:20f5:c9ac:358::/64' 14 | ## list 'prefix' '192.168.4.128/25' 15 | ## list 'name_server' 'fde6:20f5:c9ac:358::1' 16 | ## list 'name_server' '192.168.4.1' 17 | ## list 'ntp_server' '192.168.4.2' 18 | ## option 'lease_dir' '/var/lib/leases' 19 | 20 | # option 'id_file' '/var/lib/ahcp-unique-id' 21 | # option 'log_file' '/var/log/ahcpd.log' 22 | # The configuration file is not necessary since you can configure 23 | # everything from this file. But still, you might prefer using it. 24 | ## option 'conf_file' '/etc/ahcp/ahcp.conf' 25 | 26 | # option 'multicast_address' 'ff02::cca6:c0f9:e182:5359' 27 | # option 'port' '5359' 28 | # option 'ipv4_only' 'false' 29 | # option 'ipv6_only' 'false' 30 | # option 'lease_time' '3666' 31 | # option 'debug' '1' 32 | 33 | -------------------------------------------------------------------------------- /ahcpd/files/ahcpd.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2007-2011 OpenWrt.org 3 | 4 | START=71 5 | 6 | SERVICE_USE_PID=1 7 | 8 | EXTRA_COMMANDS="status" 9 | EXTRA_HELP=" status Print ahcpd's status to the log file." 10 | 11 | append_bool() { 12 | local section="$1" 13 | local option="$2" 14 | local value="$3" 15 | local _loctmp 16 | config_get_bool _loctmp "$section" "$option" 0 17 | [ "$_loctmp" -gt 0 ] && append args "$value" 18 | } 19 | 20 | append_parm() { 21 | local section="$1" 22 | local option="$2" 23 | local switch="$3" 24 | local _loctmp 25 | config_get _loctmp "$section" "$option" 26 | [ -z "$_loctmp" ] && return 0 27 | append args "$switch $_loctmp" 28 | } 29 | 30 | append_stmt() { 31 | local name="$1" 32 | local switch="$2" 33 | append args "-C '$switch $name'" 34 | } 35 | 36 | append_opt_stmt() { 37 | local section="$1" 38 | local option="$2" 39 | local switch="$3" 40 | local _loctmp 41 | config_get _loctmp "$section" "$option" 42 | [ -z "$_loctmp" ] && return 0 43 | append args "-C '$switch $_loctmp'" 44 | } 45 | 46 | ahcp_addif() { 47 | local ifname=$(uci_get_state network "$1" ifname "$1") 48 | append interfaces "$ifname" 49 | } 50 | 51 | ahcp_server() { 52 | local cfg="$1" 53 | 54 | append_opt_stmt "$cfg" 'mode' 'mode' 55 | append_opt_stmt "$cfg" 'lease_dir' 'lease-dir' 56 | config_list_foreach "$cfg" 'prefix' append_stmt 'prefix' 57 | config_list_foreach "$cfg" 'name_server' append_stmt 'name-server' 58 | config_list_foreach "$cfg" 'ntp_server' append_stmt 'ntp-server' 59 | 60 | append_parm "$cfg" 'id_file' '-i' 61 | append_parm "$cfg" 'log_file' '-L' 62 | } 63 | 64 | ahcp_config() { 65 | local cfg="$1" 66 | local interface 67 | local _loctmp 68 | 69 | config_list_foreach "$cfg" 'interface' ahcp_addif 70 | 71 | # Add interfaces with "option proto ahcp" in /etc/config/network 72 | # (only for client mode) 73 | config_get _loctmp "$cfg" "mode" 74 | if [ -z "$_loctmp" -o "$_loctmp" = "client" ]; then 75 | for interface in $(uci -P /var/state show network|grep proto=ahcp|cut -d. -f2); do 76 | ahcp_addif $interface 77 | done 78 | fi 79 | 80 | append_bool "$cfg" 'ipv4_only' '-4' 81 | append_bool "$cfg" 'ipv6_only' '-6' 82 | append_bool "$cfg" 'no_dns' '-N' 83 | 84 | append_parm "$cfg" 'multicast_address' '-m' 85 | append_parm "$cfg" 'port' '-p' 86 | append_parm "$cfg" 'lease_time' '-t' 87 | append_parm "$cfg" 'debug' '-d' 88 | append_parm "$cfg" 'conf_file' '-c' 89 | append_parm "$cfg" 'script' '-s' 90 | } 91 | 92 | start() { 93 | mkdir -p /var/lib 94 | config_load ahcpd 95 | unset args 96 | unset interfaces 97 | config_foreach ahcp_config ahcpd 98 | config_foreach ahcp_server ahcpd 99 | [ -z "$interfaces" ] && return 0 100 | eval "service_start /usr/sbin/ahcpd -D $args $interfaces" 101 | } 102 | 103 | stop() { 104 | service_stop /usr/sbin/ahcpd 105 | } 106 | 107 | status() { 108 | SERVICE_SIG="USR1" service_signal /usr/sbin/ahcpd 109 | } 110 | -------------------------------------------------------------------------------- /alfred/Config.in: -------------------------------------------------------------------------------- 1 | config ALFRED_NEEDS_lua 2 | bool 3 | 4 | config ALFRED_NEEDS_libgps 5 | bool 6 | 7 | config PACKAGE_ALFRED_VIS 8 | bool "enable vis server for alfred" 9 | depends on PACKAGE_alfred 10 | default y 11 | 12 | config PACKAGE_ALFRED_BATHOSTS 13 | bool "enable autogeneration of /etc/bat-hosts" 14 | depends on PACKAGE_alfred 15 | select ALFRED_NEEDS_lua 16 | default n 17 | 18 | config PACKAGE_ALFRED_GPSD 19 | bool "enable gpsd service for alfred" 20 | depends on PACKAGE_alfred 21 | select ALFRED_NEEDS_libgps 22 | default n 23 | -------------------------------------------------------------------------------- /alfred/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-only 2 | 3 | include $(TOPDIR)/rules.mk 4 | 5 | PKG_NAME:=alfred 6 | PKG_VERSION:=2025.1 7 | PKG_RELEASE:=1 8 | 9 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 10 | PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) 11 | PKG_HASH:=7fb8b3f1cc4ec488e8d43fd915dda0a7cdf5b611bf39d60ddeb4486ac0025f18 12 | 13 | PKG_MAINTAINER:=Simon Wunderlich 14 | PKG_LICENSE:=GPL-2.0-only MIT 15 | PKG_LICENSE_FILES:=LICENSES/preferred/GPL-2.0 LICENSES/preferred/MIT 16 | 17 | PKG_BUILD_PARALLEL:=1 18 | PKG_BUILD_FLAGS:=gc-sections lto 19 | 20 | PKG_CONFIG_DEPENDS += \ 21 | CONFIG_ALFRED_NEEDS_lua \ 22 | CONFIG_ALFRED_NEEDS_libgps \ 23 | CONFIG_PACKAGE_ALFRED_VIS \ 24 | CONFIG_PACKAGE_ALFRED_BATHOSTS \ 25 | CONFIG_PACKAGE_ALFRED_GPSD 26 | 27 | include $(INCLUDE_DIR)/package.mk 28 | 29 | define Package/alfred 30 | SECTION:=net 31 | CATEGORY:=Network 32 | TITLE:=A.L.F.R.E.D. - Almighty Lightweight Fact Remote Exchange Daemon 33 | URL:=https://www.open-mesh.org/ 34 | DEPENDS:= +libc @IPV6 +libnl-tiny +librt \ 35 | +ALFRED_NEEDS_lua:lua \ 36 | +ALFRED_NEEDS_libgps:libgps 37 | endef 38 | 39 | define Package/alfred/description 40 | alfred is a user space daemon for distributing arbitrary local information 41 | over the mesh/network in a decentralized fashion. This data can be anything 42 | which appears to be useful - originally designed to replace the batman-adv 43 | visualization (vis), you may distribute hostnames, phone books, administration 44 | information, DNS information, the local weather forecast ... 45 | 46 | alfred runs as daemon in the background of the system. A user may insert 47 | information by using the alfred binary on the command line, or use special 48 | programs to communicate with alfred (done via unix sockets). alfred then takes 49 | care of distributing the local information to other alfred servers on other 50 | nodes. This is done via IPv6 link-local multicast, and does not require any 51 | configuration. A user can request data from alfred, and will receive the 52 | information available from all alfred servers in the network. 53 | endef 54 | 55 | define Package/alfred/conffiles 56 | /etc/config/alfred 57 | endef 58 | 59 | define Package/alfred/config 60 | source "$(SOURCE)/Config.in" 61 | endef 62 | 63 | MAKE_FLAGS += \ 64 | CONFIG_ALFRED_VIS=$(if $(CONFIG_PACKAGE_ALFRED_VIS),y,n) \ 65 | CONFIG_ALFRED_GPSD=$(if $(CONFIG_PACKAGE_ALFRED_GPSD),y,n) \ 66 | CONFIG_ALFRED_CAPABILITIES=n \ 67 | LIBNL_NAME="libnl-tiny" \ 68 | LIBNL_GENL_NAME="libnl-tiny" \ 69 | REVISION="$(PKG_VERSION)-openwrt-$(PKG_RELEASE)" 70 | 71 | define Package/alfred/install 72 | $(INSTALL_DIR) $(1)/usr/sbin 73 | cp -fpR $(PKG_BUILD_DIR)/alfred $(1)/usr/sbin/ 74 | [ "x$(CONFIG_PACKAGE_ALFRED_VIS)" == "xy" ] && cp -fpR $(PKG_BUILD_DIR)/vis/batadv-vis $(1)/usr/sbin/ ; true 75 | [ "x$(CONFIG_PACKAGE_ALFRED_GPSD)" == "xy" ] && cp -fpR $(PKG_BUILD_DIR)/gpsd/alfred-gpsd $(1)/usr/sbin/ ; true 76 | $(INSTALL_DIR) $(1)/etc/init.d 77 | $(INSTALL_BIN) ./files/alfred.init $(1)/etc/init.d/alfred 78 | $(INSTALL_DIR) $(1)/etc/config 79 | $(INSTALL_DATA) ./files/alfred.config $(1)/etc/config/alfred 80 | $(INSTALL_DIR) $(1)/etc/alfred 81 | [ "x$(CONFIG_PACKAGE_ALFRED_BATHOSTS)" == "xy" ] && $(INSTALL_BIN) ./files/bat-hosts.lua $(1)/etc/alfred/bat-hosts.lua ; true 82 | endef 83 | 84 | $(eval $(call BuildPackage,alfred)) 85 | -------------------------------------------------------------------------------- /alfred/files/alfred.config: -------------------------------------------------------------------------------- 1 | config 'alfred' 'alfred' 2 | list interface 'br-lan' 3 | option mode 'master' 4 | option batmanif 'bat0' 5 | option start_vis '1' 6 | option run_facters '1' 7 | # REMOVE THIS LINE TO ENABLE ALFRED 8 | option disabled '1' 9 | -------------------------------------------------------------------------------- /alfred/files/alfred.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | START=99 9 | USE_PROCD=1 10 | alfred_args="" 11 | vis_args="" 12 | facters_dir="/etc/alfred" 13 | enable=0 14 | vis_enable=0 15 | 16 | append_interface() 17 | { 18 | append "interfaces" "$1" "," 19 | } 20 | 21 | alfred_start() { 22 | local args="" 23 | local section="$1" 24 | local disabled interface mode 25 | local interfaces 26 | 27 | # check if section is disabled 28 | config_get_bool disabled "$section" disabled 0 29 | [ $disabled = 0 ] || return 1 30 | 31 | args="-f" 32 | 33 | config_list_foreach "$section" "interface" append_interface 34 | if [ -z "$interfaces" ]; then 35 | config_get interface "$section" interface 36 | append_interface "$interface" 37 | fi 38 | append args "-i $interfaces" 39 | 40 | config_get mode "$section" mode 41 | [ "$mode" = "master" ] && append args "-m" 42 | 43 | config_get batmanif "$section" batmanif 44 | append args "-b $batmanif" 45 | 46 | append alfred_args "$args" 47 | enable=1 48 | 49 | config_get_bool start_vis "$section" start_vis 0 50 | if [ "$start_vis" = 1 ] && [ -x /usr/sbin/batadv-vis ]; then 51 | vis_enable=1 52 | append vis_args "-i $batmanif -s" 53 | fi 54 | 55 | config_get_bool run_facters "$section" run_facters 0 56 | 57 | return 0 58 | } 59 | 60 | start_service() { 61 | config_load "alfred" 62 | config_foreach alfred_start alfred 63 | 64 | [ "$enable" = "0" ] && return 0 65 | 66 | procd_open_instance "alfred" 67 | procd_set_param command /usr/sbin/alfred 68 | procd_append_param command ${alfred_args} 69 | procd_close_instance 70 | 71 | [ "$vis_enable" = "1" ] && { 72 | procd_open_instance "batadv-vis" 73 | procd_set_param command /usr/sbin/batadv-vis 74 | procd_append_param command ${vis_args} 75 | procd_close_instance 76 | } 77 | 78 | [ "$run_facters" = "1" ] && { 79 | ( for file in $facters_dir/* ; do [ -x $file ] && $file ; done ) 80 | if ! ( grep -q "for file in $facters_dir/\* ; do " /etc/crontabs/root 2>/dev/null ) ; then 81 | echo "*/5 * * * * ( for file in $facters_dir/* ; do [ -x \$file ] && \$file ; done )" >> /etc/crontabs/root 82 | /etc/init.d/cron enable 83 | /etc/init.d/cron restart 84 | fi 85 | } 86 | } 87 | 88 | service_triggers() { 89 | procd_add_reload_trigger "alfred" 90 | } 91 | 92 | stop_service() { 93 | [ -e /etc/crontabs/root ] && { 94 | sed "\|for file in $facters_dir/\* ; do |d" -i /etc/crontabs/root 95 | /etc/init.d/cron restart 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /alfred/files/bat-hosts.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | 3 | local type_id = 64 -- bat-hosts 4 | 5 | function get_hostname() 6 | local hostfile = io.open("/proc/sys/kernel/hostname", "r") 7 | local ret_string = hostfile:read() 8 | hostfile:close() 9 | return ret_string 10 | end 11 | 12 | function get_interfaces_names() 13 | local ret = {} 14 | 15 | for name in io.popen("ls -1 /sys/class/net/"):lines() do 16 | table.insert(ret, name) 17 | end 18 | 19 | return ret 20 | end 21 | 22 | function get_interface_address(name) 23 | local addressfile = io.open("/sys/class/net/"..name.."/address", "r") 24 | local ret_string = addressfile:read() 25 | addressfile:close() 26 | return ret_string 27 | end 28 | 29 | 30 | local function generate_bat_hosts() 31 | -- get hostname and interface macs/names 32 | -- then return a table containing valid bat-hosts lines 33 | local n, i 34 | local ifaces, ret = {}, {} 35 | 36 | local hostname = get_hostname() 37 | 38 | for n, i in ipairs(get_interfaces_names()) do 39 | local address = get_interface_address(i) 40 | if not ifaces[address] then ifaces[address] = i end 41 | end 42 | 43 | for mac, iname in pairs(ifaces) do 44 | 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 45 | table.insert(ret, mac.." "..hostname.."_"..iname.."\n") 46 | end 47 | end 48 | 49 | return ret 50 | end 51 | 52 | local function publish_bat_hosts() 53 | -- pass a raw chunk of data to alfred 54 | local fd = io.popen("alfred -s " .. type_id, "w") 55 | if fd then 56 | local ret = generate_bat_hosts() 57 | if ret then 58 | fd:write(table.concat(ret)) 59 | end 60 | fd:close() 61 | end 62 | end 63 | 64 | local function write_bat_hosts(rows) 65 | local content = { "### /tmp/bat-hosts generated by alfred-bat-hosts\n", 66 | "### /!\\ This file is overwritten every 5 minutes /!\\\n", 67 | "### (To keep manual changes, replace /etc/bat-hosts symlink with a static file)\n" } 68 | 69 | -- merge the chunks from all nodes, de-escaping newlines 70 | for _, row in ipairs(rows) do 71 | local node, value = unpack(row) 72 | table.insert(content, "# Node ".. node .. "\n") 73 | table.insert(content, value:gsub("\x0a", "\n") .. "\n") 74 | end 75 | 76 | -- write parsed content down to disk 77 | local fd = io.open("/tmp/bat-hosts", "w") 78 | if fd then 79 | fd:write(table.concat(content)) 80 | fd:close() 81 | end 82 | 83 | -- try to make a symlink in /etc pointing to /tmp, 84 | -- if it exists, ln will do nothing. 85 | os.execute("ln -ns /tmp/bat-hosts /etc/bat-hosts 2>/dev/null") 86 | end 87 | 88 | local function receive_bat_hosts() 89 | -- read raw chunks from alfred, convert them to a nested table and call write_bat_hosts 90 | -- "alfred -r" can fail in slave nodes (returns empty stdout), so: 91 | -- check output is not null before writing /tmp/bat-hosts, and retry 3 times before giving up. 92 | for n = 1, 3 do 93 | local fd = io.popen("alfred -r " .. type_id) 94 | --[[ this command returns something like 95 | { "54:e6:fc:b9:cb:37", "00:11:22:33:44:55 ham_wlan0\x0a00:22:33:22:33:22 ham_eth0\x0a" }, 96 | { "90:f6:52:bb:ec:57", "00:22:33:22:33:23 spam\x0a" }, 97 | ]]-- 98 | 99 | if fd then 100 | local output = fd:read("*a") 101 | fd:close() 102 | if output and output ~= "" then 103 | assert(loadstring("rows = {" .. output .. "}"))() 104 | write_bat_hosts(rows) 105 | break 106 | end 107 | end 108 | end 109 | end 110 | 111 | publish_bat_hosts() 112 | receive_bat_hosts() 113 | -------------------------------------------------------------------------------- /babel-pinger/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2014 OpenWrt.org 2 | # 3 | # This is free software, licensed under the GNU General Public License v2. 4 | 5 | include $(TOPDIR)/rules.mk 6 | 7 | PKG_NAME:=babel-pinger 8 | PKG_VERSION:=0.1 9 | PKG_RELEASE:=1 10 | 11 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 12 | PKG_SOURCE_URL:=http://www.pps.univ-paris-diderot.fr/~jch/software/files/ 13 | PKG_HASH:=c411430bb102f08d3d68d2fb5010b5da0149908b671ac0fb12abd8c8ee6380c5 14 | 15 | include $(INCLUDE_DIR)/package.mk 16 | 17 | define Package/babel-pinger 18 | SECTION:=net 19 | CATEGORY:=Network 20 | SUBMENU:=Routing and Redirection 21 | TITLE:=Babel-pinger 22 | URL:=http://www.pps.univ-paris-diderot.fr/~jch/software/babel/ 23 | MAINTAINER:=Gabriel Kerneis 24 | DEPENDS:=+librt 25 | endef 26 | 27 | define Package/babel-pinger/description 28 | Babel-pinger is a hack to export a default route into Babel for people 29 | using DHCP to configure their routers rather than speaking to their 30 | upstream provider with a proper routing protocol. 31 | endef 32 | 33 | MAKE_FLAGS+= \ 34 | CFLAGS="$(TARGET_CFLAGS)" \ 35 | 36 | define Package/babel-pinger/install 37 | $(INSTALL_DIR) $(1)/usr/sbin 38 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/babel-pinger $(1)/usr/sbin/ 39 | endef 40 | 41 | $(eval $(call BuildPackage,babel-pinger)) 42 | -------------------------------------------------------------------------------- /babeld/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-or-later 2 | # 3 | # Copyright (C) 2007-2021 OpenWrt.org 4 | # 5 | 6 | include $(TOPDIR)/rules.mk 7 | 8 | PKG_NAME:=babeld 9 | PKG_VERSION:=1.13.1 10 | PKG_RELEASE:=2 11 | 12 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 13 | PKG_SOURCE_URL:=https://www.irif.fr/~jch/software/files/ 14 | PKG_HASH:=15f24d26da0ccfc073abcdef0309f281e4684f2aa71126f826572c4c845e8dd9 15 | 16 | PKG_MAINTAINER:=Gabriel Kerneis , \ 17 | Baptiste Jonglez , \ 18 | Nick Hainke 19 | PKG_LICENSE:=MIT 20 | PKG_LICENSE_FILES:=LICENCE 21 | 22 | include $(INCLUDE_DIR)/package.mk 23 | 24 | define Package/babeld 25 | SECTION:=net 26 | CATEGORY:=Network 27 | SUBMENU:=Routing and Redirection 28 | TITLE:=A loop-avoiding distance-vector routing protocol 29 | URL:=https://www.irif.fr/~jch/software/babel/ 30 | DEPENDS:=@IPV6 +libubus +libubox 31 | endef 32 | 33 | define Package/babeld/description 34 | Babel is a loop-avoiding distance-vector routing protocol for IPv6 and IPv4 35 | with fast convergence properties. It is based on the ideas in DSDV, AODV and 36 | Cisco's EIGRP, but is designed to work well not only in wired networks but 37 | also in wireless mesh networks, and has been extended with support for 38 | overlay networks. Babel is an IETF standard protocol (RFC 8966). 39 | endef 40 | 41 | define Package/babeld/conffiles 42 | /etc/babeld.conf 43 | /etc/config/babeld 44 | endef 45 | 46 | MAKE_FLAGS+= \ 47 | CFLAGS="$(TARGET_CFLAGS)" \ 48 | LDLIBS="" \ 49 | LDLIBS+="-lubus -lubox" 50 | 51 | define Package/babeld/install 52 | $(INSTALL_DIR) $(1)/usr/sbin 53 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/babeld $(1)/usr/sbin/ 54 | $(INSTALL_DIR) $(1)/etc 55 | $(INSTALL_CONF) ./files/babeld.conf $(1)/etc/ 56 | $(INSTALL_DIR) $(1)/etc/config 57 | $(INSTALL_CONF) ./files/babeld.config $(1)/etc/config/babeld 58 | $(INSTALL_DIR) $(1)/etc/init.d 59 | $(INSTALL_BIN) ./files/babeld.init $(1)/etc/init.d/babeld 60 | endef 61 | 62 | $(eval $(call BuildPackage,babeld)) 63 | -------------------------------------------------------------------------------- /babeld/files/babeld.conf: -------------------------------------------------------------------------------- 1 | # babel config file 2 | # 3 | # This config file simply documents sample entries. 4 | # "redistribute" means: redistribute routes from other routing protocols 5 | # into babel. "local" means addresses assigned to local interfaces. 6 | # 7 | # You do not need to edit this file: you can use /etc/config/babeld 8 | # instead (sections "interface" and "filter"). Both files can be used 9 | # simultaneously (the rules of this file are executed first). 10 | 11 | # the default rules are: 12 | # 13 | ## redistribute local 14 | ## redistribute deny 15 | # 16 | # this says, redistribute local addresses but no other routes 17 | 18 | 19 | # redistribute IPv4 default route into babel 20 | ## redistribute local ip 0.0.0.0/0 le 0 metric 128 21 | 22 | # same but for IPv6 23 | ## redistribute local ip ::/0 le 0 metric 128 24 | 25 | 26 | # don't redistribute all local addresses, only selected ones 27 | # after the first line, the "deny" rules kicks in. After the "deny" 28 | # no redistribute local rules are going to match 29 | ## redistribute local ip 192.160.4.0/24 30 | ## redistribute local deny 31 | 32 | 33 | # Babel refuses to redistribute routes with a protocol number of "boot"; 34 | # this is standard practice, and means that you cannot easily 35 | # redistribute the default route installed by dhcp. It is however 36 | # possible to redistribute such route by explicitly specifying "proto 3" 37 | # on the redistribute line. 38 | ## redistribute ip 0.0.0.0/0 le 0 proto 3 metric 128 39 | -------------------------------------------------------------------------------- /babeld/src/ubus.h: -------------------------------------------------------------------------------- 1 | /* 2 | IPC integration of babeld with OpenWrt. 3 | 4 | The ubus interface offers following functions: 5 | - add_filter '{"ifname":"eth0", "type":0, "metric":5000}' 6 | type: 7 | 0: FILTER_TYPE_INPUT 8 | 1: FILTER_TYPE_OUTPUT 9 | 2: FILTER_TYPE_REDISTRIBUTE 10 | 3: FILTER_TYPE_INSTALL 11 | - add_interface '{"ifname":"eth0"}' 12 | - get_info 13 | - get_neighbours 14 | - get_xroutes 15 | - get_routes 16 | 17 | All output is divided into IPv4 and IPv6. 18 | 19 | Ubus notifications are sent if we receive updates for 20 | - xroutes 21 | - routes 22 | - neighbours 23 | 24 | The format is: 25 | - {route,xroute,neighbour}.add: Object was added 26 | - {route,xroute,neighbour}.change: Object was changed 27 | - {route,xroute,neighbour}.flush: Object was flushed 28 | 29 | */ 30 | 31 | #include 32 | #include 33 | 34 | struct babel_route; 35 | struct neighbour; 36 | struct xroute; 37 | 38 | // Whether to enable ubus bindings (boolean option). 39 | extern int ubus_bindings; 40 | 41 | /** 42 | * Initialize ubus interface. 43 | * 44 | * Connect to the ubus daemon and expose the ubus functions. 45 | * 46 | * @return if initializing ubus was successful 47 | */ 48 | bool babeld_add_ubus(); 49 | 50 | /** 51 | * Add ubus socket to given filedescriptor set. 52 | * 53 | * We need to check repeatedly if the ubus socket has something to read. 54 | * The functions allows to add the ubus socket to the normal while(1)-loop of 55 | * babeld. 56 | * 57 | * @param readfs: the filedescriptor set 58 | * @param maxfd: the current maximum file descriptor 59 | * @return the maximum file descriptor 60 | */ 61 | int babeld_ubus_add_read_sock(fd_set *readfds, int maxfd); 62 | 63 | /** 64 | * Check and process ubus socket. 65 | * 66 | * If the ubus-socket signals that data is available, the ubus_handle_event is 67 | * called. 68 | */ 69 | void babeld_ubus_receive(fd_set *readfds); 70 | 71 | /*** 72 | * Notify the ubus bus that a new xroute is received. 73 | * 74 | * If a new xroute is received or changed, we will notify subscribers. 75 | * 76 | * @param xroute: xroute that experienced some change 77 | * @param kind: kind that describes if we have a flush, add or change 78 | */ 79 | void ubus_notify_xroute(struct xroute *xroute, int kind); 80 | 81 | /*** 82 | * Notify the ubus bus that a new route is received. 83 | * 84 | * If a new route is received or changed, we will notify subscribers. 85 | * 86 | * @param route: route that experienced some change 87 | * @param kind: kind that describes if we have a flush, add or change 88 | */ 89 | void ubus_notify_route(struct babel_route *route, int kind); 90 | 91 | /*** 92 | * Notify the ubus bus that a new neighbour is received. 93 | * 94 | * If a new neighbour is received or changed, we will notify subscribers. 95 | * 96 | * @param neigh: neighbour that experienced some change 97 | * @param kind: kind that describes if we have a flush, add or change 98 | */ 99 | void ubus_notify_neighbour(struct neighbour *neigh, int kind); 100 | -------------------------------------------------------------------------------- /batman-adv/Config.in: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 2 | # Copyright (C) 2007-2019 B.A.T.M.A.N. contributors: 3 | # 4 | # Marek Lindner, Simon Wunderlich 5 | 6 | # 7 | # B.A.T.M.A.N meshing protocol 8 | # 9 | 10 | config BATMAN_ADV_BATMAN_V 11 | bool "B.A.T.M.A.N. V protocol" 12 | depends on PACKAGE_kmod-batman-adv 13 | default y 14 | help 15 | This option enables the B.A.T.M.A.N. V protocol, the successor 16 | of the currently used B.A.T.M.A.N. IV protocol. The main 17 | changes include splitting of the OGM protocol into a neighbor 18 | discovery protocol (Echo Location Protocol, ELP) and a new OGM 19 | Protocol OGMv2 for flooding protocol information through the 20 | network, as well as a throughput based metric. 21 | B.A.T.M.A.N. V is currently considered experimental and not 22 | compatible to B.A.T.M.A.N. IV networks. 23 | 24 | config BATMAN_ADV_BLA 25 | bool "Bridge Loop Avoidance" 26 | depends on PACKAGE_kmod-batman-adv 27 | select PACKAGE_kmod-lib-crc16 28 | default y 29 | help 30 | This option enables BLA (Bridge Loop Avoidance), a mechanism 31 | to avoid Ethernet frames looping when mesh nodes are connected 32 | to both the same LAN and the same mesh. If you will never use 33 | more than one mesh node in the same LAN, you can safely remove 34 | this feature and save some space. 35 | 36 | config BATMAN_ADV_DAT 37 | bool "Distributed ARP Table" 38 | depends on PACKAGE_kmod-batman-adv 39 | default y 40 | help 41 | This option enables DAT (Distributed ARP Table), a DHT based 42 | mechanism that increases ARP reliability on sparse wireless 43 | mesh networks. If you think that your network does not need 44 | this option you can safely remove it and save some space. 45 | 46 | config BATMAN_ADV_NC 47 | bool "Network Coding" 48 | depends on PACKAGE_kmod-batman-adv 49 | help 50 | This option enables network coding, a mechanism that aims to 51 | increase the overall network throughput by fusing multiple 52 | packets in one transmission. 53 | Note that interfaces controlled by batman-adv must be manually 54 | configured to have promiscuous mode enabled in order to make 55 | network coding work. 56 | If you think that your network does not need this feature you 57 | can safely disable it and save some space. 58 | 59 | config BATMAN_ADV_MCAST 60 | bool "Multicast optimisation" 61 | depends on PACKAGE_kmod-batman-adv 62 | default y 63 | help 64 | This option enables the multicast optimisation which aims to 65 | reduce the air overhead while improving the reliability of 66 | multicast messages. 67 | 68 | config BATMAN_ADV_DEBUG 69 | bool "B.A.T.M.A.N. debugging" 70 | depends on PACKAGE_kmod-batman-adv 71 | help 72 | This is an option for use by developers; most people should 73 | say N here. This enables compilation of support for 74 | outputting debugging information to the debugfs log or tracing 75 | buffer. The output is controlled via the batadv netdev specific 76 | log_level setting. 77 | 78 | config BATMAN_ADV_TRACING 79 | bool "B.A.T.M.A.N. tracing support" 80 | depends on PACKAGE_kmod-batman-adv 81 | select KERNEL_FTRACE 82 | select KERNEL_ENABLE_DEFAULT_TRACERS 83 | help 84 | This is an option for use by developers; most people should 85 | say N here. Select this option to gather traces like the debug 86 | messages using the generic tracing infrastructure of the kernel. 87 | BATMAN_ADV_DEBUG must also be selected to get trace events for 88 | batadv_dbg. 89 | -------------------------------------------------------------------------------- /batman-adv/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-only 2 | 3 | include $(TOPDIR)/rules.mk 4 | 5 | PKG_NAME:=batman-adv 6 | PKG_VERSION:=2025.1 7 | PKG_RELEASE:=1 8 | 9 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 10 | PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) 11 | PKG_HASH:=03ad429297961fb3acd9c2c806432d037b0ed7aac0f0a1e645e32af5210b98e1 12 | PKG_EXTMOD_SUBDIRS:=net/batman-adv 13 | 14 | PKG_MAINTAINER:=Simon Wunderlich 15 | PKG_LICENSE:=GPL-2.0-only MIT 16 | PKG_LICENSE_FILES:=LICENSES/preferred/GPL-2.0 LICENSES/preferred/MIT 17 | 18 | PKG_BUILD_PARALLEL:=1 19 | 20 | STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h 21 | 22 | PKG_CONFIG_DEPENDS += \ 23 | CONFIG_BATMAN_ADV_BATMAN_V \ 24 | CONFIG_BATMAN_ADV_BLA \ 25 | CONFIG_BATMAN_ADV_DAT \ 26 | CONFIG_BATMAN_ADV_NC \ 27 | CONFIG_BATMAN_ADV_MCAST \ 28 | CONFIG_BATMAN_ADV_DEBUG \ 29 | CONFIG_BATMAN_ADV_TRACING 30 | 31 | include $(INCLUDE_DIR)/kernel.mk 32 | include $(INCLUDE_DIR)/package.mk 33 | 34 | define KernelPackage/batman-adv 35 | SUBMENU:=Network Support 36 | TITLE:=B.A.T.M.A.N. Adv 37 | URL:=https://www.open-mesh.org/ 38 | DEPENDS:=+BATMAN_ADV_BLA:kmod-lib-crc16 +kmod-lib-crc32c +kmod-cfg80211 +batctl 39 | FILES:=$(PKG_BUILD_DIR)/net/batman-adv/batman-adv.$(LINUX_KMOD_SUFFIX) 40 | AUTOLOAD:=$(call AutoProbe,batman-adv) 41 | endef 42 | 43 | define KernelPackage/batman-adv/description 44 | B.A.T.M.A.N. (better approach to mobile ad-hoc networking) is 45 | a routing protocol for multi-hop ad-hoc mesh networks. The 46 | networks may be wired or wireless. See 47 | https://www.open-mesh.org/ for more information and user space 48 | tools. This package builds version $(PKG_VERSION) of the kernel 49 | module. 50 | endef 51 | 52 | define KernelPackage/batman-adv/config 53 | source "$(SOURCE)/Config.in" 54 | endef 55 | 56 | define Package/kmod-batman-adv/conffiles 57 | /etc/config/batman-adv 58 | endef 59 | 60 | PKG_EXTRA_KCONFIG:= \ 61 | CONFIG_BATMAN_ADV=m \ 62 | CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_BATMAN_ADV_DEBUG),y,n) \ 63 | CONFIG_BATMAN_ADV_BLA=$(if $(CONFIG_BATMAN_ADV_BLA),y,n) \ 64 | CONFIG_BATMAN_ADV_DAT=$(if $(CONFIG_BATMAN_ADV_DAT),y,n) \ 65 | CONFIG_BATMAN_ADV_MCAST=$(if $(CONFIG_BATMAN_ADV_MCAST),y,n) \ 66 | CONFIG_BATMAN_ADV_NC=$(if $(CONFIG_BATMAN_ADV_NC),y,n) \ 67 | CONFIG_BATMAN_ADV_BATMAN_V=$(if $(CONFIG_BATMAN_ADV_BATMAN_V),y,n) \ 68 | CONFIG_BATMAN_ADV_TRACING=$(if $(CONFIG_BATMAN_ADV_TRACING),y,n) \ 69 | 70 | PKG_EXTRA_CFLAGS:= \ 71 | $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(PKG_EXTRA_KCONFIG)))) \ 72 | $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(PKG_EXTRA_KCONFIG)))) \ 73 | 74 | NOSTDINC_FLAGS = \ 75 | $(KERNEL_NOSTDINC_FLAGS) \ 76 | -I$(PKG_BUILD_DIR)/net/batman-adv \ 77 | -I$(STAGING_DIR)/usr/include/mac80211-backport \ 78 | -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \ 79 | -I$(STAGING_DIR)/usr/include/mac80211 \ 80 | -I$(STAGING_DIR)/usr/include/mac80211/uapi \ 81 | -I$(PKG_BUILD_DIR)/include/ \ 82 | -include backport/autoconf.h \ 83 | -include backport/backport.h \ 84 | -include $(PKG_BUILD_DIR)/compat-hacks.h \ 85 | -DBATADV_SOURCE_VERSION=\\\"$(PKG_VERSION)-openwrt-$(PKG_RELEASE)\\\" 86 | 87 | define Build/Compile 88 | $(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \ 89 | $(KERNEL_MAKE_FLAGS) \ 90 | M="$(PKG_BUILD_DIR)/net/batman-adv" \ 91 | $(PKG_EXTRA_KCONFIG) \ 92 | EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS)" \ 93 | NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \ 94 | modules 95 | endef 96 | 97 | define KernelPackage/batman-adv/install 98 | $(CP) ./files/. $(1)/ 99 | endef 100 | 101 | $(eval $(call KernelPackage,batman-adv)) 102 | -------------------------------------------------------------------------------- /batman-adv/files/lib/netifd/proto/batadv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ -n "$INCLUDE_ONLY" ] || { 4 | . /lib/functions.sh 5 | . ../netifd-proto.sh 6 | init_proto "$@" 7 | } 8 | 9 | proto_batadv_init_config() { 10 | no_device=1 11 | available=1 12 | 13 | proto_config_add_boolean 'aggregated_ogms:bool' 14 | proto_config_add_boolean 'ap_isolation:bool' 15 | proto_config_add_boolean 'bonding:bool' 16 | proto_config_add_boolean 'bridge_loop_avoidance:bool' 17 | proto_config_add_boolean 'distributed_arp_table:bool' 18 | proto_config_add_boolean 'fragmentation:bool' 19 | proto_config_add_string 'gw_bandwidth' 20 | proto_config_add_string 'gw_mode' 21 | proto_config_add_int 'gw_sel_class' 22 | proto_config_add_int 'hop_penalty' 23 | proto_config_add_string 'isolation_mark' 24 | proto_config_add_string 'log_level' 25 | proto_config_add_int 'multicast_fanout' 26 | proto_config_add_boolean 'multicast_mode:bool' 27 | proto_config_add_boolean 'network_coding:bool' 28 | proto_config_add_int 'orig_interval' 29 | proto_config_add_string 'routing_algo' 30 | } 31 | 32 | proto_batadv_setup() { 33 | local config="$1" 34 | local iface="$config" 35 | 36 | local aggregated_ogms 37 | local ap_isolation 38 | local bonding 39 | local bridge_loop_avoidance 40 | local distributed_arp_table 41 | local fragmentation 42 | local gw_bandwidth 43 | local gw_mode 44 | local gw_sel_class 45 | local hop_penalty 46 | local isolation_mark 47 | local log_level 48 | local multicast_fanout 49 | local multicast_mode 50 | local network_coding 51 | local orig_interval 52 | local routing_algo 53 | 54 | json_get_vars aggregated_ogms 55 | json_get_vars ap_isolation 56 | json_get_vars bonding 57 | json_get_vars bridge_loop_avoidance 58 | json_get_vars distributed_arp_table 59 | json_get_vars fragmentation 60 | json_get_vars gw_bandwidth 61 | json_get_vars gw_mode 62 | json_get_vars gw_sel_class 63 | json_get_vars hop_penalty 64 | json_get_vars isolation_mark 65 | json_get_vars log_level 66 | json_get_vars multicast_fanout 67 | json_get_vars multicast_mode 68 | json_get_vars network_coding 69 | json_get_vars orig_interval 70 | json_get_vars routing_algo 71 | 72 | set_default routing_algo 'BATMAN_IV' 73 | 74 | batctl routing_algo "$routing_algo" 75 | batctl meshif "$iface" interface create 76 | 77 | [ -n "$aggregated_ogms" ] && batctl meshif "$iface" aggregation "$aggregated_ogms" 78 | [ -n "$ap_isolation" ] && batctl meshif "$iface" ap_isolation "$ap_isolation" 79 | [ -n "$bonding" ] && batctl meshif "$iface" bonding "$bonding" 80 | [ -n "$bridge_loop_avoidance" ] && batctl meshif "$iface" bridge_loop_avoidance "$bridge_loop_avoidance" 2>&- 81 | [ -n "$distributed_arp_table" ] && batctl meshif "$iface" distributed_arp_table "$distributed_arp_table" 2>&- 82 | [ -n "$fragmentation" ] && batctl meshif "$iface" fragmentation "$fragmentation" 83 | 84 | case "$gw_mode" in 85 | server) 86 | if [ -n "$gw_bandwidth" ]; then 87 | batctl meshif "$iface" gw_mode "server" "$gw_bandwidth" 88 | else 89 | batctl meshif "$iface" gw_mode "server" 90 | fi 91 | ;; 92 | client) 93 | if [ -n "$gw_sel_class" ]; then 94 | batctl meshif "$iface" gw_mode "client" "$gw_sel_class" 95 | else 96 | batctl meshif "$iface" gw_mode "client" 97 | fi 98 | ;; 99 | *) 100 | batctl meshif "$iface" gw_mode "off" 101 | ;; 102 | esac 103 | 104 | [ -n "$hop_penalty" ] && batctl meshif "$iface" hop_penalty "$hop_penalty" 105 | [ -n "$isolation_mark" ] && batctl meshif "$iface" isolation_mark "$isolation_mark" 106 | [ -n "$multicast_fanout" ] && batctl meshif "$iface" multicast_fanout "$multicast_fanout" 107 | [ -n "$multicast_mode" ] && batctl meshif "$iface" multicast_mode "$multicast_mode" 2>&- 108 | [ -n "$network_coding" ] && batctl meshif "$iface" network_coding "$network_coding" 2>&- 109 | [ -n "$log_level" ] && batctl meshif "$iface" loglevel "$log_level" 2>&- 110 | [ -n "$orig_interval" ] && batctl meshif "$iface" orig_interval "$orig_interval" 111 | 112 | proto_init_update "$iface" 1 113 | proto_send_update "$config" 114 | } 115 | 116 | proto_batadv_teardown() { 117 | local config="$1" 118 | local iface="$config" 119 | 120 | batctl meshif "$iface" interface destroy 121 | } 122 | 123 | add_protocol batadv 124 | -------------------------------------------------------------------------------- /batman-adv/files/lib/netifd/proto/batadv_hardif.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ -n "$INCLUDE_ONLY" ] || { 4 | . /lib/functions.sh 5 | . ../netifd-proto.sh 6 | init_proto "$@" 7 | } 8 | 9 | proto_batadv_hardif_init_config() { 10 | proto_config_add_int 'elp_interval' 11 | proto_config_add_int 'hop_penalty' 12 | proto_config_add_string "master" 13 | proto_config_add_string 'throughput_override' 14 | } 15 | 16 | proto_batadv_hardif_setup() { 17 | local config="$1" 18 | local iface="$2" 19 | 20 | local elp_interval 21 | local hop_penalty 22 | local master 23 | local throughput_override 24 | 25 | json_get_vars elp_interval 26 | json_get_vars hop_penalty 27 | json_get_vars master 28 | json_get_vars throughput_override 29 | 30 | ( proto_add_host_dependency "$config" '' "$master" ) 31 | 32 | batctl meshif "$master" interface -M add "$iface" 33 | 34 | [ -n "$elp_interval" ] && batctl hardif "$iface" elp_interval "$elp_interval" 35 | [ -n "$hop_penalty" ] && batctl hardif "$iface" hop_penalty "$hop_penalty" 36 | [ -n "$throughput_override" ] && batctl hardif "$iface" throughput_override "$throughput_override" 37 | 38 | proto_init_update "$iface" 1 39 | proto_send_update "$config" 40 | } 41 | 42 | proto_batadv_hardif_teardown() { 43 | local config="$1" 44 | local iface="$2" 45 | 46 | local master 47 | 48 | json_get_vars master 49 | 50 | batctl meshif "$master" interface -M del "$iface" || true 51 | } 52 | 53 | add_protocol batadv_hardif 54 | -------------------------------------------------------------------------------- /batman-adv/files/lib/netifd/proto/batadv_vlan.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . /lib/functions.sh 4 | . ../netifd-proto.sh 5 | init_proto "$@" 6 | 7 | proto_batadv_vlan_init_config() { 8 | proto_config_add_boolean 'ap_isolation:bool' 9 | } 10 | 11 | proto_batadv_vlan_setup() { 12 | local config="$1" 13 | local iface="$2" 14 | 15 | # batadv_vlan options 16 | local ap_isolation 17 | 18 | json_get_vars ap_isolation 19 | 20 | [ -n "$ap_isolation" ] && batctl vlan "$iface" ap_isolation "$ap_isolation" 21 | proto_init_update "$iface" 1 22 | proto_send_update "$config" 23 | } 24 | 25 | proto_batadv_vlan_teardown() { 26 | local cfg="$1" 27 | } 28 | 29 | add_protocol batadv_vlan 30 | -------------------------------------------------------------------------------- /batman-adv/patches/0001-fix-batadv_is_cfg80211_netdev.patch: -------------------------------------------------------------------------------- 1 | From: Alexandru Gagniuc 2 | Date: Thu, 6 Apr 2023 18:05:50 -0500 3 | Subject: fix batadv_is_cfg80211_netdev 4 | 5 | Replace CONFIG_CFG80211 with CPTCFG_CFG80211, which is the correct 6 | macro to use when building under backports. 7 | 8 | --- a/net/batman-adv/hard-interface.c 9 | +++ b/net/batman-adv/hard-interface.c 10 | @@ -308,8 +308,7 @@ static bool batadv_is_cfg80211_netdev(st 11 | { 12 | if (!net_device) 13 | return false; 14 | - 15 | -#if IS_ENABLED(CONFIG_CFG80211) 16 | +#if IS_ENABLED(CPTCFG_CFG80211) 17 | /* cfg80211 drivers have to set ieee80211_ptr */ 18 | if (net_device->ieee80211_ptr) 19 | return true; 20 | -------------------------------------------------------------------------------- /batman-adv/patches/0002-Revert-batman-adv-Switch-to-linux-array_size.h.patch: -------------------------------------------------------------------------------- 1 | From: Sven Eckelmann 2 | Date: Fri, 2 Feb 2024 22:49:48 +0100 3 | Subject: Revert "batman-adv: Switch to linux/array_size.h" 4 | 5 | The original patch requires Linux 6.7.0 or a mac80211 compat header with this 6 | name. But the mac80211 package is currently not providing this header and 7 | OpenWrt main is still using older Linux kernel versions for some targets. 8 | 9 | This reverts commit f33d7f724675544a36b24c77f8d4b95d41252ae2. 10 | 11 | --- a/compat-include/linux/array_size.h 12 | +++ /dev/null 13 | @@ -1,20 +0,0 @@ 14 | -/* SPDX-License-Identifier: GPL-2.0 */ 15 | -/* Copyright (C) B.A.T.M.A.N. contributors: 16 | - * 17 | - * Marek Lindner, Simon Wunderlich 18 | - * 19 | - * This file contains macros for maintaining compatibility with older versions 20 | - * of the Linux kernel. 21 | - */ 22 | - 23 | -#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_ARRAY_SIZE_H_ 24 | -#define _NET_BATMAN_ADV_COMPAT_LINUX_ARRAY_SIZE_H_ 25 | - 26 | -#include 27 | -#if LINUX_VERSION_IS_GEQ(6, 7, 0) 28 | -#include_next 29 | -#else 30 | -#include 31 | -#endif 32 | - 33 | -#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_ARRAY_SIZE_H_ */ 34 | --- a/net/batman-adv/main.c 35 | +++ b/net/batman-adv/main.c 36 | @@ -6,7 +6,6 @@ 37 | 38 | #include "main.h" 39 | 40 | -#include 41 | #include 42 | #include 43 | #include 44 | @@ -20,6 +19,7 @@ 45 | #include 46 | #include 47 | #include 48 | +#include 49 | #include 50 | #include 51 | #include 52 | --- a/net/batman-adv/netlink.c 53 | +++ b/net/batman-adv/netlink.c 54 | @@ -7,7 +7,6 @@ 55 | #include "netlink.h" 56 | #include "main.h" 57 | 58 | -#include 59 | #include 60 | #include 61 | #include 62 | @@ -19,6 +18,7 @@ 63 | #include 64 | #include 65 | #include 66 | +#include 67 | #include 68 | #include 69 | #include 70 | -------------------------------------------------------------------------------- /batman-adv/patches/0003-Revert-batman-adv-move-asm-unaligned.h-to-linux-unal.patch: -------------------------------------------------------------------------------- 1 | From: Sven Eckelmann 2 | Date: Tue, 10 Dec 2024 22:31:33 +0100 3 | Subject: Revert "batman-adv: move asm/unaligned.h to linux/unaligned.h" 4 | 5 | This header is only available with Linux 6.12 6 | 7 | This reverts commit ee60832ebec47a023d634b06f9434103ec090aed. 8 | 9 | --- a/compat-include/linux/unaligned.h 10 | +++ /dev/null 11 | @@ -1,20 +0,0 @@ 12 | -/* SPDX-License-Identifier: GPL-2.0 */ 13 | -/* Copyright (C) B.A.T.M.A.N. contributors: 14 | - * 15 | - * Marek Lindner, Simon Wunderlich 16 | - * 17 | - * This file contains macros for maintaining compatibility with older versions 18 | - * of the Linux kernel. 19 | - */ 20 | - 21 | -#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_UNALIGNED_H_ 22 | -#define _NET_BATMAN_ADV_COMPAT_LINUX_UNALIGNED_H_ 23 | - 24 | -#include 25 | -#if LINUX_VERSION_IS_GEQ(6, 12, 0) 26 | -#include_next 27 | -#else 28 | -#include 29 | -#endif 30 | - 31 | -#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_UNALIGNED_H_ */ 32 | --- a/net/batman-adv/distributed-arp-table.c 33 | +++ b/net/batman-adv/distributed-arp-table.c 34 | @@ -7,6 +7,7 @@ 35 | #include "distributed-arp-table.h" 36 | #include "main.h" 37 | 38 | +#include 39 | #include 40 | #include 41 | #include 42 | @@ -32,7 +33,6 @@ 43 | #include 44 | #include 45 | #include 46 | -#include 47 | #include 48 | #include 49 | #include 50 | -------------------------------------------------------------------------------- /batman-adv/src/compat-hacks.h: -------------------------------------------------------------------------------- 1 | /* Please avoid adding hacks here - instead add it to mac80211/backports.git */ 2 | 3 | #undef CONFIG_MODULE_STRIPPED 4 | 5 | #include /* LINUX_VERSION_CODE */ 6 | #include 7 | 8 | #if LINUX_VERSION_IS_LESS(6, 10, 0) 9 | 10 | #define __counted_by_be(member) 11 | 12 | #endif /* LINUX_VERSION_IS_LESS(6, 10, 0) */ 13 | 14 | /* */ 15 | 16 | #include 17 | #include_next 18 | 19 | #include 20 | 21 | #ifdef DECLARE_EWMA 22 | #undef DECLARE_EWMA 23 | #endif /* DECLARE_EWMA */ 24 | 25 | /* 26 | * Exponentially weighted moving average (EWMA) 27 | * 28 | * This implements a fixed-precision EWMA algorithm, with both the 29 | * precision and fall-off coefficient determined at compile-time 30 | * and built into the generated helper funtions. 31 | * 32 | * The first argument to the macro is the name that will be used 33 | * for the struct and helper functions. 34 | * 35 | * The second argument, the precision, expresses how many bits are 36 | * used for the fractional part of the fixed-precision values. 37 | * 38 | * The third argument, the weight reciprocal, determines how the 39 | * new values will be weighed vs. the old state, new values will 40 | * get weight 1/weight_rcp and old values 1-1/weight_rcp. Note 41 | * that this parameter must be a power of two for efficiency. 42 | */ 43 | 44 | #define DECLARE_EWMA(name, _precision, _weight_rcp) \ 45 | struct ewma_##name { \ 46 | unsigned long internal; \ 47 | }; \ 48 | static inline void ewma_##name##_init(struct ewma_##name *e) \ 49 | { \ 50 | BUILD_BUG_ON(!__builtin_constant_p(_precision)); \ 51 | BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \ 52 | /* \ 53 | * Even if you want to feed it just 0/1 you should have \ 54 | * some bits for the non-fractional part... \ 55 | */ \ 56 | BUILD_BUG_ON((_precision) > 30); \ 57 | BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \ 58 | e->internal = 0; \ 59 | } \ 60 | static inline unsigned long \ 61 | ewma_##name##_read(struct ewma_##name *e) \ 62 | { \ 63 | BUILD_BUG_ON(!__builtin_constant_p(_precision)); \ 64 | BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \ 65 | BUILD_BUG_ON((_precision) > 30); \ 66 | BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \ 67 | return e->internal >> (_precision); \ 68 | } \ 69 | static inline void ewma_##name##_add(struct ewma_##name *e, \ 70 | unsigned long val) \ 71 | { \ 72 | unsigned long internal = READ_ONCE(e->internal); \ 73 | unsigned long weight_rcp = ilog2(_weight_rcp); \ 74 | unsigned long precision = _precision; \ 75 | \ 76 | BUILD_BUG_ON(!__builtin_constant_p(_precision)); \ 77 | BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \ 78 | BUILD_BUG_ON((_precision) > 30); \ 79 | BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \ 80 | \ 81 | WRITE_ONCE(e->internal, internal ? \ 82 | (((internal << weight_rcp) - internal) + \ 83 | (val << precision)) >> weight_rcp : \ 84 | (val << precision)); \ 85 | } 86 | 87 | /* */ 88 | -------------------------------------------------------------------------------- /batmand/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008-2011 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=batmand 11 | 12 | PKG_SOURCE_PROTO:=git 13 | PKG_SOURCE_URL:=https://git.open-mesh.org/batmand.git 14 | PKG_REV:=b67a7087b51d7a5e90d27ac39116d1f57257c86e 15 | PKG_VERSION:=1440 16 | PKG_RELEASE:=2 17 | PKG_LICENSE:=GPL-2.0 18 | 19 | PKG_SOURCE_VERSION:=$(PKG_REV) 20 | PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) 21 | PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz 22 | PKG_MIRROR_HASH:=ceb8e0e399f79b1b663594fcf9642e1efc40e696a7604daf709c77da9b6ec52f 23 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) 24 | 25 | PKG_BUILD_PARALLEL:=1 26 | 27 | include $(INCLUDE_DIR)/package.mk 28 | 29 | define Package/batmand 30 | URL:=https://www.open-mesh.org/ 31 | MAINTAINER:=Corinna "Elektra" Aichele 32 | SECTION:=net 33 | CATEGORY:=Network 34 | SUBMENU:=Routing and Redirection 35 | DEPENDS:=+libpthread +kmod-tun 36 | TITLE:=B.A.T.M.A.N. layer 3 routing daemon 37 | endef 38 | 39 | define Package/batmand/description 40 | B.A.T.M.A.N. layer 3 routing daemon 41 | endef 42 | 43 | MAKE_FLAGS += \ 44 | EXTRA_CFLAGS='-DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA -DREVISION_VERSION=\"\ rv$(PKG_REV)\" -D_GNU_SOURCE' \ 45 | REVISION="$(PKG_REV)" \ 46 | CC="$(TARGET_CC)" \ 47 | UNAME="Linux" \ 48 | batmand 49 | 50 | define Package/batmand/install 51 | $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d 52 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/batmand $(1)/usr/sbin/ 53 | $(INSTALL_BIN) ./files/etc/init.d/batmand $(1)/etc/init.d 54 | $(INSTALL_DATA) ./files/etc/config/batmand $(1)/etc/config 55 | endef 56 | 57 | define Package/batmand/conffiles 58 | /etc/config/batmand 59 | endef 60 | 61 | $(eval $(call BuildPackage,batmand)) 62 | -------------------------------------------------------------------------------- /batmand/files/etc/config/batmand: -------------------------------------------------------------------------------- 1 | config batmand general 2 | option interface ath0 3 | option hna 4 | option gateway_class 5 | option originator_interval 6 | option preferred_gateway 7 | option routing_class 8 | option visualisation_srv 9 | option policy_routing_script 10 | option disable_client_nat 11 | option disable_aggregation 12 | -------------------------------------------------------------------------------- /batmand/files/etc/init.d/batmand: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | START=90 3 | USE_PROCD=1 4 | 5 | batmand_start() { 6 | local config="$1" 7 | local batman_args 8 | local interface 9 | local hnas 10 | local gateway_class 11 | local originator_interval 12 | local preferred_gateway 13 | local routing_class 14 | local visualisation_srv 15 | local local policy_routing_script 16 | local disable_client_nat 17 | local disable_aggregation 18 | 19 | [ "$config" = "general" ] || return 1 20 | 21 | config_get interface "$config" interface 22 | if [ "$interface" = "" ]; then 23 | echo $1 Error, you must specify at least a network interface 24 | return 1 25 | fi 26 | 27 | config_get hnas "$config" hna 28 | config_get gateway_class "$config" gateway_class 29 | config_get originator_interval "$config" originator_interval 30 | config_get preferred_gateway "$config" preferred_gateway 31 | config_get routing_class "$config" routing_class 32 | config_get visualisation_srv "$config" visualisation_srv 33 | config_get policy_routing_script "$config" policy_routing_script 34 | config_get disable_client_nat "$config" disable_client_nat 35 | config_get disable_aggregation "$config" disable_aggregation 36 | 37 | batman_args="" 38 | 39 | for hna in $hnas; do 40 | batman_args=${batman_args}'-a '$hna' ' 41 | done 42 | 43 | if [ $gateway_class ]; then 44 | batman_args=${batman_args}'-g '$gateway_class' ' 45 | fi 46 | 47 | if [ $originator_interval ]; then 48 | batman_args=${batman_args}'-o '$originator_interval' ' 49 | fi 50 | 51 | if [ $preferred_gateway ]; then 52 | batman_args=${batman_args}'-p '$preferred_gateway' ' 53 | fi 54 | 55 | if [ $routing_class ]; then 56 | batman_args=${batman_args}'-r '$routing_class' ' 57 | fi 58 | 59 | if [ $visualisation_srv ]; then 60 | batman_args=${batman_args}'-s '$visualisation_srv' ' 61 | fi 62 | 63 | if [ $policy_routing_script ]; then 64 | batman_args=${batman_args}'--policy-routing-script '$policy_routing_script' ' 65 | fi 66 | 67 | if [ $disable_client_nat ]; then 68 | batman_args=${batman_args}'--disable-client-nat ' 69 | fi 70 | 71 | if [ $disable_aggregation ]; then 72 | batman_args=${batman_args}'--disable-aggregation ' 73 | fi 74 | 75 | procd_open_instance "${config}" 76 | procd_set_param command /usr/sbin/batmand 77 | procd_append_param command --no-detach 78 | procd_append_param command ${batman_args} 79 | procd_append_param command ${interface} 80 | procd_set_param netdev ${interface} 81 | procd_close_instance 82 | } 83 | 84 | start_service() { 85 | config_load "batmand" 86 | config_foreach batmand_start batmand 87 | } 88 | 89 | service_triggers() { 90 | procd_add_reload_trigger "batmand" 91 | } 92 | -------------------------------------------------------------------------------- /batmand/patches/0001-Allow-one-to-disable-forking-to-background-in-debug_.patch: -------------------------------------------------------------------------------- 1 | From: Sven Eckelmann <> 2 | Date: Sun, 1 Dec 2013 14:39:00 +0100 3 | Subject: Allow one to disable forking to background in debug_mode 0 4 | 5 | --- 6 | posix/init.c | 19 ++++++++++++++----- 7 | 1 file changed, 14 insertions(+), 5 deletions(-) 8 | 9 | --- a/posix/init.c 10 | +++ b/posix/init.c 11 | @@ -44,6 +44,7 @@ 12 | #define IOCSETDEV 1 13 | 14 | int8_t stop; 15 | +int no_detach = 0; 16 | 17 | 18 | 19 | @@ -159,6 +160,7 @@ void apply_init_args( int argc, char *ar 20 | {"purge-timeout", required_argument, 0, 'q'}, 21 | {"disable-aggregation", no_argument, 0, 'x'}, 22 | {"disable-client-nat", no_argument, 0, 'z'}, 23 | + {"no-detach", no_argument, 0, 'D'}, 24 | {0, 0, 0, 0} 25 | }; 26 | 27 | @@ -169,7 +171,7 @@ void apply_init_args( int argc, char *ar 28 | if ( strstr( SOURCE_VERSION, "-" ) != NULL ) 29 | printf( "WARNING: You are using the unstable batman branch. If you are interested in *using* batman get the latest stable release !\n" ); 30 | 31 | - while ( ( optchar = getopt_long( argc, argv, "a:A:bcd:hHio:g:p:r:s:vV", long_options, &option_index ) ) != -1 ) { 32 | + while ( ( optchar = getopt_long( argc, argv, "a:A:bcd:hHio:g:p:r:s:vVD", long_options, &option_index ) ) != -1 ) { 33 | 34 | switch ( optchar ) { 35 | 36 | @@ -381,6 +383,11 @@ void apply_init_args( int argc, char *ar 37 | found_args++; 38 | break; 39 | 40 | + case 'D': 41 | + no_detach = 1; 42 | + found_args++; 43 | + break; 44 | + 45 | case 'h': 46 | default: 47 | usage(); 48 | @@ -539,12 +546,14 @@ void apply_init_args( int argc, char *ar 49 | /* daemonize */ 50 | if (debug_level == 0) { 51 | 52 | - if (my_daemon() < 0) { 53 | + if (!no_detach) { 54 | + if (my_daemon() < 0) { 55 | 56 | - printf("Error - can't fork to background: %s\n", strerror(errno)); 57 | - restore_defaults(); 58 | - exit(EXIT_FAILURE); 59 | + printf("Error - can't fork to background: %s\n", strerror(errno)); 60 | + restore_defaults(); 61 | + exit(EXIT_FAILURE); 62 | 63 | + } 64 | } 65 | 66 | openlog("batmand", LOG_PID, LOG_DAEMON); 67 | -------------------------------------------------------------------------------- /batmand/patches/0002-batmand-Add-missing-string.h-include.patch: -------------------------------------------------------------------------------- 1 | From: Sven Eckelmann 2 | Date: Fri, 23 May 2025 11:15:53 +0200 3 | Subject: batmand: Add missing string.h include 4 | 5 | The build failed because various string functions couldn't be found. This 6 | happened because the indirect include of string.h is now gone in musl 7 | 1.2.5. 8 | 9 | Signed-off-by: Sven Eckelmann 10 | 11 | --- a/hna.c 12 | +++ b/hna.c 13 | @@ -27,6 +27,7 @@ 14 | 15 | #include 16 | #include 17 | +#include 18 | #include 19 | 20 | 21 | --- a/linux/kernel.c 22 | +++ b/linux/kernel.c 23 | @@ -29,6 +29,7 @@ 24 | #include 25 | #include 26 | #include 27 | +#include 28 | 29 | #include "../os.h" 30 | #include "../batman.h" 31 | --- a/linux/route.c 32 | +++ b/linux/route.c 33 | @@ -29,6 +29,7 @@ 34 | #include /* ifr_if, ifr_tun */ 35 | #include 36 | #include 37 | +#include 38 | #include 39 | 40 | #include "../os.h" 41 | --- a/linux/tun.c 42 | +++ b/linux/tun.c 43 | @@ -32,6 +32,7 @@ 44 | #include 45 | #include 46 | #include /* system() */ 47 | +#include 48 | #include /* WEXITSTATUS */ 49 | 50 | #include "../os.h" 51 | -------------------------------------------------------------------------------- /bird2/files/bird.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2010-2017 OpenWrt.org 3 | 4 | USE_PROCD=1 5 | START=70 6 | STOP=10 7 | 8 | BIRD_BIN="/usr/sbin/bird" 9 | BIRD_CONF="/etc/bird.conf" 10 | BIRD_PID_FILE="/var/run/bird.pid" 11 | 12 | start_service() { 13 | mkdir -p /var/run 14 | procd_open_instance 15 | procd_set_param command $BIRD_BIN -f -c $BIRD_CONF -P $BIRD_PID_FILE 16 | procd_set_param file "$BIRD_CONF" 17 | procd_set_param stdout 1 18 | procd_set_param stderr 1 19 | procd_set_param respawn 20 | procd_close_instance 21 | } 22 | 23 | reload_service() { 24 | procd_send_signal bird 25 | } 26 | -------------------------------------------------------------------------------- /bird2/patches/000-ospf-bus-error.patch: -------------------------------------------------------------------------------- 1 | --- a/proto/ospf/topology.h 2 | +++ b/proto/ospf/topology.h 3 | @@ -41,7 +41,7 @@ struct top_hash_entry 4 | u8 mode; /* LSA generated during RT calculation (LSA_RTCALC or LSA_STALE)*/ 5 | u8 nhs_reuse; /* Whether nhs nodes can be reused during merging. 6 | See a note in rt.c:add_cand() */ 7 | -}; 8 | +} PACKED; 9 | 10 | 11 | /* Prevents ospf_hash_find() to ignore the entry, for p->lsrqh and p->lsrth */ 12 | -------------------------------------------------------------------------------- /bird2/test.sh: -------------------------------------------------------------------------------- 1 | bird --version 2>&1 | grep "$PKG_VERSION" 2 | -------------------------------------------------------------------------------- /bird3/files/bird.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2010-2017 OpenWrt.org 3 | 4 | USE_PROCD=1 5 | START=70 6 | STOP=10 7 | 8 | BIRD_BIN="/usr/sbin/bird" 9 | BIRD_CONF="/etc/bird.conf" 10 | BIRD_PID_FILE="/var/run/bird.pid" 11 | 12 | start_service() { 13 | mkdir -p /var/run 14 | procd_open_instance 15 | procd_set_param command $BIRD_BIN -f -c $BIRD_CONF -P $BIRD_PID_FILE 16 | procd_set_param file "$BIRD_CONF" 17 | procd_set_param stdout 1 18 | procd_set_param stderr 1 19 | procd_set_param respawn 20 | procd_close_instance 21 | } 22 | 23 | reload_service() { 24 | procd_send_signal bird 25 | } 26 | -------------------------------------------------------------------------------- /bird3/test.sh: -------------------------------------------------------------------------------- 1 | bird --version 2>&1 | grep "$PKG_VERSION" 2 | -------------------------------------------------------------------------------- /bmx7/files/etc/config/bmx7: -------------------------------------------------------------------------------- 1 | # for more information: 2 | # https://github.com/bmx-routing/bmx7/ 3 | # options execute: bmx7 --help 4 | 5 | config 'bmx7' 'general' 6 | # option 'runtimeDir' '/var/run/bmx7' 7 | # option 'trustedNodesDir' '/etc/bmx7/trustedNodes' 8 | 9 | #config 'plugin' 10 | # option 'plugin' 'bmx7_config.so' 11 | 12 | #config 'plugin' 13 | # option 'plugin' 'bmx7_json.so' 14 | 15 | #config 'plugin' 16 | # option 'plugin' 'bmx7_sms.so' 17 | 18 | #config 'plugin' 19 | # option 'plugin' 'bmx7_iwinfo.so' 20 | 21 | config 'dev' 'mesh_1' 22 | option 'dev' 'br-lan' 23 | 24 | config 'dev' 'mesh_2' 25 | option 'dev' 'wlan0' 26 | 27 | #config 'plugin' 28 | # option 'plugin' 'bmx7_tun.so' 29 | 30 | #config 'plugin' 31 | # option 'plugin' 'bmx7_table.so' 32 | 33 | #config 'tunDev' default 34 | # option 'tunDev' 'default' 35 | # option 'tun6Address' '2012:0:0:6666::1/64' 36 | # option 'tun4Address' '10.66.66.1/24' 37 | 38 | 39 | #config 'tunOut' 40 | # option 'tunOut' 'ip6' 41 | # option 'network' '2012::/16' 42 | # option 'exportDistance' '0' 43 | 44 | #config 'tunOut' 45 | # option 'tunOut' 'ip4' 46 | # option 'network' '10.0.0.0/9' 47 | # option 'minPrefixLen' '27' 48 | -------------------------------------------------------------------------------- /bmx7/files/etc/init.d/bmx7: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | START=91 3 | USE_PROCD=1 4 | 5 | BIN=/usr/sbin/bmx7 6 | CONF=/etc/config/bmx7 7 | 8 | start_service() { 9 | cd /root/ || return 10 | while pgrep -f mac80211.sh ; do sleep 1; done 11 | 12 | procd_open_instance "bmx7" 13 | procd_set_param command "$BIN" 14 | procd_append_param command -f "$CONF" -d0 15 | procd_set_param limits core=20000 16 | procd_set_param stdout 1 17 | procd_set_param stderr 1 18 | procd_set_param respawn 19 | procd_close_instance 20 | } 21 | 22 | reload_service() { 23 | "$BIN" -c configReload 24 | } 25 | 26 | service_triggers() { 27 | procd_add_reload_trigger "bmx7" 28 | } 29 | -------------------------------------------------------------------------------- /bmx7/patches/020-siocgstamp.patch: -------------------------------------------------------------------------------- 1 | --- a/src/schedule.c 2 | +++ b/src/schedule.c 3 | @@ -376,7 +376,9 @@ loop4Event: 4 | continue; 5 | } 6 | 7 | +#ifdef SIOCGSTAMP 8 | ioctl(pb.i.iif->rx_mcast_sock, SIOCGSTAMP, &(pb.i.tv_stamp)); 9 | +#endif 10 | 11 | rx_packet(&pb); 12 | 13 | @@ -402,7 +404,9 @@ loop4Event: 14 | continue; 15 | } 16 | 17 | +#ifdef SIOCGSTAMP 18 | ioctl(pb.i.iif->rx_fullbrc_sock, SIOCGSTAMP, &(pb.i.tv_stamp)); 19 | +#endif 20 | 21 | rx_packet(&pb); 22 | 23 | @@ -452,10 +456,15 @@ loop4Event: 24 | } 25 | } 26 | #endif 27 | +#ifdef SIOCGSTAMP 28 | if (tv_stamp == NULL) 29 | ioctl(pb.i.iif->unicast_sock, SIOCGSTAMP, &(pb.i.tv_stamp)); 30 | else 31 | timercpy(&(pb.i.tv_stamp), tv_stamp); 32 | +#else 33 | + if (tv_stamp) 34 | + timercpy(&(pb.i.tv_stamp), tv_stamp); 35 | +#endif 36 | 37 | rx_packet(&pb); 38 | 39 | -------------------------------------------------------------------------------- /cjdns/files/cjdns.defaults: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # if there is an existing config, our work is already done 4 | uci get cjdns.cjdns.ipv6 >/dev/null 2>&1 5 | if [ $? -ne 0 ]; then 6 | 7 | # generate configuration 8 | touch /etc/config/cjdns 9 | cjdroute --genconf | cjdroute --cleanconf | cjdrouteconf set 10 | 11 | # make sure config is present (might fail for any reason) 12 | uci get cjdns.cjdns.ipv6 >/dev/null 2>&1 13 | if [ $? -ne 0 ]; then 14 | exit 1 15 | fi 16 | 17 | # enable auto-peering on ethernet interface lan, if existing 18 | ifname=$(uci -q get network.lan.device || \ 19 | ([ "$(uci -q get network.lan.type)" == "bridge" ] && echo br-lan) || \ 20 | uci -q get network.lan.ifname) 21 | if [ -n "$ifname" ]; then 22 | uci -q batch <<-EOF >/dev/null 23 | add cjdns eth_interface 24 | set cjdns.@eth_interface[-1].beacon=2 25 | set cjdns.@eth_interface[-1].bind=$ifname 26 | EOF 27 | fi 28 | # set the tun interface name 29 | uci set cjdns.cjdns.tun_device=tuncjdns 30 | 31 | # create the network interface 32 | uci -q batch <<-EOF >/dev/null 33 | set network.cjdns=interface 34 | set network.cjdns.device=tuncjdns 35 | set network.cjdns.proto=none 36 | EOF 37 | 38 | # firewall rules by @dangowrt -- thanks <3 39 | 40 | # create the firewall zone 41 | uci -q batch <<-EOF >/dev/null 42 | add firewall zone 43 | set firewall.@zone[-1].name=cjdns 44 | add_list firewall.@zone[-1].network=cjdns 45 | set firewall.@zone[-1].input=REJECT 46 | set firewall.@zone[-1].output=ACCEPT 47 | set firewall.@zone[-1].forward=REJECT 48 | set firewall.@zone[-1].conntrack=1 49 | set firewall.@zone[-1].family=ipv6 50 | EOF 51 | 52 | # allow ICMP from cjdns zone, e.g. ping6 53 | uci -q batch <<-EOF >/dev/null 54 | add firewall rule 55 | set firewall.@rule[-1].name='Allow-ICMPv6-cjdns' 56 | set firewall.@rule[-1].src=cjdns 57 | set firewall.@rule[-1].proto=icmp 58 | add_list firewall.@rule[-1].icmp_type=echo-request 59 | add_list firewall.@rule[-1].icmp_type=echo-reply 60 | add_list firewall.@rule[-1].icmp_type=destination-unreachable 61 | add_list firewall.@rule[-1].icmp_type=packet-too-big 62 | add_list firewall.@rule[-1].icmp_type=time-exceeded 63 | add_list firewall.@rule[-1].icmp_type=bad-header 64 | add_list firewall.@rule[-1].icmp_type=unknown-header-type 65 | set firewall.@rule[-1].limit='1000/sec' 66 | set firewall.@rule[-1].family=ipv6 67 | set firewall.@rule[-1].target=ACCEPT 68 | EOF 69 | 70 | # allow SSH from cjdns zone, needs to be explicitly enabled 71 | uci -q batch <<-EOF >/dev/null 72 | add firewall rule 73 | set firewall.@rule[-1].enabled=0 74 | set firewall.@rule[-1].name='Allow-SSH-cjdns' 75 | set firewall.@rule[-1].src=cjdns 76 | set firewall.@rule[-1].proto=tcp 77 | set firewall.@rule[-1].dest_port=22 78 | set firewall.@rule[-1].target=ACCEPT 79 | EOF 80 | 81 | # allow LuCI access from cjdns zone, needs to be explicitly enabled 82 | uci -q batch <<-EOF >/dev/null 83 | add firewall rule 84 | set firewall.@rule[-1].enabled=0 85 | set firewall.@rule[-1].name='Allow-HTTP-cjdns' 86 | set firewall.@rule[-1].src=cjdns 87 | set firewall.@rule[-1].proto=tcp 88 | set firewall.@rule[-1].dest_port=80 89 | set firewall.@rule[-1].target=ACCEPT 90 | EOF 91 | 92 | # allow UDP peering from wan zone, if it exists 93 | uci show network.wan >/dev/null 2>&1 94 | if [ $? -eq 0 ]; then 95 | peeringPort=`uci get cjdns.@udp_interface[0].port` 96 | uci -q batch <<-EOF >/dev/null 97 | add firewall rule 98 | set firewall.@rule[-1].name='Allow-cjdns-wan' 99 | set firewall.@rule[-1].src=wan 100 | set firewall.@rule[-1].proto=udp 101 | set firewall.@rule[-1].dest_port=$peeringPort 102 | set firewall.@rule[-1].target=ACCEPT 103 | EOF 104 | fi 105 | 106 | uci commit cjdns 107 | uci commit firewall 108 | uci commit network 109 | 110 | fi 111 | 112 | exit 0 113 | -------------------------------------------------------------------------------- /cjdns/files/cjdns.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | 3 | START=90 4 | STOP=85 5 | 6 | USE_PROCD=1 7 | 8 | start_service() 9 | { 10 | [ -f /etc/uci-defaults/cjdns ] && ( . /etc/uci-defaults/cjdns ) 11 | 12 | procd_open_instance 13 | procd_set_param respawn 14 | procd_set_param command /bin/ash -c "cjdrouteconf get | tee /tmp/etc/cjdroute.conf | cjdroute --nobg | logger -t cjdns" 15 | procd_close_instance 16 | } 17 | 18 | stop_service() 19 | { 20 | killall cjdroute 21 | } 22 | 23 | reload_service() 24 | { 25 | # cat /tmp/etc/cjdroute.conf | cjdrouteconf reload 26 | restart 27 | } 28 | 29 | service_triggers() 30 | { 31 | procd_add_reload_trigger cjdns 32 | } 33 | -------------------------------------------------------------------------------- /cjdns/files/cjdrouteconf: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env lua 2 | 3 | dkjson = require("dkjson") 4 | cjdns = require("cjdns") 5 | require("cjdns/uci") 6 | 7 | function help() 8 | print("JSON interface to /etc/config/cjdns\n\nExamples: \ 9 | cjdrouteconf get > /tmp/etc/cjdroute.conf \ 10 | cat /tmp/etc/cjdroute.conf | cjdrouteconf set \ 11 | uci changes \ 12 | cjdrouteconf get | cjdroute") 13 | end 14 | 15 | if arg[1] == "get" then 16 | local json = dkjson.encode(cjdns.uci.get(), { indent = true }) 17 | print(json) 18 | elseif arg[1] == "set" then 19 | local json = io.stdin:read("*a") 20 | local obj, pos, err = dkjson.decode(json, 1, nil) 21 | 22 | if obj then 23 | cjdns.uci.set(obj) 24 | else 25 | print("dkjson: " .. err .. " (try cjdroute --cleanconf)") 26 | os.exit(1) 27 | end 28 | else 29 | help() 30 | end 31 | -------------------------------------------------------------------------------- /cjdns/files/luci-app-cjdns.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": "cjdns", 3 | "init": "cjdns" 4 | } 5 | -------------------------------------------------------------------------------- /cjdns/lua/cjdns/admin.lua: -------------------------------------------------------------------------------- 1 | -- Cjdns admin module for Lua 2 | -- Written by Philip Horger 3 | 4 | common = require 'cjdns/common' 5 | 6 | AdminInterface = {} 7 | AdminInterface.__index = AdminInterface 8 | common.AdminInterface = AdminInterface 9 | 10 | function AdminInterface.new(properties) 11 | properties = properties or {} 12 | 13 | properties.host = properties.host or "127.0.0.1" 14 | properties.port = properties.port or 11234 15 | properties.password = properties.password or nil 16 | properties.config = properties.config or common.ConfigFile.new("/etc/cjdroute.conf", false) 17 | properties.timeout = properties.timeout or 2 18 | 19 | properties.udp = common.UDPInterface.new(properties) 20 | 21 | return setmetatable(properties, AdminInterface) 22 | end 23 | 24 | function AdminInterface:send(object) 25 | local bencoded, err = bencode.encode(object) 26 | if err then 27 | return nil, err 28 | end 29 | 30 | local sock_obj = assert(socket.udp()) 31 | sock_obj:settimeout(self.timeout) 32 | 33 | local _, err = sock_obj:sendto(bencoded, self.host, self.port) 34 | if err then 35 | return nil, err 36 | end 37 | 38 | return sock_obj 39 | end 40 | 41 | function AdminInterface:recv(sock_obj) 42 | local retrieved, err = sock_obj:receive() 43 | if not retrieved then 44 | return nil, "ai:recv > " .. err 45 | end 46 | local bencoded, err = bencode.decode(retrieved) 47 | if bencoded then 48 | return bencoded 49 | else 50 | return nil, "ai:recv > " .. err 51 | end 52 | end 53 | 54 | function AdminInterface:call(request) 55 | local sock_obj, err = self:send(request) 56 | if err then 57 | return nil, "ai:call > " .. err 58 | end 59 | 60 | return self:recv(sock_obj) 61 | end 62 | 63 | function AdminInterface:getCookie() 64 | local cookie_response, err = self:call({ q = "cookie" }) 65 | if not cookie_response then 66 | return nil, "ai:getCookie > " .. err 67 | end 68 | return cookie_response.cookie 69 | end 70 | 71 | function AdminInterface:auth(request) 72 | local funcname = request.q 73 | local args = {} 74 | for k, v in pairs(request) do 75 | args[k] = v 76 | end 77 | 78 | -- Step 1: Get cookie 79 | local cookie, err = self:getCookie() 80 | if err then 81 | return nil, err 82 | end 83 | 84 | -- Step 2: Calculate hash1 (password + cookie) 85 | local plaintext1 = self.password .. cookie 86 | local hash1 = sha2.sha256hex(plaintext1) 87 | 88 | -- Step 3: Calculate hash2 (intermediate stage request) 89 | local request = { 90 | q = "auth", 91 | aq = funcname, 92 | args = args, 93 | hash = hash1, 94 | cookie = cookie 95 | } 96 | local plaintext2, err = bencode.encode(request) 97 | if err then 98 | return nil, err 99 | end 100 | local hash2 = sha2.sha256hex(plaintext2) 101 | 102 | -- Step 4: Update hash in request, then ship it out 103 | request.hash = hash2 104 | return self:call(request) 105 | end 106 | -------------------------------------------------------------------------------- /cjdns/lua/cjdns/common.lua: -------------------------------------------------------------------------------- 1 | -- Cjdns admin module for Lua 2 | -- Written by Philip Horger 3 | 4 | -- This table is preserved over multiple imports, and collects 5 | -- submodules import-by-import via init.lua. 6 | 7 | return {} 8 | -------------------------------------------------------------------------------- /cjdns/lua/cjdns/init.lua: -------------------------------------------------------------------------------- 1 | -- Cjdns admin module for Lua 2 | -- Written by Philip Horger 3 | 4 | bencode = require "bencode" -- https://bitbucket.org/wilhelmy/lua-bencode/ 5 | dkjson = require "dkjson" -- http://dkolf.de/src/dkjson-lua.fsl/home 6 | socket = require "socket" -- http://w3.impa.br/~diego/software/luasocket/ 7 | sha2 = require "sha2" -- https://code.google.com/p/sha2/ 8 | 9 | require "cjdns/admin" 10 | require "cjdns/udp" 11 | 12 | return require "cjdns/common" 13 | -------------------------------------------------------------------------------- /cjdns/lua/cjdns/udp.lua: -------------------------------------------------------------------------------- 1 | -- Cjdns admin module for Lua 2 | -- Written by Philip Horger 3 | 4 | common = require 'cjdns/common' 5 | 6 | UDPInterface = {} 7 | UDPInterface.__index = UDPInterface 8 | common.UDPInterface = UDPInterface 9 | 10 | function UDPInterface.new(ai, config, ptype) 11 | properties = { 12 | ai = ai, 13 | config = config or ai.config, 14 | ptype = ptype or "ai" 15 | } 16 | 17 | return setmetatable(properties, UDPInterface) 18 | end 19 | 20 | function UDPInterface:call(name, args) 21 | local func = self[name .. "_" .. self.ptype] 22 | return func(self, unpack(args)) 23 | end 24 | 25 | function UDPInterface:newBind(...) 26 | return self:call("newBind", arg) 27 | end 28 | 29 | function UDPInterface:beginConnection(...) 30 | return self:call("beginConnection", arg) 31 | end 32 | 33 | function UDPInterface:newBind_ai(address) 34 | local response, err = self.ai:auth({ 35 | q = "UDPInterface_new", 36 | bindAddress = address 37 | }) 38 | if not response then 39 | return nil, err 40 | elseif response.error ~= "none" then 41 | return nil, response.error 42 | elseif response.interfaceNumber then 43 | return response.interfaceNumber 44 | else 45 | return nil, "bad response format" 46 | end 47 | end 48 | 49 | function UDPInterface:newBind_config(address) 50 | local udpif = self.config.contents.interfaces.UDPInterface 51 | local new_interface = { 52 | bind = address, 53 | connectTo = {} 54 | } 55 | table.insert(udpif, new_interface) 56 | return (#udpif - 1), new_interface 57 | end 58 | 59 | function UDPInterface:newBind_perm(...) 60 | return 61 | self:newBind_config(unpack(arg)), 62 | self:newBind_ai(unpack(arg)) 63 | end 64 | 65 | function UDPInterface:beginConnection_ai(pubkey, addr, password, interface) 66 | local request = { 67 | q = "UDPInterface_beginConnection", 68 | publicKey = pubkey, 69 | address = addr, 70 | password = password 71 | } 72 | if interface then 73 | request.interfaceNumber = interface 74 | end 75 | 76 | local response, err = self.ai:auth(request) 77 | if not response then 78 | return nil, err 79 | elseif response.error == "none" then 80 | -- Unfortunately, no real success indicator either. 81 | return "No error" 82 | else 83 | return nil, response.error 84 | end 85 | end 86 | 87 | function UDPInterface:beginConnection_config(pubkey, addr, password, interface) 88 | local udpif = self.config.contents.interfaces.UDPInterface 89 | local connections = udpif[(interface or 0) + 1].connectTo 90 | local this_conn = { 91 | password = password, 92 | publicKey = pubkey 93 | } 94 | connections[addr] = this_conn 95 | return this_conn -- allows adding metadata fields afterwards 96 | end 97 | 98 | function UDPInterface:beginConnection_perm(...) 99 | return 100 | self:beginConnection_config(unpack(arg)), 101 | self:beginConnection_ai(unpack(arg)) 102 | end 103 | -------------------------------------------------------------------------------- /cjdns/patches/001-five-mins-builder-zonk.patch: -------------------------------------------------------------------------------- 1 | --- a/node_build/builder.js 2 | +++ b/node_build/builder.js 3 | @@ -277,8 +277,8 @@ const execJs = function (js, ctx, file, 4 | js = '"use strict";' + qs.join("'"); 5 | 6 | const to = setTimeout(function () { 7 | - throw new Error("Inline JS did not return after 120 seconds [" + js + "]"); 8 | - }, 120000); 9 | + throw new Error("Inline JS did not return after 5 minutes [" + js + "]"); 10 | + }, 300000); 11 | 12 | nThen(function (waitFor) { 13 | 14 | -------------------------------------------------------------------------------- /cjdns/patches/020-prefer-python2.patch: -------------------------------------------------------------------------------- 1 | --- a/node_build/FindPython.js 2 | +++ b/node_build/FindPython.js 3 | @@ -23,7 +23,7 @@ var Fs = require('fs'); 4 | // de-prioritize because the testing script accepts ANY python3 version 5 | // (as of this writing, we don't know what python3 versions actually work) 6 | // whereas we know that python2.7 is the only working python2 version. 7 | -var PYTHONS = ["python3.7", "python3", "python2.7", "python2", "python"]; 8 | +var PYTHONS = ["python2", "python2.7", "python3.7", "python3.8", "python3.9", "python3"] 9 | 10 | var SCRIPT = [ 11 | 'import sys', 12 | -------------------------------------------------------------------------------- /cjdns/patches/030-fix-invalid-pointer.patch: -------------------------------------------------------------------------------- 1 | --- a/net/SwitchPinger_admin.c 2 | +++ b/net/SwitchPinger_admin.c 3 | @@ -78,8 +78,10 @@ static void adminPing(Dict* args, void* 4 | uint32_t timeout = (timeoutPtr) ? *timeoutPtr : DEFAULT_TIMEOUT; 5 | uint64_t path; 6 | String* err = NULL; 7 | + String* pathNotParsable = String_CONST("path was not parsable."); 8 | + String* noOpenSlots = String_CONST("no open slots to store ping, try later."); 9 | if (pathStr->len != 19 || AddrTools_parsePath(&path, (uint8_t*) pathStr->bytes)) { 10 | - err = String_CONST("path was not parsable."); 11 | + err = pathNotParsable; 12 | } else { 13 | struct SwitchPinger_Ping* ping = SwitchPinger_newPing(path, 14 | data, 15 | @@ -89,7 +91,7 @@ static void adminPing(Dict* args, void* 16 | context->switchPinger); 17 | if (keyPing && *keyPing) { ping->type = SwitchPinger_Type_KEYPING; } 18 | if (!ping) { 19 | - err = String_CONST("no open slots to store ping, try later."); 20 | + err = noOpenSlots; 21 | } else { 22 | ping->onResponseContext = Allocator_clone(ping->pingAlloc, (&(struct Ping) { 23 | .context = context, 24 | -------------------------------------------------------------------------------- /cjdns/patches/040-gyp-python_310.patch: -------------------------------------------------------------------------------- 1 | --- a/node_build/dependencies/libuv/build/gyp/pylib/gyp/common.py 2 | +++ b/node_build/dependencies/libuv/build/gyp/pylib/gyp/common.py 3 | @@ -4,7 +4,11 @@ 4 | 5 | from __future__ import with_statement 6 | 7 | -import collections 8 | +try: 9 | + # Python 3.10 10 | + from six.moves import collections_abc as collections 11 | +except ImportError: 12 | + import collections 13 | import errno 14 | import filecmp 15 | import os.path 16 | -------------------------------------------------------------------------------- /hnetd/files/hnet.config: -------------------------------------------------------------------------------- 1 | config security security 2 | # Simplest security mode: 3 | # option password foo 4 | # Trust consensus and CA-based share these options: 5 | # option certificate_file /etc/hnetd-cert.pem 6 | # option private_key_file /etc/hnetd-key.pem 7 | # Then to enable trust consensus: 8 | # option trust_store /etc/hnetd-trust.dat 9 | # Or CA-based authentication: 10 | # option trust_certificate_file /etc/ca-cert.pem 11 | 12 | config pa pa 13 | # option ip4prefix 10.0.0.0/8 14 | # option ip4mode ifuplink 15 | # option ulaprefix fd12:3456:789A::/48 16 | # option ulamode off 17 | option persistent_store /etc/hnet-pa.store 18 | 19 | config sd sd 20 | # option router_name openwrt 21 | # option domain_name home. 22 | 23 | 24 | # Wifi allows for very basic wifi autoconfiguration 25 | # Warning: This feature is unstable 26 | config wifi wifi 27 | # option enable 0 28 | # option ssid ssidtest 29 | # option password test 30 | -------------------------------------------------------------------------------- /hnetd/files/hnetd.defaults: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Why we tune dnsmasq? 4 | # localservice=0 => other hnetd instances can query for local names 5 | # boguspriv=0 => allow reverse resolution of RFC1918 w/o local hosts entries 6 | 7 | uci batch <psk); 32 | d->psk = malloc(psk_len); 33 | if (!d->psk) 34 | @@ -1011,6 +1014,9 @@ bool dtls_set_psk(dtls d, const char *ps 35 | SSL_CTX_set_psk_client_callback(d->ssl_client_ctx, _client_psk); 36 | SSL_CTX_set_psk_server_callback(d->ssl_server_ctx, _server_psk); 37 | return true; 38 | +#else 39 | + return false; 40 | +#endif 41 | } 42 | 43 | bool dtls_cert_to_pem_buf(dtls_cert cert, char *buf, int buf_len) 44 | -------------------------------------------------------------------------------- /hnetd/patches/020-unused.patch: -------------------------------------------------------------------------------- 1 | --- a/src/hnetd.h 2 | +++ b/src/hnetd.h 3 | @@ -39,6 +39,7 @@ 4 | 5 | #endif /* __APPLE__ */ 6 | 7 | +#undef __unused 8 | #include 9 | #include 10 | #include 11 | -------------------------------------------------------------------------------- /luci-app-cjdns/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2014,2018 Hyperboria.net 3 | # 4 | # You may redistribute this program and/or modify it under the terms of 5 | # the GNU General Public License as published by the Free Software Foundation, 6 | # either version 3 of the License, or (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program. If not, see . 15 | # 16 | 17 | include $(TOPDIR)/rules.mk 18 | 19 | PKG_NAME:=luci-app-cjdns 20 | PKG_VERSION:=1.3 21 | PKG_RELEASE:=9 22 | 23 | PKG_MAINTAINER:=William Fleurant 24 | PKG_LICENSE:=GPL-3.0-or-later 25 | 26 | include $(INCLUDE_DIR)/package.mk 27 | 28 | define Package/luci-app-cjdns 29 | SECTION:=luci 30 | CATEGORY:=LuCI 31 | SUBMENU:=3. Applications 32 | TITLE:=Encrypted near-zero-conf mesh routing protocol 33 | URL:=https://github.com/cjdelisle/cjdns 34 | DEPENDS:=+cjdns +luci-compat +luci-base 35 | endef 36 | 37 | define Package/luci-app-cjdns/description 38 | Cjdns implements an encrypted IPv6 network using public-key cryptography \ 39 | for address allocation and a distributed hash table for routing. \ 40 | This provides near-zero-configuration networking, and prevents many \ 41 | of the security and scalability issues that plague existing networks. 42 | endef 43 | 44 | define Build/Compile 45 | endef 46 | 47 | define Package/luci-app-cjdns/install 48 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci $(1)/usr/share/rpcd/acl.d 49 | $(CP) ./luasrc/* $(1)/usr/lib/lua/luci 50 | $(CP) ./files/luci-app-cjdns.json $(1)/usr/share/rpcd/acl.d 51 | endef 52 | 53 | $(eval $(call BuildPackage,luci-app-cjdns)) 54 | -------------------------------------------------------------------------------- /luci-app-cjdns/files/luci-app-cjdns.json: -------------------------------------------------------------------------------- 1 | { 2 | "luci-app-cjdns": { 3 | "description": "Grant access to LuCI app cjdns", 4 | "read": { 5 | "uci": [ "cjdns" ] 6 | }, 7 | "write": { 8 | "file": { 9 | "/usr/bin/cjdrouteconf": [ "exec" ] 10 | }, 11 | "uci": [ "cjdns" ] 12 | } 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /luci-app-cjdns/luasrc/controller/cjdns.lua: -------------------------------------------------------------------------------- 1 | module("luci.controller.cjdns", package.seeall) 2 | 3 | cjdns = require "cjdns/init" 4 | dkjson = require "dkjson" 5 | 6 | function index() 7 | if not nixio.fs.access("/etc/config/cjdns") then 8 | return 9 | end 10 | 11 | entry({"admin", "services", "cjdns"}, 12 | cbi("cjdns/overview"), _("cjdns")).dependent = true 13 | 14 | entry({"admin", "services", "cjdns", "overview"}, 15 | cbi("cjdns/overview"), _("Overview"), 1).leaf = false 16 | 17 | entry({"admin", "services", "cjdns", "peering"}, 18 | cbi("cjdns/peering"), _("Peers"), 2).leaf = false 19 | 20 | entry({"admin", "services", "cjdns", "iptunnel"}, 21 | cbi("cjdns/iptunnel"), _("IP Tunnel"), 3).leaf = false 22 | 23 | entry({"admin", "services", "cjdns", "settings"}, 24 | cbi("cjdns/settings"), _("Settings"), 4).leaf = false 25 | 26 | entry({"admin", "services", "cjdns", "cjdrouteconf"}, 27 | cbi("cjdns/cjdrouteconf"), _("cjdroute.conf"), 5).leaf = false 28 | 29 | entry({"admin", "services", "cjdns", "peers"}, call("act_peers")).leaf = true 30 | entry({"admin", "services", "cjdns", "ping"}, call("act_ping")).leaf = true 31 | end 32 | 33 | function act_peers() 34 | require("cjdns/uci") 35 | admin = cjdns.uci.makeInterface() 36 | 37 | local page = 0 38 | local peers = {} 39 | 40 | while page do 41 | local response, err = admin:auth({ 42 | q = "InterfaceController_peerStats", 43 | page = page 44 | }) 45 | 46 | if err or response.error then 47 | luci.http.status(502, "Bad Gateway") 48 | luci.http.prepare_content("application/json") 49 | luci.http.write_json({ err = err, response = response }) 50 | return 51 | end 52 | 53 | for i,peer in pairs(response.peers) do 54 | local peertable = peerstats_join(peer.addr) 55 | peer.ipv6 = peertable['ipv6'] 56 | peer.version = peertable['version'] 57 | peer.label = peertable['label'] 58 | peer.pubkey = peertable['pubkey'] 59 | uci.cursor():foreach("cjdns", "udp_peer", function(udp_peer) 60 | if peer.pubkey == udp_peer.public_key then 61 | peer.user = udp_peer.user 62 | end 63 | end) 64 | peers[#peers + 1] = peer 65 | end 66 | 67 | if response.more then 68 | page = page + 1 69 | else 70 | page = nil 71 | end 72 | end 73 | 74 | luci.http.status(200, "OK") 75 | luci.http.prepare_content("application/json") 76 | luci.http.write_json(peers) 77 | end 78 | 79 | function act_ping() 80 | require("cjdns/uci") 81 | admin = cjdns.uci.makeInterface() 82 | 83 | local response, err = admin:auth({ 84 | q = "SwitchPinger_ping", 85 | path = luci.http.formvalue("label"), 86 | timeout = tonumber(luci.http.formvalue("timeout")) 87 | }) 88 | 89 | if err or response.error then 90 | luci.http.status(502, "Bad Gateway") 91 | luci.http.prepare_content("application/json") 92 | luci.http.write_json({ err = err, response = response }) 93 | return 94 | end 95 | 96 | luci.http.status(200, "OK") 97 | luci.http.prepare_content("application/json") 98 | luci.http.write_json(response) 99 | end 100 | 101 | function peerstats_join(addrLine) 102 | local pubkey = addrLine:sub(addrLine:len() - 53) 103 | local process = io.popen("/usr/bin/publictoip6 " .. pubkey, "r") 104 | local ipv6 = process:read() 105 | local label = 'label' 106 | process:close() 107 | local version = addrLine:match("^(v%w+)%.") or 'v0' 108 | local label = addrLine:sub(version:len() + 2, version:len() + 20) 109 | return { pubkey=pubkey, ipv6=ipv6, label=label, version=version } 110 | end -------------------------------------------------------------------------------- /luci-app-cjdns/luasrc/model/cbi/cjdns/cjdrouteconf.lua: -------------------------------------------------------------------------------- 1 | m = Map("cjdns", translate("cjdns"), 2 | translate("Implements an encrypted IPv6 network using public-key \ 3 | cryptography for address allocation and a distributed hash table for \ 4 | routing. This provides near-zero-configuration networking, and prevents \ 5 | many of the security and scalability issues that plague existing \ 6 | networks.")) 7 | 8 | dkjson = require("dkjson") 9 | cjdns = require("cjdns") 10 | require("cjdns/uci") 11 | 12 | local f = SimpleForm("cjdrouteconf", translate("Edit cjdroute.conf"), 13 | translate("JSON interface to what's /etc/cjdroute.conf on other systems. \ 14 | Will be parsed and written to UCI by cjdrouteconf set.")) 15 | 16 | local o = f:field(Value, "_cjdrouteconf") 17 | o.template = "cbi/tvalue" 18 | o.rows = 25 19 | 20 | function o.cfgvalue(self, section) 21 | return dkjson.encode(cjdns.uci.get(), { indent = true }) 22 | end 23 | 24 | function o.write(self, section, value) 25 | local obj, pos, err = dkjson.decode(value, 1, nil) 26 | 27 | if obj then 28 | cjdns.uci.set(obj) 29 | end 30 | end 31 | 32 | return f 33 | -------------------------------------------------------------------------------- /luci-app-cjdns/luasrc/model/cbi/cjdns/iptunnel.lua: -------------------------------------------------------------------------------- 1 | uci = require "luci.model.uci" 2 | cursor = uci:cursor_state() 3 | 4 | m = Map("cjdns", translate("cjdns"), 5 | translate("Implements an encrypted IPv6 network using public-key \ 6 | cryptography for address allocation and a distributed hash table for \ 7 | routing. This provides near-zero-configuration networking, and prevents \ 8 | many of the security and scalability issues that plague existing \ 9 | networks.")) 10 | 11 | m.on_after_commit = function(self) 12 | os.execute("/etc/init.d/cjdns restart") 13 | end 14 | 15 | -- Outgoing 16 | outgoing = m:section(TypedSection, "iptunnel_outgoing", translate("Outgoing IP Tunnel Connections"), 17 | translate("Enter the public keys of the nodes that will provide Internet access.")) 18 | outgoing.anonymous = true 19 | outgoing.addremove = true 20 | outgoing.template = "cbi/tblsection" 21 | 22 | outgoing:option(Value, "public_key", translate("Public Key")).size = 55 23 | 24 | -- Allowed 25 | allowed = m:section(TypedSection, "iptunnel_allowed", translate("Allowed IP Tunnel Connections"), 26 | translate("Enter the public key of the node you will provide Internet access to, along with the \ 27 | IPv4 and/or IPv6 address you will assign them.")) 28 | allowed.anonymous = true 29 | allowed.addremove = true 30 | 31 | public_key = allowed:option(Value, "public_key", translate("Public Key")) 32 | public_key.template = "cjdns/value" 33 | public_key.size = 55 34 | 35 | ipv4 = allowed:option(Value, "ipv4", translate("IPv4")) 36 | ipv4.template = "cjdns/value" 37 | ipv4.datatype = 'ipaddr' 38 | ipv4.size = 55 39 | 40 | ipv6 = allowed:option(Value, "ipv6", translate("IPv6"), 41 | translate("IPv6 addresses should be entered without brackets here, e.g. 2001:123:ab::10.")) 42 | ipv6.template = "cjdns/value" 43 | ipv6.datatype = 'ip6addr' 44 | ipv6.size = 55 45 | 46 | return m 47 | -------------------------------------------------------------------------------- /luci-app-cjdns/luasrc/model/cbi/cjdns/overview.lua: -------------------------------------------------------------------------------- 1 | m = Map("cjdns", translate("cjdns"), 2 | translate("Implements an encrypted IPv6 network using public-key \ 3 | cryptography for address allocation and a distributed hash table for \ 4 | routing. This provides near-zero-configuration networking, and prevents \ 5 | many of the security and scalability issues that plague existing \ 6 | networks.")) 7 | 8 | m:section(SimpleSection).template = "cjdns/status" 9 | 10 | return m 11 | -------------------------------------------------------------------------------- /luci-app-cjdns/luasrc/model/cbi/cjdns/peering.lua: -------------------------------------------------------------------------------- 1 | uci = require "luci.model.uci" 2 | cursor = uci:cursor_state() 3 | 4 | cjdns = require("cjdns") 5 | require("cjdns/uci") 6 | 7 | m = Map("cjdns", translate("cjdns"), 8 | translate("Implements an encrypted IPv6 network using public-key \ 9 | cryptography for address allocation and a distributed hash table for \ 10 | routing. This provides near-zero-configuration networking, and prevents \ 11 | many of the security and scalability issues that plague existing \ 12 | networks.")) 13 | 14 | m.on_after_commit = function(self) 15 | os.execute("/etc/init.d/cjdns restart") 16 | end 17 | 18 | -- Authorized Passwords 19 | passwords = m:section(TypedSection, "password", translate("Authorized Passwords"), 20 | translate("Anyone offering one of the these passwords will be allowed to peer with you on the existing UDP and Ethernet interfaces.")) 21 | passwords.anonymous = true 22 | passwords.addremove = true 23 | passwords.template = "cbi/tblsection" 24 | 25 | passwords:option(Value, "user", translate("User/Name"), 26 | translate("Must be unique.") 27 | ).default = "user-" .. cjdns.uci.random_string(6) 28 | passwords:option(Value, "contact", translate("Contact"), translate("Optional, for out-of-band communication.")) 29 | passwords:option(Value, "password", translate("Password"), 30 | translate("Hand out to your peer, in accordance with the peering best practices of the network.") 31 | ).default = cjdns.uci.random_string(32) 32 | 33 | -- UDP Peers 34 | udp_peers = m:section(TypedSection, "udp_peer", translate("Outgoing UDP Peers"), 35 | translate("For peering via public IP networks, the peer handed you their Public Key and IP address/port along with a password. IPv6 addresses should be entered with square brackets, like so: [2001::1].")) 36 | udp_peers.anonymous = true 37 | udp_peers.addremove = true 38 | udp_peers.template = "cbi/tblsection" 39 | udp_peers:option(Value, "user", translate("User/Name")).datatype = "string" 40 | 41 | udp_interface = udp_peers:option(Value, "interface", translate("UDP interface")) 42 | local index = 1 43 | for i,section in pairs(cursor:get_all("cjdns")) do 44 | if section[".type"] == "udp_interface" then 45 | udp_interface:value(index, section.address .. ":" .. section.port) 46 | end 47 | end 48 | udp_interface.default = 1 49 | udp_peers:option(Value, "address", translate("IP address")) 50 | udp_peers:option(Value, "port", translate("Port")).datatype = "portrange" 51 | udp_peers:option(Value, "public_key", translate("Public key")) 52 | udp_peers:option(Value, "password", translate("Password")) 53 | 54 | -- Ethernet Peers 55 | eth_peers = m:section(TypedSection, "eth_peer", translate("Outgoing Ethernet Peers"), 56 | translate("For peering via local Ethernet networks, the peer handed you their Public Key and MAC address along with a password.")) 57 | eth_peers.anonymous = true 58 | eth_peers.addremove = true 59 | eth_peers.template = "cbi/tblsection" 60 | 61 | eth_interface = eth_peers:option(Value, "interface", translate("Ethernet interface")) 62 | local index = 1 63 | for i,section in pairs(cursor:get_all("cjdns")) do 64 | if section[".type"] == "eth_interface" then 65 | eth_interface:value(index, section.bind) 66 | end 67 | end 68 | eth_interface.default = 1 69 | eth_peers:option(Value, "address", translate("MAC address")).datatype = "macaddr" 70 | eth_peers:option(Value, "public_key", translate("Public key")) 71 | eth_peers:option(Value, "password", translate("Password")) 72 | 73 | -- Supernodes 74 | supernodes = m:section(TypedSection, "supernodes", translate("List of Supernodes"), 75 | translate("If none are specified they'll be taken from your peers")) 76 | supernodes.anonymous = true 77 | supernodes.addremove = true 78 | supernodes.template = "cbi/tblsection" 79 | 80 | supernodes:option(Value, "public_key", translate("Public Key")).size = 55 81 | 82 | return m 83 | -------------------------------------------------------------------------------- /luci-app-cjdns/luasrc/model/cbi/cjdns/settings.lua: -------------------------------------------------------------------------------- 1 | m = Map("cjdns", translate("cjdns"), 2 | translate("Implements an encrypted IPv6 network using public-key \ 3 | cryptography for address allocation and a distributed hash table for \ 4 | routing. This provides near-zero-configuration networking, and prevents \ 5 | many of the security and scalability issues that plague existing \ 6 | networks.")) 7 | 8 | m.on_after_commit = function(self) 9 | os.execute("/etc/init.d/cjdns restart") 10 | end 11 | 12 | s = m:section(NamedSection, "cjdns", nil, translate("Settings")) 13 | s.addremove = false 14 | 15 | -- Identity 16 | s:tab("identity", translate("Identity")) 17 | node6 = s:taboption("identity", Value, "ipv6", translate("IPv6 address"), 18 | translate("This node's IPv6 address within the cjdns network.")) 19 | node6.datatype = "ip6addr" 20 | pbkey = s:taboption("identity", Value, "public_key", translate("Public key"), 21 | translate("Used for packet encryption and authentication.")) 22 | pbkey.datatype = "string" 23 | prkey = s:taboption("identity", Value, "private_key", translate("Private key"), 24 | translate("Keep this private. When compromised, generate a new keypair and IPv6.")) 25 | prkey.datatype = "string" 26 | 27 | -- Admin Interface 28 | s:tab("admin", translate("Admin API"), translate("The Admin API can be used by other applications or services to configure and inspect cjdns' routing and peering.

Documentation: admin/README.md")) 29 | aip = s:taboption("admin", Value, "admin_address", translate("IP Address"), 30 | translate("IPv6 addresses should be entered like so: [2001::1].")) 31 | apt = s:taboption("admin", Value, "admin_port", translate("Port")) 32 | apt.datatype = "port" 33 | apw = s:taboption("admin", Value, "admin_password", translate("Password")) 34 | apw.datatype = "string" 35 | 36 | -- Security 37 | s:tab("security", translate("Security"), translate("Functionality related to hardening the cjdroute process.")) 38 | s:taboption("security", Flag, "seccomp", translate("SecComp sandboxing")) 39 | 40 | -- UDP Interfaces 41 | udp_interfaces = m:section(TypedSection, "udp_interface", translate("UDP Interfaces"), 42 | translate("These interfaces allow peering via public IP networks, such as the Internet, or many community-operated wireless networks. IPv6 addresses should be entered with square brackets, like so: [2001::1].")) 43 | udp_interfaces.anonymous = true 44 | udp_interfaces.addremove = true 45 | udp_interfaces.template = "cbi/tblsection" 46 | 47 | udp_address = udp_interfaces:option(Value, "address", translate("IP Address")) 48 | udp_address.placeholder = "0.0.0.0" 49 | udp_interfaces:option(Value, "port", translate("Port")).datatype = "portrange" 50 | 51 | -- Ethernet Interfaces 52 | eth_interfaces = m:section(TypedSection, "eth_interface", translate("Ethernet Interfaces"), 53 | translate("These interfaces allow peering via local Ethernet networks, such as home or office networks, or phone tethering. If an interface name is set to \"all\" each available device will be used.")) 54 | eth_interfaces.anonymous = true 55 | eth_interfaces.addremove = true 56 | eth_interfaces.template = "cbi/tblsection" 57 | 58 | eth_bind = eth_interfaces:option(Value, "bind", translate("Network Interface")) 59 | eth_bind.placeholder = "br-lan" 60 | eth_beacon = eth_interfaces:option(Value, "beacon", translate("Beacon Mode")) 61 | eth_beacon:value(0, translate("0 -- Disabled")) 62 | eth_beacon:value(1, translate("1 -- Accept beacons")) 63 | eth_beacon:value(2, translate("2 -- Accept and send beacons")) 64 | eth_beacon.default = 2 65 | eth_beacon.datatype = "integer(range(0,2))" 66 | 67 | return m 68 | -------------------------------------------------------------------------------- /luci-app-cjdns/luasrc/view/admin_status/index/cjdns.htm: -------------------------------------------------------------------------------- 1 | <%+cjdns/status%> 2 | -------------------------------------------------------------------------------- /luci-app-cjdns/luasrc/view/cjdns/status.htm: -------------------------------------------------------------------------------- 1 | 52 | 53 |
54 |
55 | <%:Active cjdns peers%> 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 |
AddressIPv6VersionStatusRx / TxUser/Name
66 |
67 |
-------------------------------------------------------------------------------- /luci-app-cjdns/luasrc/view/cjdns/value.htm: -------------------------------------------------------------------------------- 1 | <%+cbi/valueheader%> 2 | style="width: auto" /> 6 | <% if self.password then %><% end %> 7 | <% if #self.keylist > 0 or self.datatype then -%> 8 | 34 | <% end -%> 35 | <%+cbi/valuefooter%> 36 | -------------------------------------------------------------------------------- /luci-app-olsrd2/Makefile: -------------------------------------------------------------------------------- 1 | # call BuildPackage - OpenWrt buildroot signature 2 | include $(TOPDIR)/rules.mk 3 | 4 | PKG_NAME:=luci-app-olsrd2 5 | PKG_VERSION:=0.2.6 6 | PKG_RELEASE:=16 7 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) 8 | 9 | include $(INCLUDE_DIR)/package.mk 10 | 11 | define Package/luci-app-olsrd2 12 | SECTION:=luci 13 | CATEGORY:=LuCI 14 | SUBMENU:=3. Applications 15 | TITLE:=OLSR2 configuration and status module 16 | MAINTAINER:=Patrick Grimm 17 | EXTRA_DEPENDS:=oonf-olsrd2, luci-mod-admin-full 18 | PKGARCH:=all 19 | endef 20 | 21 | define Build/Prepare 22 | endef 23 | 24 | define Build/Configure 25 | endef 26 | 27 | define Build/Compile 28 | endef 29 | 30 | define Package/$(PKG_NAME)/postinst 31 | #!/bin/sh 32 | if [ -z $${IPKG_INSTROOT} ] ; then 33 | rm -f /tmp/luci-indexcache 34 | rm -rf /tmp/luci-modulecache/ 35 | killall -HUP rpcd 2>/dev/null 36 | fi 37 | endef 38 | 39 | define Package/$(PKG_NAME)/install 40 | $(INSTALL_DIR) $(1)/www/luci-static/resources/view/olsrd2 41 | $(INSTALL_DATA) ./htdocs/cgi-bin-olsrd2-neigh.html $(1)/www 42 | $(INSTALL_DATA) ./htdocs/luci-static/resources/view/olsrd2/* $(1)/www/luci-static/resources/view/olsrd2 43 | $(INSTALL_DIR) $(1)/etc/config 44 | $(INSTALL_DATA) ./root/etc/config/* $(1)/etc/config 45 | $(INSTALL_DIR) $(1)/usr/share/ucitrack 46 | $(INSTALL_DATA) ./root/usr/share/ucitrack/luci-app-olsrd2.json $(1)/usr/share/ucitrack 47 | $(INSTALL_DIR) $(1)/usr/libexec/rpcd 48 | $(INSTALL_BIN) ./root/usr/libexec/rpcd/status.olsrd2 $(1)/usr/libexec/rpcd/status.olsrd2 49 | $(INSTALL_DIR) $(1)/usr/share/luci/menu.d 50 | $(INSTALL_DATA) ./root/usr/share/luci/menu.d/* $(1)/usr/share/luci/menu.d 51 | $(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d 52 | $(INSTALL_DATA) ./root/usr/share/rpcd/acl.d/* $(1)/usr/share/rpcd/acl.d 53 | $(INSTALL_DIR) $(1)/lib/functions 54 | $(INSTALL_DATA) ./root/lib/functions/* $(1)/lib/functions 55 | endef 56 | 57 | $(eval $(call BuildPackage,luci-app-olsrd2)) 58 | -------------------------------------------------------------------------------- /luci-app-olsrd2/htdocs/cgi-bin-olsrd2-neigh.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | LuCI - Lua Configuration Interface 9 | 10 | 11 | -------------------------------------------------------------------------------- /luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/attachednetwork.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 'require view'; 3 | 'require ui'; 4 | 'require rpc'; 5 | 'require poll'; 6 | 7 | var callgetData = rpc.declare({ 8 | object: 'status.olsrd2', 9 | method: 'getAttached_network' 10 | }); 11 | 12 | function createTable(data) { 13 | let tableData = []; 14 | data.attached_network.forEach(row => { 15 | let node = E('a',{ 'href': 'https://' + row.node + '/cgi-bin-olsrd2-neigh.html'},row.node); 16 | tableData.push([ 17 | node, 18 | row.attached_net, 19 | row.attached_net_src, 20 | row.domain_metric_out 21 | ]) 22 | }); 23 | return tableData; 24 | } 25 | 26 | return view.extend({ 27 | title: _('OLSRD2 networks'), 28 | handleSaveApply: null, 29 | handleSave: null, 30 | handleReset: null, 31 | 32 | render: function(data) { 33 | 34 | var tr = E('table', { 'class': 'table' }); 35 | tr.appendChild(E('div', { 'class': 'tr cbi-section-table-titles' }, [ 36 | E('th', { 'class': 'th left' }, [ 'IP address' ]), 37 | E('th', { 'class': 'th left' }, [ 'Network' ]), 38 | E('th', { 'class': 'th left' }, [ 'Source' ]), 39 | E('th', { 'class': 'th left' }, [ 'Metric' ]) 40 | ])); 41 | poll.add(() => { 42 | Promise.all([ 43 | callgetData() 44 | ]).then((results) => { 45 | cbi_update_table(tr, createTable(results[0])); 46 | }) 47 | }, 30); 48 | return tr 49 | } 50 | 51 | }); 52 | -------------------------------------------------------------------------------- /luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/domain.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 'require view'; 3 | 'require form'; 4 | 5 | return view.extend({ 6 | render: function() { 7 | var m, s, o; 8 | 9 | m = new form.Map('olsrd2', 'OLSRD2 Daemon'); 10 | 11 | s = m.section(form.TypedSection, 'domain', _('domain configuration section')); 12 | s.anonymous = true; 13 | s.addremove = false; 14 | o = s.option(form.Value, "table", _("table defines the routing table for the local routing entries."), "0-254"); 15 | o.optional = true; 16 | o.placeholder = 254; 17 | o.datatype = "range(0,254)"; 18 | o = s.option(form.Value, "protocol", _("protocol defines the protocol number for the local routing entries."), "0-254"); 19 | o.optional = true; 20 | o.placeholder = 100; 21 | o.datatype = "range(0,254)"; 22 | o = s.option(form.Value, "distance", _("distance defines the 'metric' (hopcount) of the local routing entries."), "0-254"); 23 | o.optional = true; 24 | o.placeholder = 2; 25 | o.datatype = "range(0,254)"; 26 | o = s.option(form.Flag, "srcip_routes", _("srcip_routes defines if the router sets the originator address as the source-ip entry into the local routing entries."), ""); 27 | o.optional = true; 28 | o.datatype = "bool"; 29 | 30 | return m.render(); 31 | } 32 | }); 33 | -------------------------------------------------------------------------------- /luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/global.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 'require view'; 3 | 'require form'; 4 | 5 | return view.extend({ 6 | render: function() { 7 | var m, s, o; 8 | 9 | m = new form.Map('olsrd2', 'OLSRD2 Daemon'); 10 | 11 | s = m.section(form.TypedSection, 'global', _('It controls the basic behavior of the OONF core.')); 12 | s.anonymous = true; 13 | s.addremove = false; 14 | 15 | o = s.option(form.Flag, "failfast", _("failfast is another boolean setting which can activate an error during startup if a requested plugin does not load or an unknown configuration variable is set."), ""); 16 | o.optional = true; 17 | o.rmempty = true; 18 | o.datatype = 'bool'; 19 | o = s.option(form.Value, "pidfile", _("pidfile is used together with the fork option to store the pid of the background process in a file."), "Filename"); 20 | o.optional = true; 21 | o.rmempty = true; 22 | o.placeholder = '/var/run/olsrd2.pid'; 23 | o.datatype = 'string'; 24 | o = s.option(form.Value, "lockfile", _("lockfile creates a file on disk and keeps a lock on it as long as the OONF application is running to prevent the application from running multiple times at once."), "Filename"); 25 | o.rmempty = false; 26 | o.optional = true; 27 | o.placeholder = "/var/lock/olsrd2"; 28 | o.datatype = "string"; 29 | 30 | return m.render(); 31 | } 32 | }); 33 | -------------------------------------------------------------------------------- /luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/lan_import.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 'require view'; 3 | 'require form'; 4 | 5 | return view.extend({ 6 | render: function() { 7 | var m, s, o; 8 | 9 | m = new form.Map('olsrd2', 'OLSRD2 Daemon'); 10 | 11 | s = m.section(form.TypedSection, 'lan_import', _('Automatic import of routing tables as locally attached networks.')); 12 | s.anonymous = true; 13 | s.addremove = true; 14 | o = s.option(form.Value, "name", _("Name"), "Text"); 15 | o.datatype = "string"; 16 | o = s.option(form.Value, "interface", _("Interface"), "Name Interface"); 17 | o.datatype = "string"; 18 | o = s.option(form.Value, "table", _("IP Table"), "1-255"); 19 | o.datatype = "range(1,255)"; 20 | o = s.option(form.Value, "protocol", _("IP protocol"), "1-255"); 21 | o.datatype = "range(1,255)"; 22 | 23 | return m.render(); 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/log.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 'require view'; 3 | 'require form'; 4 | 5 | return view.extend({ 6 | render: function() { 7 | var m, s, o; 8 | 9 | m = new form.Map('olsrd2', 'OLSRD2 Daemon'); 10 | 11 | s = m.section(form.TypedSection, 'log', _('OONF Logging')); 12 | s.anonymous = true; 13 | s.addremove = false; 14 | 15 | o = s.option(form.Flag, "syslog", _("syslog are boolean options that activate or deactivate the syslog Logging Target."), ""); 16 | o.optional = true; 17 | o.datatype = "bool"; 18 | o = s.option(form.Flag, "stderr", _("stderr are boolean options that activate or deactivate the stderr Logging Target."), ""); 19 | o.optional = true; 20 | o.datatype = "bool"; 21 | o = s.option(form.Value, "file", _("file asks for a filename for logging output"),"Filename"); 22 | o.rmempty = false; 23 | o.optional = true; 24 | o.placeholder = "/tmp/olsrd2.log"; 25 | o.datatype = "string"; 26 | o = s.option(form.Value, "debug", _("debug ask for a list of Logging Sources that will be logged by the OONF Core Logging Targets.")); 27 | o.rmempty = false; 28 | o.optional = true; 29 | o.datatype = "string"; 30 | o = s.option(form.Value, "info", _("info ask for a list of Logging Sources that will be logged by the OONF Core Logging Targets.")); 31 | o.rmempty = false; 32 | o.optional = true; 33 | o.datatype = "string"; 34 | 35 | return m.render(); 36 | } 37 | }); 38 | -------------------------------------------------------------------------------- /luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/luci.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 'require view'; 3 | 'require form'; 4 | 5 | return view.extend({ 6 | render: function() { 7 | var m, s, o; 8 | 9 | m = new form.Map('luci_olsrd2', 'Luci options'); 10 | 11 | s = m.section(form.TypedSection, 'olsrd2', _('LUCI')); 12 | s.anonymous = true; 13 | s.addremove = false; 14 | 15 | o = s.option(form.Flag, "resolve", _("do Hostname lookup"), ""); 16 | o.datatype = "bool"; 17 | o = s.option(form.Value, "domain", _("optional Public domain forwarding with dnsmasq-full (auth-zone=example.com) on the internetgateway "), "default is olsr"); 18 | o.datatype = "string"; 19 | 20 | return m.render(); 21 | } 22 | }); 23 | -------------------------------------------------------------------------------- /luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/mesh.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 'require view'; 3 | 'require form'; 4 | 5 | return view.extend({ 6 | render: function() { 7 | var m, s, o; 8 | 9 | m = new form.Map('olsrd2', 'OLSRD2 Daemon'); 10 | 11 | s = m.section(form.TypedSection, 'mesh', _('mesh configuration section')); 12 | s.anonymous = true; 13 | s.addremove = false; 14 | o = s.option(form.Value, "port", _("port defines the UDP port number of the RFC5444 socket."), "1-65535"); 15 | o.optional = true; 16 | o.placeholder = 269; 17 | o.datatype = "range(1,65535)"; 18 | o = s.option(form.Value, "ip_proto", _("ip_proto defines the IP protocol number that can be used for RFC5444 communication."), "1-255"); 19 | o.optional = true; 20 | o.placeholder = 138; 21 | o.datatype = "range(1,255)"; 22 | o = s.option(form.Value, "aggregation_interval", _("aggregation_interval defines the time the local RFC5444 implementation will keep messages to aggregate them before creating a new RFC5444 packet to forward them."), ">0.1 s"); 23 | o.optional = true; 24 | o.placeholder = 1.0; 25 | o.datatype = "and(min(0.1), ufloat)"; 26 | 27 | return m.render(); 28 | } 29 | }); 30 | -------------------------------------------------------------------------------- /luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/neighbors.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 'require view'; 3 | 'require ui'; 4 | 'require rpc'; 5 | 'require poll'; 6 | 7 | var callgetData = rpc.declare({ 8 | object: 'status.olsrd2', 9 | method: 'getNeighbors' 10 | }); 11 | 12 | function createTable(data) { 13 | let tableData = []; 14 | data.neighbors.forEach(row => { 15 | let hostname = E('a',{ 'href': 'https://' + row.hostname + '/cgi-bin-olsrd2-neigh.html'},row.hostname); 16 | let orginator = E('a',{ 'href': 'https://[' + row.originator + ']/cgi-bin-olsrd2-neigh.html'},row.originator); 17 | tableData.push([ 18 | hostname, 19 | orginator, 20 | row.lladdr, 21 | row.interface, 22 | row.metric_in, 23 | row.metric_in_raw 24 | ]) 25 | }); 26 | return tableData; 27 | }; 28 | 29 | return view.extend({ 30 | title: _('OLSRD2 mesh neighbors'), 31 | handleSaveApply: null, 32 | handleSave: null, 33 | handleReset: null, 34 | 35 | 36 | render: function(data) { 37 | 38 | var tr = E('table', { 'class': 'table' }); 39 | tr.appendChild(E('tr', { 'class': 'tr cbi-section-table-titles' }, [ 40 | E('th', { 'class': 'th left' }, [ 'Hostname' ]), 41 | E('th', { 'class': 'th left' }, [ 'Orginator' ]), 42 | E('th', { 'class': 'th left' }, [ 'MAC' ]), 43 | E('th', { 'class': 'th left' }, [ 'Interface' ]), 44 | E('th', { 'class': 'th left' }, [ 'Metric' ]), 45 | E('th', { 'class': 'th left' }, [ 'raw' ]) 46 | ])); 47 | poll.add(() => { 48 | Promise.all([ 49 | callgetData() 50 | ]).then((results) => { 51 | cbi_update_table(tr, createTable(results[0])); 52 | }) 53 | }, 30); 54 | return tr 55 | 56 | } 57 | 58 | }); 59 | -------------------------------------------------------------------------------- /luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/node.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 'require view'; 3 | 'require ui'; 4 | 'require rpc'; 5 | 'require poll'; 6 | 7 | var callgetData = rpc.declare({ 8 | object: 'status.olsrd2', 9 | method: 'getNode' 10 | }); 11 | 12 | function createTable(data) { 13 | let tableData = []; 14 | data.node.forEach(row => { 15 | let node = E('a',{ 'href': 'https://' + row.node + '/cgi-bin-olsrd2-neigh.html'},row.node); 16 | tableData.push([ 17 | node 18 | ]) 19 | }); 20 | return tableData; 21 | }; 22 | 23 | return view.extend({ 24 | title: _('OLSRD2 mesh nodes'), 25 | handleSaveApply: null, 26 | handleSave: null, 27 | handleReset: null, 28 | 29 | render: function(data) { 30 | 31 | var tr = E('table', { 'class': 'table' }); 32 | tr.appendChild(E('tr', { 'class': 'tr cbi-section-table-titles' }, [ 33 | E('th', { 'class': 'th left' }, [ 'IP Address' ]) 34 | ])); 35 | poll.add(() => { 36 | Promise.all([ 37 | callgetData() 38 | ]).then((results) => { 39 | cbi_update_table(tr, createTable(results[0])); 40 | }) 41 | }, 30); 42 | 43 | return tr; 44 | } 45 | 46 | }); 47 | -------------------------------------------------------------------------------- /luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/olsrv2.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 'require view'; 3 | 'require form'; 4 | 5 | return view.extend({ 6 | render: function() { 7 | var m, s, o; 8 | 9 | m = new form.Map('olsrd2', 'OLSRD2 Daemon'); 10 | 11 | s = m.section(form.TypedSection, 'olsrv2', _('the OLSRv2 implementation including the OLSRv2 API for other plugins.')); 12 | s.anonymous = true; 13 | s.addremove = false; 14 | 15 | o = s.option(form.Value, "tc_interval", _("defines the time between two TC messages."), "s"); 16 | o.optional = true; 17 | o.placeholder = 5.0; 18 | o.datatype = "ufloat"; 19 | o = s.option(form.Value, "tc_validity", _("tc_validity defines the validity time of the TC messages."), "s"); 20 | o.optional = true; 21 | o.placeholder = 300.0; 22 | o.datatype = "ufloat"; 23 | o = s.option(form.Value, "forward_hold_time", _("forward_hold_time defines the time until the router will forget an entry in its forwarding duplicate database."), "s"); 24 | o.optional = true; 25 | o.placeholder = 300.0; 26 | o.datatype = "ufloat"; 27 | o = s.option(form.Value, "processing_hold_time", _("processing_hold_time defines the time until the router will forget an entry in its processing duplicate database."), "s"); 28 | o.optional = true; 29 | o.placeholder = 300.0; 30 | o.datatype = "ufloat"; 31 | o = s.option(form.DynamicList, "routable", _("routable defines the ACL which declares an IP address routable. Other IP addresses will not be included in TC messages."), "ip6prefix, ip4prefix, default_accept, default_reject"); 32 | o.datatype = "string"; 33 | //TODO 34 | //svc.datatype = "or(negm(ip6addr), negm(ip4addr), 'default_accept', 'default_reject')" 35 | //modules/luci-base/htdocs/luci-static/resources/cbi.js:545 36 | // negm: function() { 37 | // return this.apply('or', this.value.replace(/^[ \t]*-[ \t]*/, ''), arguments); 38 | // }, 39 | //modules/luci-base/luasrc/cbi/datatypes.lua:51 40 | //function negm(v, ...) 41 | // return _M['or'](v:gsub("^%s*-%s*", ""), ...) 42 | //end 43 | o.optional = true; 44 | o = s.option(form.DynamicList, "originator", _("originator defines the ACL which declares a valid originator IP address for the router."), "ip6prefix, ip4prefix, default_accept, default_reject"); 45 | o.datatype = "string"; 46 | //TODO 47 | //svc.datatype = "or(negm(ip6addr), negm(ip4addr), 'default_accept', 'default_reject')" 48 | //modules/luci-base/htdocs/luci-static/resources/cbi.js:545 49 | // negm: function() { 50 | // return this.apply('or', this.value.replace(/^[ \t]*-[ \t]*/, ''), arguments); 51 | // }, 52 | //modules/luci-base/luasrc/cbi/datatypes.lua:51 53 | //function negm(v, ...) 54 | // return _M['or'](v:gsub("^%s*-%s*", ""), ...) 55 | //end 56 | o.optional = true; 57 | 58 | return m.render(); 59 | } 60 | }); 61 | -------------------------------------------------------------------------------- /luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/olsrv2_lan.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 'require view'; 3 | 'require form'; 4 | 5 | return view.extend({ 6 | render: function() { 7 | var m, s, o; 8 | 9 | m = new form.Map('olsrd2', 'OLSRD2 Daemon'); 10 | 11 | s = m.section(form.TypedSection, 'olsrv2_lan', _('Prefix configuration section')); 12 | s.anonymous = true; 13 | s.addremove = true; 14 | o = s.option(form.Value, "name", _("Name"), "Text"); 15 | o.datatype = "string"; 16 | o = s.option(form.Value, "prefix", _("locally attached network prefix"), ""); 17 | o.datatype = "string"; 18 | o = s.option(form.Value, "domain", _("domain for this LAN entry, -1 for all domains"), "-1-254"); 19 | o.optional = true; 20 | o.placeholder = -1; 21 | o.datatype = "range(-1,254)"; 22 | o = s.option(form.Value, "metric", _("metric value for this LAN entry"), "0-254"); 23 | o.optional = true; 24 | o.placeholder = 2; 25 | o.datatype = "range(0,254)"; 26 | o = s.option(form.Flag, "source_prefix", _("source prefix for lan (source specific routing)"), ""); 27 | o.optional = true; 28 | o.datatype = "bool"; 29 | 30 | return m.render(); 31 | } 32 | }); 33 | -------------------------------------------------------------------------------- /luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/overview.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 'require view'; 3 | 'require ui'; 4 | 'require rpc'; 5 | 'require poll'; 6 | 7 | var callgetVersion = rpc.declare({ 8 | object: 'status.olsrd2', 9 | method: 'getVersion' 10 | }); 11 | var callgetLan = rpc.declare({ 12 | object: 'status.olsrd2', 13 | method: 'getLan' 14 | }); 15 | 16 | function createTable(data) { 17 | let tableData = []; 18 | if ( data && data.version && data.version[0] ) { 19 | if ( data.version[0].version_text != undefined ) { 20 | tableData.push([_('OLSRd2 Version'),data.version[0].version_text]); 21 | } 22 | if ( data.version[0].version_commit != undefined) { 23 | tableData.push([_('OLSRd2 GIT commit'),data.version[0].version_commit]); 24 | } 25 | } 26 | tableData.push(['']); 27 | return tableData; 28 | } 29 | 30 | function createTableDomain(data) { 31 | let tableData = []; 32 | if ( data && data.lan && data.lan[0] ) { 33 | data.lan.forEach(row => { 34 | tableData.push([ 35 | row.lan, 36 | row.domain, 37 | row.domain_metric, 38 | row.domain_metric_out, 39 | row.domain_metric_out_raw, 40 | row.domain_distance 41 | ]) 42 | }); 43 | } 44 | return tableData; 45 | } 46 | 47 | return view.extend({ 48 | title: _('Version'), 49 | handleSaveApply: null, 50 | handleSave: null, 51 | handleReset: null, 52 | 53 | render: function() { 54 | 55 | var tr = E('table',{ 'class': 'table'}); 56 | tr.appendChild(E('tr', { 'class': 'tr cbi-section-table-titles' }, [ 57 | E('th', { 'class': 'th left' }), 58 | E('th', { 'class': 'th left' }) 59 | ])); 60 | var trd = E('table', { 'class': 'table' }); 61 | trd.appendChild(E('trd', { 'class': 'tr cbi-section-table-titles' }, [ 62 | E('th', { 'class': 'th left' }, [ 'LAN IP' ]), 63 | E('th', { 'class': 'th left' }, [ 'Domain' ]), 64 | E('th', { 'class': 'th left' }, [ 'Domain Metric' ]), 65 | E('th', { 'class': 'th left' }, [ 'Domain Metric out' ]), 66 | E('th', { 'class': 'th left' }, [ 'Domain Metric out' ]), 67 | E('th', { 'class': 'th left' }, [ 'Domain distance' ]) 68 | ])); 69 | poll.add(() => { 70 | Promise.all([ 71 | callgetVersion(), 72 | callgetLan() 73 | ]).then((results) => { 74 | cbi_update_table(tr, createTable(results[0])); 75 | cbi_update_table(trd, createTableDomain(results[1])); 76 | }) 77 | }, 30); 78 | 79 | return [tr,trd]; 80 | } 81 | 82 | }); 83 | -------------------------------------------------------------------------------- /luci-app-olsrd2/root/etc/config/luci_olsrd2: -------------------------------------------------------------------------------- 1 | config 'olsrd2' 'general' 2 | option 'resolve' '1' 3 | option 'domain' 'olsr' 4 | -------------------------------------------------------------------------------- /luci-app-olsrd2/root/lib/functions/olsrd2.sh: -------------------------------------------------------------------------------- 1 | # 1: destination variable 2 | # 2: interface 3 | # 3: path 4 | # 4: separator 5 | # 5: limit 6 | __network_ifstatus() { 7 | local __tmp 8 | 9 | [ -z "$__NETWORK_CACHE" ] && { 10 | __tmp="$(ubus call network.interface dump 2>&1)" 11 | case "$?" in 12 | 4) : ;; 13 | 0) export __NETWORK_CACHE="$__tmp" ;; 14 | *) echo "$__tmp" >&2 ;; 15 | esac 16 | } 17 | 18 | __tmp="$(jsonfilter ${4:+-F "$4"} ${5:+-l "$5"} -s "${__NETWORK_CACHE:-{}}" -e "$1=@.interface${2:+[@.interface='$2']}$3")" 19 | 20 | [ -z "$__tmp" ] && \ 21 | unset "$1" && \ 22 | return 1 23 | 24 | eval "$__tmp" 25 | } 26 | 27 | # 1: addr 28 | # 2: export var neighbour dev lladdr 29 | network_get_neighbour_by_ip() 30 | { 31 | local __tmp 32 | neighbour='' 33 | dev='' 34 | lladdr='' 35 | local ipaddr="$1" 36 | hostname=$(nslookup "$ipaddr" "$ipaddr" | grep name | cut -d " " -f 3 | cut -d '.' -f -1) 37 | [ -z "$__NEIGH_CACHE" ] && { 38 | __tmp="$(ip -6 neigh)" 39 | export __NEIGH_CACHE="$__tmp" 40 | } 41 | [ -z "$__ROUTE_CACHE" ] && { 42 | __tmp="$(ip -6 route)" 43 | export __ROUTE_CACHE="$__tmp" 44 | } 45 | local gwaddr=$(echo "$__ROUTE_CACHE" | grep "^$ipaddr" | cut -d ' ' -f 3) 46 | [ -z "$gwaddr" ] && return 47 | local neigh=$(echo "$__NEIGH_CACHE" | grep "$gwaddr") 48 | [ -z "$neigh" ] && return 49 | set -- $neigh 50 | eval "neighbour=$1;dev=$3;lladdr=$5" 51 | } 52 | 53 | # 1: destination variable 54 | # 2: addr 55 | network_get_name_by_device() 56 | { 57 | __network_ifstatus "$1" "" \ 58 | "[@.device='$2' && !@.table].interface" "" 1 && \ 59 | return 0 60 | } 61 | 62 | -------------------------------------------------------------------------------- /luci-app-olsrd2/root/usr/libexec/rpcd/status.olsrd2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2016 OpenWrt.org 3 | 4 | . /lib/functions.sh 5 | . /usr/share/libubox/jshn.sh 6 | . /lib/functions/olsrd2.sh 7 | 8 | case "$1" in 9 | list) 10 | json_init 11 | 12 | json_add_object "getVersion" 13 | json_close_object 14 | json_add_object "getLan" 15 | json_close_object 16 | json_add_object "getNode" 17 | json_close_object 18 | json_add_object "getNeighbors" 19 | json_close_object 20 | json_add_object "getAttached_network" 21 | json_close_object 22 | json_add_object "getRoute" 23 | json_close_object 24 | json_add_object "getGraph" 25 | json_close_object 26 | json_add_object "getDomain" 27 | json_close_object 28 | 29 | json_dump 30 | ;; 31 | call) 32 | case "$2" in 33 | getVersion) 34 | echo '/systeminfo json version /quit' | nc ::1 2009 2>/dev/null 35 | ;; 36 | getLan) 37 | echo '/olsrv2info json lan /quit' | nc ::1 2009 2>/dev/null 38 | ;; 39 | getNode) 40 | echo '/olsrv2info json node /quit' | nc ::1 2009 2>/dev/null 41 | ;; 42 | getNeighbors) 43 | domain="$(uci_get luci_olsr2 general domain)" 44 | [ -z "$domain" ] || domain=".$domain" 45 | json_init 46 | json_add_array "neighbors" 47 | OLDIFS="$IFS" 48 | IFS=$'\n' 49 | neighbor_status="$(echo '/nhdpinfo neighbor /quit' | nc ::1 2009 | cut -f 1,9,10,11,12)" 50 | for neighbor in $neighbor_status; do 51 | json_add_object 0 52 | IFS="$OLDIFS" 53 | i=1 54 | for value in $neighbor ; do 55 | case $i in 56 | 1) json_add_string "originator" "${value}" 57 | network_get_neighbour_by_ip "${value}" 58 | json_add_string "lladdr" "${lladdr}" 59 | json_add_string "hostname" "${hostname}${domain}" 60 | network_get_name_by_device interface $dev 61 | json_add_string "interface" "${interface}" 62 | ;; 63 | 2) json_add_string "metric_in" "${value}";; 64 | 3) json_add_string "metric_in_raw" "${value}";; 65 | 4) json_add_string "metric_out" "${value}";; 66 | 5) json_add_string "metric_out_raw" "${value}";; 67 | esac 68 | i=$(( i + 1 )) 69 | done 70 | IFS=$'\n' 71 | json_close_object 72 | done 73 | IFS="$OLDIFS" 74 | json_close_array 75 | json_dump 76 | ;; 77 | getAttached_network) 78 | echo '/olsrv2info json attached_network /quit' | nc ::1 2009 2>/dev/null 79 | ;; 80 | getRoute) 81 | echo '/netjsoninfo filter route ipv6_0' | nc ::1 2009 2>/dev/null 82 | ;; 83 | getGraph) 84 | echo '/netjsoninfo filter graph ipv6_0' | nc ::1 2009 2>/dev/null 85 | ;; 86 | getDomain) 87 | echo '/netjsoninfo domain' | nc ::1 2009 2>/dev/null 88 | ;; 89 | esac 90 | ;; 91 | esac 92 | -------------------------------------------------------------------------------- /luci-app-olsrd2/root/usr/share/luci/menu.d/luci-app-olsrd2.json: -------------------------------------------------------------------------------- 1 | { 2 | "admin/services/olsrd2": { 3 | "title": "OLSRD2", 4 | "action": { 5 | "type": "firstchild" 6 | }, 7 | "depends": { 8 | "acl": [ "luci-app-olsrd2" ] 9 | } 10 | }, 11 | "admin/services/olsrd2/global": { 12 | "title": "Global", 13 | "order": 1, 14 | "action": { 15 | "type": "view", 16 | "path": "olsrd2/global" 17 | } 18 | }, 19 | "admin/services/olsrd2/log": { 20 | "title": "Logging", 21 | "order": 2, 22 | "action": { 23 | "type": "view", 24 | "path": "olsrd2/log" 25 | } 26 | }, 27 | "admin/services/olsrd2/olsrv2": { 28 | "title": "Daemon", 29 | "order": 3, 30 | "action": { 31 | "type": "view", 32 | "path": "olsrd2/olsrv2" 33 | } 34 | }, 35 | "admin/services/olsrd2/olsrv2_lan": { 36 | "title": "Prefix", 37 | "order": 4, 38 | "action": { 39 | "type": "view", 40 | "path": "olsrd2/olsrv2_lan" 41 | } 42 | }, 43 | "admin/services/olsrd2/domain": { 44 | "title": "Domain", 45 | "order": 5, 46 | "action": { 47 | "type": "view", 48 | "path": "olsrd2/domain" 49 | } 50 | }, 51 | "admin/services/olsrd2/mesh": { 52 | "title": "Mesh", 53 | "order": 6, 54 | "action": { 55 | "type": "view", 56 | "path": "olsrd2/mesh" 57 | } 58 | }, 59 | "admin/services/olsrd2/lan_import": { 60 | "title": "LAN Import", 61 | "order": 7, 62 | "action": { 63 | "type": "view", 64 | "path": "olsrd2/lan_import" 65 | } 66 | }, 67 | "admin/services/olsrd2/interface": { 68 | "title": "Interface", 69 | "order": 8, 70 | "action": { 71 | "type": "view", 72 | "path": "olsrd2/interface" 73 | } 74 | }, 75 | "admin/services/olsrd2/luci": { 76 | "title": "LUCI", 77 | "order": 8, 78 | "action": { 79 | "type": "view", 80 | "path": "olsrd2/luci" 81 | } 82 | }, 83 | "admin/status/olsrd2": { 84 | "title": "OLSRD2", 85 | "action": { 86 | "type": "firstchild" 87 | } 88 | }, 89 | "admin/status/olsrd2/overview": { 90 | "title": "Overview", 91 | "order": 1, 92 | "action": { 93 | "type": "view", 94 | "path": "olsrd2/overview" 95 | } 96 | }, 97 | "admin/status/olsrd2/node": { 98 | "title": "Nodes", 99 | "order": 2, 100 | "action": { 101 | "type": "view", 102 | "path": "olsrd2/node" 103 | } 104 | }, 105 | "admin/status/olsrd2/attachednetwork": { 106 | "title": "Attachednetwork", 107 | "order": 3, 108 | "action": { 109 | "type": "view", 110 | "path": "olsrd2/attachednetwork" 111 | } 112 | }, 113 | "admin/status/olsrd2/neighbors": { 114 | "title": "Neighbors", 115 | "order": 4, 116 | "action": { 117 | "type": "view", 118 | "path": "olsrd2/neighbors" 119 | } 120 | }, 121 | "public/status": { 122 | "title": "Status", 123 | "order": 10, 124 | "action": { 125 | "type": "firstchild", 126 | "recurse": true 127 | }, 128 | "auth": {} 129 | }, 130 | "public/status/olsrd2": { 131 | "title": "OLSRD2", 132 | "order": 20, 133 | "action": { 134 | "type": "firstchild", 135 | "recurse": true 136 | }, 137 | "auth": {} 138 | }, 139 | "public/status/olsrd2/overview": { 140 | "title": "Overview", 141 | "order": 4, 142 | "action": { 143 | "type": "view", 144 | "path": "olsrd2/overview" 145 | } 146 | }, 147 | "public/status/olsrd2/node": { 148 | "title": "Nodes", 149 | "order": 2, 150 | "action": { 151 | "type": "view", 152 | "path": "olsrd2/node" 153 | } 154 | }, 155 | "public/status/olsrd2/attachednetwork": { 156 | "title": "Attachednetwork", 157 | "order": 3, 158 | "action": { 159 | "type": "view", 160 | "path": "olsrd2/attachednetwork" 161 | } 162 | }, 163 | "public/status/olsrd2/neighbors": { 164 | "title": "Neighbors", 165 | "order": 1, 166 | "action": { 167 | "type": "view", 168 | "path": "olsrd2/neighbors" 169 | } 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /luci-app-olsrd2/root/usr/share/rpcd/acl.d/luci-app-olsrd2.json: -------------------------------------------------------------------------------- 1 | { 2 | "unauthenticated": { 3 | "description": "Allow system feature probing", 4 | "read": { 5 | "file": { 6 | "/www/luci-static/resources/view/olsrd2": [ "list" ] 7 | }, 8 | "ubus": { 9 | "status.olsrd2": [ "getVersion", "getLan", "getNode", "getNeighbors", "getAttached_network" ], 10 | "file": [ "list" ] 11 | 12 | } 13 | } 14 | }, 15 | "luci-app-olsrd2": { 16 | "description": "Grant UCI access for luci-app-olsrd2", 17 | "read": { 18 | "uci": [ "olsrd2" ], 19 | "ubus": { 20 | "status.olsrd2": [ "getVersion", "getLan", "getNode", "getNeighbors", "getAttached_network" ] 21 | } 22 | }, 23 | "write": { 24 | "uci": [ "olsrd2" ] 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /luci-app-olsrd2/root/usr/share/ucitrack/luci-app-olsrd2.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": "olsrd2", 3 | "init": "olsrd2" 4 | } 5 | -------------------------------------------------------------------------------- /mesh11sd/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-only 2 | # 3 | # This is free software, licensed under the GNU General Public License v2. 4 | # See /LICENSE for more information. 5 | # Copyright (C) 2022 - 2024 BlueWave Projects and Services 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=mesh11sd 11 | PKG_VERSION:=5.1.3 12 | PKG_RELEASE:=1 13 | 14 | PKG_MAINTAINER:=Rob White 15 | PKG_LICENSE:=GPL-2.0-or-later 16 | PKG_LICENSE_FILES:=LICENSE 17 | 18 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 19 | PKG_SOURCE_URL:=https://codeload.github.com/opennds/mesh11sd/tar.gz/v$(PKG_VERSION)? 20 | PKG_HASH:=aad1087b2b3e739293188896e1809727a9a4c4046aba2fb70f9d6d6042d92e9d 21 | 22 | include $(INCLUDE_DIR)/package.mk 23 | 24 | define Package/mesh11sd 25 | SUBMENU:=Captive Portals 26 | SECTION:=net 27 | CATEGORY:=Network 28 | TITLE:=Dynamic 802.11s Mesh Configuration Daemon 29 | PKGARCH:=all 30 | URL:=https://github.com/opennds/mesh11sd 31 | endef 32 | 33 | define Package/mesh11sd/description 34 | Mesh11sd is a package that autonomously configures and manages all aspects of an 802.11s mesh network and its connected nodes. 35 | The package acts as a service daemon, dynamically setting mesh parameters across all nodes. 36 | It is particularly useful for simplifying setup, reducing manual configuration, and improving network reliability. 37 | Support for point to multi-point vxlan tunneling over the wireless backhaul is included as standard. 38 | A guest/iot type network is auto-configured without requiring complex vlan setup. 39 | If required, custom vlan trunking over the vxlan tunnel is supported. 40 | Mesh-gate access point usage is collected in a central database on the mesh portal. 41 | A command line interface is provided for reporting in json format output. 42 | An optional Customer/Client Premises Equipment (CPE) mode, greatly simplifies rollout of community WISP projects. 43 | endef 44 | 45 | define Package/mesh11sd/install 46 | $(INSTALL_DIR) $(1)/usr/sbin 47 | $(INSTALL_DIR) $(1)/etc/config 48 | $(INSTALL_DIR) $(1)/etc/init.d 49 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mesh11sd $(1)/usr/sbin 50 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/linux_openwrt/mesh11sd/files/etc/config/mesh11sd $(1)/etc/config/ 51 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/linux_openwrt/mesh11sd/files/etc/init.d/mesh11sd $(1)/etc/init.d/ 52 | endef 53 | 54 | define Package/mesh11sd/conffiles 55 | /etc/config/mesh11sd 56 | endef 57 | 58 | define Build/Compile 59 | endef 60 | 61 | $(eval $(call BuildPackage,mesh11sd)) 62 | -------------------------------------------------------------------------------- /minimalist-pcproxy/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2014 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | 7 | include $(TOPDIR)/rules.mk 8 | 9 | PKG_NAME:=minimalist-pcproxy 10 | PKG_RELEASE:=7 11 | 12 | PKG_SOURCE_PROTO:=git 13 | PKG_SOURCE_URL:=https://github.com/fingon/minimalist-pcproxy.git 14 | PKG_SOURCE_DATE:=2014-12-12 15 | PKG_SOURCE_VERSION:=2d6d1b0b0a3b79a9b4a9b0a7606a84600a967bcb 16 | PKG_MIRROR_HASH:=26dcfe5fa2a4924a02830c243cf59d61055f43ec3df8eb77e86d74acf9ac034f 17 | 18 | PKG_MAINTAINER:=Markus Stenberg 19 | PKG_LICENSE:=BSD-3-Clause 20 | PKG_LICENSE_FILES:=LICENSE 21 | 22 | include $(INCLUDE_DIR)/package.mk 23 | include $(INCLUDE_DIR)/cmake.mk 24 | 25 | define Package/minimalist-pcproxy 26 | SECTION:=net 27 | CATEGORY:=Network 28 | TITLE:=Lightweight PCP proxy 29 | URL:=https://github.com/fingon/minimalist-pcproxy 30 | DEPENDS:=+libubox @IPV6 31 | endef 32 | 33 | define Package/minimalist-pcproxy/description 34 | This package contains a daemon which can be used to forward 35 | PCP (Port Control Protocol - RFC6887) requests requests to PCP remote servers. 36 | 37 | In and of itself, it is not very useful, but combined with hnetd+miniupnpd 38 | it allows for control of NAT forwarding and firewall pinholes from multiple 39 | hops away. 40 | endef 41 | 42 | define Package/minimalist-pcproxy/install 43 | $(INSTALL_DIR) $(1)/usr/sbin/ 44 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/minimalist-pcproxy $(1)/usr/sbin/ 45 | $(INSTALL_DIR) $(1)/etc/uci-defaults 46 | $(INSTALL_BIN) ./files/minimalist-pcproxy.defaults $(1)/etc/uci-defaults/x-minimalist-pcproxy.defaults 47 | endef 48 | 49 | define Package/minimalist-pcproxy/postinst 50 | #!/bin/sh 51 | [ -n "$${IPKG_INSTROOT}" ] || { 52 | (. /etc/uci-defaults/x-minimalist-pcproxy.defaults) && rm -f /etc/uci-defaults/x-minimalist-pcproxy.defaults 53 | } 54 | exit 0 55 | endef 56 | 57 | $(eval $(call BuildPackage,minimalist-pcproxy)) 58 | -------------------------------------------------------------------------------- /minimalist-pcproxy/files/minimalist-pcproxy.defaults: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "`uci -q get upnpd.config._pcproxy_configured`" = "1" ] 4 | then 5 | exit 6 | fi 7 | 8 | uci batch < 4 | # 5 | 6 | include $(TOPDIR)/rules.mk 7 | 8 | PKG_NAME:=naywatch 9 | PKG_VERSION:=1 10 | PKG_RELEASE:=7 11 | 12 | PKG_MAINTAINER:=Nick Hainke 13 | PKG_LICENSE:=GPL-2.0-only 14 | 15 | include $(INCLUDE_DIR)/package.mk 16 | 17 | define Package/naywatch 18 | SECTION:=utils 19 | CATEGORY:=Utilities 20 | TITLE:=Watchdog for IPv6 links 21 | PKGARCH:=all 22 | DEPENDS:=@IPV6 +owipcalc 23 | endef 24 | 25 | define Package/naywatch/description 26 | Reboots or triggers watchdog if no link-local neighbor is available. 27 | 28 | Important: 29 | Be careful when you do a sysupgrade. Stop naywatch first, and make 30 | sure procd took control again of the watchdog. 31 | You can do this using 'ubus call system watchdog'. Status should be "running". 32 | endef 33 | 34 | define Package/naywatch/conffiles 35 | /etc/config/naywatch 36 | endef 37 | 38 | define Build/Compile 39 | endef 40 | 41 | define Package/naywatch/install 42 | $(INSTALL_DIR) $(1)/etc/init.d 43 | $(INSTALL_BIN) ./files/naywatch.init $(1)/etc/init.d/naywatch 44 | $(INSTALL_DIR) $(1)/usr/bin 45 | $(INSTALL_BIN) ./files/naywatch.sh $(1)/usr/bin/naywatch 46 | $(INSTALL_DIR) $(1)/etc/config 47 | $(INSTALL_DATA) ./files/naywatch.config $(1)/etc/config/naywatch 48 | endef 49 | 50 | $(eval $(call BuildPackage,naywatch)) 51 | -------------------------------------------------------------------------------- /naywatch/files/naywatch.config: -------------------------------------------------------------------------------- 1 | config naywatch general 2 | option check_interval '50' 3 | option watchdog_timeout '60' 4 | option use_watchdog '0' 5 | option save_logs '1' 6 | list interface 'lan' 7 | list interface 'wan' 8 | list save_cmd 'dmesg' 9 | -------------------------------------------------------------------------------- /naywatch/files/naywatch.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | 3 | . /usr/share/libubox/jshn.sh 4 | 5 | USE_PROCD=1 6 | START=95 7 | STOP=01 8 | 9 | log() { 10 | local msg="$1" 11 | logger -t naywatch "$msg" 12 | } 13 | 14 | wait_for_network() 15 | { 16 | ubus -t 15 wait_for network.interface.$1 2>/dev/null 17 | } 18 | 19 | boot() 20 | { 21 | local _interfaces 22 | config_load naywatch 23 | config_get _interfaces general interface 24 | 25 | for interface in $_interfaces; do 26 | wait_for_network interface 27 | done 28 | 29 | rc_procd start_service 30 | } 31 | 32 | start_service() { 33 | procd_open_instance 34 | 35 | config_load naywatch 36 | local _check_interval 37 | local _watchdog_timeout 38 | local _use_watchdog 39 | local _save_logs 40 | local _interfaces 41 | 42 | config_get _check_interval general "check_interval" 43 | config_get _watchdog_timeout general "watchdog_timeout" 44 | config_get _use_watchdog general "use_watchdog" 45 | config_get _save_logs general "save_logs" 46 | config_get _interfaces general "interface" 47 | 48 | procd_set_param command /usr/bin/naywatch "$_check_interval" "$_watchdog_timeout" "$_use_watchdog" "$_save_logs" "$_interfaces" 49 | 50 | procd_set_param respawn 3600 15 0 51 | 52 | procd_set_param stdout 1 53 | procd_set_param stderr 1 54 | 55 | procd_close_instance 56 | } 57 | 58 | stop_service() { 59 | exec 3>&- # close file again 60 | sync && wait 61 | } 62 | 63 | watchdog_procd_runnig() { 64 | watch=$(ubus call system watchdog) 65 | json_load "$watch" 66 | json_get_var watchdogstatus status 67 | if [[ "$watchdogstatus" == "running" ]] ; then 68 | echo "1" 69 | return 70 | fi 71 | echo "0" 72 | } 73 | 74 | service_stopped() { 75 | log "Naywatch Stopped!" 76 | log "Try to handover watchdog to procd again." 77 | for i in 1 2 3 4 5 6 7 8 9 10 ; do 78 | sleep 5 79 | ubus call system watchdog '{"stop":false}' > /dev/null 80 | if [[ $(watchdog_procd_runnig) == "1" ]] ; then 81 | break 82 | fi 83 | done 84 | if [[ $(watchdog_procd_runnig) == "1" ]] ; then 85 | log "Handover sucessfully!" 86 | else 87 | log "Handover to procd failed! Device can reboot!" 88 | fi 89 | } 90 | -------------------------------------------------------------------------------- /naywatch/files/naywatch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . /lib/functions.sh 4 | . /lib/functions/network.sh 5 | 6 | CHECK_INTERVAL=$1 7 | shift 8 | WATCHDOG_TIMEOUT=$1 9 | shift 10 | USE_WATCHDOG=$1 11 | shift 12 | SAVE_LOGS=$1 13 | shift 14 | INTERFACES="$*" 15 | 16 | ACTIVE=0 17 | NO_NEIGHBORS_COUNT=0 18 | MIN_KICK=5 19 | 20 | log() { 21 | local msg="$1" 22 | logger -t naywatch "$msg" 23 | } 24 | 25 | write_logs() { 26 | save_log() { 27 | eval $1 > /root/$(date +%s)-"$1".log 28 | } 29 | config_load naywatch 30 | config_list_foreach general save_cmd save_log 31 | sync 32 | } 33 | 34 | neighbors_available() { 35 | local phy 36 | 37 | for interface in $INTERFACES; do 38 | network_get_physdev phy $interface > /dev/null 2>&1 39 | linklocal=$(ip -6 a list dev $phy | grep "scope link" | awk '{print $2}' | sed 's/\/64//') 2> /dev/null 40 | ips=$(ping ff02::1%$phy -w5 -W5 -c2 | awk '/from/{print($4)}' | sed 's/.$//') 2> /dev/null 41 | for ip in $ips; do 42 | if [ $ip != $linklocal ] && [ $(owipcalc $ip linklocal) -eq 1 ]; then 43 | echo 1 44 | return 0 45 | fi 46 | done 47 | done 48 | 49 | echo 0 50 | } 51 | 52 | activate_watchdog() { 53 | # disable openwrt instrumentation: 54 | ubus call system watchdog '{"magicclose":true,"stop":true,"timeout":'${WATCHDOG_TIMEOUT}'}' > /dev/null 55 | exec 3>/dev/watchdog 56 | } 57 | 58 | reboot_now() { 59 | # copied from watch-cat 60 | reboot & 61 | 62 | [ "$1" -ge 1 ] && { 63 | sleep "$1" 64 | echo 1 >/proc/sys/kernel/sysrq 65 | echo b >/proc/sysrq-trigger 66 | } 67 | } 68 | 69 | no_neighbors() { 70 | log "No Neighbors Available!" 71 | 72 | NO_NEIGHBORS_COUNT=$(($NO_NEIGHBORS_COUNT+1)) 73 | 74 | if [ $ACTIVE -eq 0 ]; then 75 | return 0 76 | fi 77 | 78 | if [ $SAVE_LOGS -eq 1 ]; then 79 | log "Saving Logs!" 80 | write_logs 81 | fi 82 | 83 | if [ $USE_WATCHDOG -eq 0 ] && [ $NO_NEIGHBORS_COUNT -gt $MIN_KICK ]; then 84 | reboot_now 10 85 | fi 86 | } 87 | 88 | log "Naywatch Started!" 89 | 90 | neighbors() { 91 | if [ $ACTIVE -eq 0 ]; then 92 | log "Naywatch Activated!" 93 | fi 94 | ACTIVE=1 95 | NO_NEIGHBORS_COUNT=0 96 | if [ $USE_WATCHDOG -eq 1 ]; then 97 | echo 1 >&3 98 | fi 99 | } 100 | 101 | not_active() { 102 | if [ $USE_WATCHDOG -eq 1 ]; then 103 | echo 1 >&3 104 | fi 105 | } 106 | 107 | if [ $USE_WATCHDOG -eq 1 ]; then 108 | activate_watchdog 109 | fi 110 | 111 | while [ 1 ]; do 112 | # first sleep 113 | sleep $CHECK_INTERVAL 114 | 115 | has_neighbor=$(neighbors_available) 116 | if [ $has_neighbor -eq 0 ] && [ $ACTIVE -eq 1 ]; then 117 | no_neighbors 118 | elif [ $has_neighbor -eq 1 ]; then 119 | neighbors 120 | else 121 | not_active 122 | fi 123 | done 124 | 125 | exit 0 126 | -------------------------------------------------------------------------------- /ndppd/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2007-2011 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=ndppd 11 | PKG_VERSION:=0.2.6 12 | PKG_RELEASE:=1 13 | 14 | # Latest release 15 | PKG_SOURCE_URL:=https://codeload.github.com/DanielAdolfsson/ndppd/tar.gz/$(PKG_VERSION)? 16 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 17 | PKG_HASH:=969d438462e0c65a8c9060d8d263c5c47ba8145fb9aaa663864bbad11ad7eb7a 18 | PKG_LICENSE:=GPL-3.0-or-later 19 | 20 | # Development snapshot 21 | #PKG_SOURCE_URL=git://github.com/DanielAdolfsson/ndppd.git 22 | #PKG_SOURCE_VERSION=master 23 | #PKG_SOURCE_SUBDIR=$(PKG_NAME)-$(PKG_VERSION) 24 | 25 | include $(INCLUDE_DIR)/package.mk 26 | 27 | define Package/ndppd 28 | SECTION:=net 29 | CATEGORY:=Network 30 | TITLE:=NDP Proxy Daemon 31 | URL:=http://www.priv.nu/projects/ndppd/ 32 | MAINTAINER:=Gabriel Kerneis 33 | DEPENDS:=@IPV6 +libstdcpp 34 | endef 35 | 36 | define Package/ndppd/description 37 | ndppd, or NDP Proxy Daemon, is a daemon that proxies NDP (Neighbor Discovery 38 | Protocol) messages between interfaces. ndppd currently only supports Neighbor 39 | Solicitation Messages and Neighbor Advertisement Messages. 40 | 41 | The ndp_proxy provided by Linux doesn't support listing proxies, and only hosts 42 | are supported. No subnets. ndppd solves this by listening for Neighbor 43 | Solicitation messages on an interface, then query the internal interfaces for 44 | that target IP before finally sending a Neighbor Advertisement message. 45 | endef 46 | 47 | define Package/ndppd/conffiles 48 | /etc/ndppd.conf 49 | endef 50 | 51 | define Build/Compile 52 | $(MAKE) -C $(PKG_BUILD_DIR) \ 53 | CXX="$(TARGET_CXX)" \ 54 | CXXFLAGS="$(TARGET_CXXFLAGS) -std=c++0x -fno-rtti" \ 55 | LDFLAGS="$(TARGET_LDFLAGS)" \ 56 | LIBS="-lc" \ 57 | ndppd 58 | endef 59 | 60 | define Package/ndppd/install 61 | $(INSTALL_DIR) $(1)/usr/sbin 62 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/ndppd $(1)/usr/sbin/ 63 | $(INSTALL_DIR) $(1)/etc/init.d 64 | $(INSTALL_BIN) ./files/ndppd.init $(1)/etc/init.d/ndppd 65 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/ndppd.conf-dist $(1)/etc/ndppd.conf 66 | endef 67 | 68 | $(eval $(call BuildPackage,ndppd)) 69 | -------------------------------------------------------------------------------- /ndppd/files/ndppd.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2007-2011 OpenWrt.org 3 | 4 | START=90 5 | 6 | SERVICE_USE_PID=1 7 | SERVICE_PID_FILE=/var/run/ndppd.pid 8 | 9 | start() { 10 | mkdir -p /var/run 11 | service_start /usr/sbin/ndppd -p $SERVICE_PID_FILE -d 12 | } 13 | 14 | stop() { 15 | service_stop /usr/sbin/ndppd 16 | } 17 | -------------------------------------------------------------------------------- /ndppd/patches/0001-Version-bump.patch: -------------------------------------------------------------------------------- 1 | From 715f9f330d8606d4a7b68900325f9b1455dd5368 Mon Sep 17 00:00:00 2001 2 | From: Rafael Cossovan 3 | Date: Tue, 3 Apr 2018 17:06:16 -0300 4 | Subject: [PATCH 1/3] Forgot to bump the version. 5 | 6 | --- 7 | src/ndppd.h | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | --- a/src/ndppd.h 11 | +++ b/src/ndppd.h 12 | @@ -21,7 +21,7 @@ 13 | #define NDPPD_NS_BEGIN namespace ndppd { 14 | #define NDPPD_NS_END } 15 | 16 | -#define NDPPD_VERSION "0.2.4" 17 | +#define NDPPD_VERSION "0.2.6" 18 | 19 | #include 20 | 21 | -------------------------------------------------------------------------------- /ndppd/patches/0002-Fixes-strerror_r-GNU-XSI.patch: -------------------------------------------------------------------------------- 1 | From 1f610129b475b417509b251e022ad46d2210ff50 Mon Sep 17 00:00:00 2001 2 | From: Rafael Cossovan 3 | Date: Tue, 3 Apr 2018 17:04:35 -0300 4 | Subject: [PATCH 2/3] Fixes strerror_r GNU/XSI issue #40. 5 | http://www.zverovich.net/2015/03/13/reliable-detection-of-strerror-variants.html 6 | 7 | --- 8 | src/logger.cc | 14 ++++++++++++- 9 | src/logger.h | 3 +++ 10 | 2 files changed, 15 insertions(+), 1 deletions(-) 11 | 12 | --- a/src/logger.cc 13 | +++ b/src/logger.cc 14 | @@ -89,7 +89,7 @@ std::string logger::err() 15 | return "Unknown error"; 16 | return buf; 17 | #else 18 | - return strerror_r(errno, buf, sizeof(buf)); 19 | + return strerror_r_wrapper(strerror_r(errno, buf, sizeof(buf)), buf); 20 | #endif 21 | } 22 | 23 | @@ -228,4 +228,16 @@ bool logger::verbosity(const std::string 24 | return false; 25 | } 26 | 27 | +// XSI-compliant: int 28 | +std::string logger::strerror_r_wrapper(int, char* s) 29 | +{ 30 | + return s; 31 | +} 32 | + 33 | +// GNU-specific: char * 34 | +std::string logger::strerror_r_wrapper(char* s, char*) 35 | +{ 36 | + return s; 37 | +} 38 | + 39 | NDPPD_NS_END 40 | --- a/src/logger.h 41 | +++ b/src/logger.h 42 | @@ -91,6 +91,9 @@ private: 43 | 44 | static int _max_pri; 45 | 46 | + // helpers for strerror_r 47 | + static std::string strerror_r_wrapper(int, char* s); 48 | + static std::string strerror_r_wrapper(char* s, char*); 49 | 50 | }; 51 | 52 | -------------------------------------------------------------------------------- /ndppd/patches/0003-fix-poll-header.patch: -------------------------------------------------------------------------------- 1 | From 88b9bc561ce42f2eb97ea041cd8920797b44dd53 Mon Sep 17 00:00:00 2001 2 | From: Rafael Cossovan 3 | Date: Tue, 3 Apr 2018 17:05:42 -0300 4 | Subject: [PATCH 3/3] Fixes a compile warning when building with musl: #warning 5 | redirecting incorrect #include to 6 | 7 | --- 8 | src/iface.cc | 2 +- 9 | src/iface.h | 2 +- 10 | src/proxy.h | 2 +- 11 | src/rule.h | 2 +- 12 | 4 files changed, 4 insertions(+), 4 deletions(-) 13 | 14 | --- a/src/iface.cc 15 | +++ b/src/iface.cc 16 | @@ -30,7 +30,7 @@ 17 | #include 18 | #include 19 | #include 20 | -#include 21 | +#include 22 | 23 | #include 24 | 25 | --- a/src/iface.h 26 | +++ b/src/iface.h 27 | @@ -20,7 +20,7 @@ 28 | #include 29 | #include 30 | 31 | -#include 32 | +#include 33 | #include 34 | 35 | #include "ndppd.h" 36 | --- a/src/proxy.h 37 | +++ b/src/proxy.h 38 | @@ -19,7 +19,7 @@ 39 | #include 40 | #include 41 | 42 | -#include 43 | +#include 44 | 45 | #include "ndppd.h" 46 | 47 | --- a/src/rule.h 48 | +++ b/src/rule.h 49 | @@ -20,7 +20,7 @@ 50 | #include 51 | #include 52 | 53 | -#include 54 | +#include 55 | 56 | #include "ndppd.h" 57 | 58 | -------------------------------------------------------------------------------- /nodogsplash/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is free software, licensed under the GNU General Public License v2. 3 | # See /LICENSE for more information. 4 | # 5 | 6 | include $(TOPDIR)/rules.mk 7 | 8 | PKG_NAME:=nodogsplash 9 | PKG_VERSION:=5.0.2 10 | PKG_RELEASE:=1 11 | 12 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 13 | PKG_SOURCE_URL:=https://codeload.github.com/nodogsplash/nodogsplash/tar.gz/v$(PKG_VERSION)? 14 | PKG_HASH:=908d3674e93726fdcefb4c3b6705c745753435df9d46425781a57e3f6b417797 15 | 16 | PKG_MAINTAINER:=Moritz Warning 17 | PKG_LICENSE:=GPL-2.0-or-later 18 | PKG_LICENSE_FILES:=COPYING 19 | 20 | PKG_FIXUP:=autoreconf 21 | PKG_BUILD_PARALLEL:=1 22 | 23 | include $(INCLUDE_DIR)/package.mk 24 | 25 | define Package/nodogsplash 26 | SUBMENU:=Captive Portals 27 | SECTION:=net 28 | CATEGORY:=Network 29 | DEPENDS:=+libpthread +libmicrohttpd-no-ssl +iptables-nft \ 30 | +iptables-mod-nat-extra +iptables-mod-ipopt \ 31 | +iptables-mod-conntrack-extra 32 | TITLE:=Open public network gateway daemon 33 | URL:=https://github.com/nodogsplash/nodogsplash 34 | endef 35 | 36 | define Package/nodogsplash/description 37 | Nodogsplash is a Captive Portal that offers a simple way to 38 | provide restricted access to the Internet by showing a splash 39 | page to the user before Internet access is granted. 40 | endef 41 | 42 | define Package/nodogsplash/install 43 | $(INSTALL_DIR) $(1)/usr/lib/nodogsplash 44 | $(INSTALL_BIN) ./files/usr/lib/nodogsplash/restart.sh $(1)/usr/lib/nodogsplash/ 45 | $(INSTALL_DIR) $(1)/usr/bin 46 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/nodogsplash $(1)/usr/bin/ 47 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/ndsctl $(1)/usr/bin/ 48 | $(INSTALL_DIR) $(1)/etc/nodogsplash/htdocs/ 49 | $(INSTALL_DATA) $(PKG_BUILD_DIR)/resources/splash.html $(1)/etc/nodogsplash/htdocs/ 50 | $(INSTALL_DATA) $(PKG_BUILD_DIR)/resources/splash.css $(1)/etc/nodogsplash/htdocs/ 51 | $(INSTALL_DATA) $(PKG_BUILD_DIR)/resources/status.html $(1)/etc/nodogsplash/htdocs/ 52 | $(INSTALL_DIR) $(1)/etc/nodogsplash/htdocs/images 53 | $(INSTALL_DATA) $(PKG_BUILD_DIR)/resources/splash.jpg $(1)/etc/nodogsplash/htdocs/images/ 54 | $(INSTALL_DIR) $(1)/etc/config 55 | $(INSTALL_CONF) ./files/etc/config/nodogsplash $(1)/etc/config/ 56 | $(INSTALL_DIR) $(1)/etc/init.d 57 | $(INSTALL_BIN) ./files/etc/init.d/nodogsplash $(1)/etc/init.d/ 58 | $(INSTALL_DIR) $(1)/etc/uci-defaults 59 | $(INSTALL_BIN) ./files/etc/uci-defaults/40_nodogsplash $(1)/etc/uci-defaults/ 60 | endef 61 | 62 | define Package/nodogsplash/postrm 63 | #!/bin/sh 64 | uci delete firewall.nodogsplash 65 | uci commit firewall 66 | endef 67 | 68 | define Package/nodogsplash/conffiles 69 | /etc/config/nodogsplash 70 | endef 71 | 72 | $(eval $(call BuildPackage,nodogsplash)) 73 | -------------------------------------------------------------------------------- /nodogsplash/files/etc/uci-defaults/40_nodogsplash: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | uci -q batch <<-EOF 4 | delete firewall.nodogsplash 5 | set firewall.nodogsplash=include 6 | set firewall.nodogsplash.type=script 7 | set firewall.nodogsplash.path=/usr/lib/nodogsplash/restart.sh 8 | commit firewall 9 | EOF 10 | -------------------------------------------------------------------------------- /nodogsplash/files/usr/lib/nodogsplash/restart.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check if nodogsplash is running 4 | if ndsctl status &> /dev/null; then 5 | if [ "$(uci -q get nodogsplash.@nodogsplash[0].fwhook_enabled)" = "1" ]; then 6 | /etc/init.d/nodogsplash restart 7 | fi 8 | fi 9 | -------------------------------------------------------------------------------- /ohybridproxy/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2012-2013 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | 7 | include $(TOPDIR)/rules.mk 8 | 9 | PKG_NAME:=ohybridproxy 10 | PKG_SOURCE_VERSION:=0dfef1eb5f067250a5f24a899536879ea4fdc4c5 11 | PKG_SOURCE_DATE:=2020-05-22 12 | PKG_RELEASE:=3 13 | 14 | PKG_SOURCE_PROTO:=git 15 | PKG_SOURCE_URL:=https://github.com/sbyx/ohybridproxy.git 16 | PKG_MIRROR_HASH:=378559afd98a4336f327fde981e55167e988dc5ab7a19773c8ef24aa7fca0689 17 | 18 | PKG_MAINTAINER:=Steven Barth 19 | PKG_LICENSE:=GPL-2.0-only 20 | PKG_LICENSE_FILES:=LICENSE 21 | 22 | PKG_BUILD_PARALLEL:=1 23 | 24 | include $(INCLUDE_DIR)/package.mk 25 | include $(INCLUDE_DIR)/cmake.mk 26 | 27 | define Package/ohybridproxy 28 | SECTION:=net 29 | CATEGORY:=Network 30 | SUBMENU:=IP Addresses and Names 31 | TITLE:=mdns/dns hybrid-proxy 32 | URL:=https://github.com/sbyx/ohybridproxy 33 | DEPENDS+=+libubox +mdnsd 34 | endef 35 | 36 | define Package/ohybridproxy/description 37 | This package provides a statically configured daemon for translating DNS 38 | requests to Multicast DNS and back again. 39 | endef 40 | 41 | define Package/ohybridproxy/install 42 | $(INSTALL_DIR) $(1)/usr/sbin/ 43 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/ohybridproxy $(1)/usr/sbin/ 44 | $(INSTALL_DIR) $(1)/etc/config/ 45 | $(INSTALL_DATA) ./files/ohybridproxy.config $(1)/etc/config/ohybridproxy 46 | $(INSTALL_DIR) $(1)/etc/init.d/ 47 | $(INSTALL_BIN) ./files/ohybridproxy.init $(1)/etc/init.d/ohybridproxy 48 | $(INSTALL_DIR) $(1)/etc/hotplug.d/iface 49 | $(INSTALL_DATA) ./files/ohybridproxy.hotplug $(1)/etc/hotplug.d/iface/ohybridproxy 50 | endef 51 | 52 | $(eval $(call BuildPackage,ohybridproxy)) 53 | 54 | define Package/zonestitcher 55 | SECTION:=net 56 | CATEGORY:=Network 57 | SUBMENU:=IP Addresses and Names 58 | TITLE:=dynamically combine multiple DNS zones into one 59 | URL:=https://github.com/sbyx/ohybridproxy 60 | DEPENDS+=+libubox 61 | endef 62 | 63 | define Package/zonestitcher/description 64 | This package provides a statically configured daemon for translating DNS 65 | requests to Multicast DNS and back again. 66 | endef 67 | 68 | define Package/zonestitcher/install 69 | $(INSTALL_DIR) $(1)/usr/sbin/ 70 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/zonestitcher $(1)/usr/sbin/ 71 | endef 72 | 73 | $(eval $(call BuildPackage,zonestitcher)) 74 | -------------------------------------------------------------------------------- /ohybridproxy/files/ohybridproxy.config: -------------------------------------------------------------------------------- 1 | config main main 2 | option host '::' 3 | option port '53' 4 | 5 | #config interface 6 | # option interface lan 7 | # option domain lan.home. 8 | -------------------------------------------------------------------------------- /ohybridproxy/files/ohybridproxy.hotplug: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | /etc/init.d/ohybridproxy enabled || exit 0 3 | [ "$ACTION" = ifupdate ] && exit 0 4 | /etc/init.d/ohybridproxy restart 5 | -------------------------------------------------------------------------------- /ohybridproxy/files/ohybridproxy.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2009-2014 OpenWrt.org 3 | 4 | START=60 5 | STOP=10 6 | USE_PROCD=1 7 | 8 | HAS_IFACES= 9 | 10 | service_triggers() 11 | { 12 | procd_add_reload_trigger "ohybridproxy" 13 | } 14 | 15 | ohp_interface() 16 | { 17 | local section="$1" 18 | config_get interface "$section" interface 19 | config_get domain "$section" domain 20 | 21 | [ -n "$interface" ] && network_get_device interface "$interface" 22 | if [ -n "$interface" -a -n "$domain" ]; then 23 | procd_append_param command "$interface=$domain" 24 | HAS_IFACES=1 25 | fi 26 | } 27 | 28 | start_service() 29 | { 30 | . /lib/functions.sh 31 | . /lib/functions/network.sh 32 | 33 | procd_open_instance 34 | procd_set_param command /usr/sbin/ohybridproxy 35 | 36 | config_load ohybridproxy 37 | 38 | config_get val main host 39 | [ -n "$val" ] && procd_append_param command -a "${val}" 40 | 41 | config_get val main port 42 | [ -n "$val" ] && procd_append_param command -p "${val}" 43 | 44 | config_foreach ohp_interface interface 45 | 46 | [ "$HAS_IFACES" = 1 ] || return 0 47 | 48 | procd_close_instance 49 | } 50 | 51 | -------------------------------------------------------------------------------- /olsrd/files/olsrd-neigh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . /usr/share/libubox/jshn.sh 4 | 5 | hostsfile_getname() 6 | { 7 | local config="$1" 8 | local i=0 9 | local value file 10 | 11 | while value="$( uci -q get $config.@LoadPlugin[$i].library )"; do { 12 | case "$value" in 13 | 'olsrd_nameservice'*) 14 | file="$( uci -q get $config.@LoadPlugin[$i].hosts_file )" 15 | break 16 | ;; 17 | esac 18 | 19 | i=$(( i + 1 )) 20 | } done 21 | 22 | echo "${file:-/var/run/hosts_olsr}" 23 | } 24 | 25 | read_hostnames() 26 | { 27 | local file_list=" $( hostsfile_getname 'olsrd' ) $(hostsfile_getname 'olsrd6' ) " 28 | local line ip hostname file file_list_uniq 29 | 30 | for file in $file_list; do { 31 | case " $file_list_uniq " in 32 | *" $file "*) 33 | ;; 34 | *) 35 | file_list_uniq="$file_list_uniq $file" 36 | ;; 37 | esac 38 | } done 39 | 40 | for file in $file_list_uniq; do { 41 | [ -e "$file" ] || continue 42 | 43 | while read -r line; do { 44 | case "$line" in 45 | [0-9]*) 46 | # 2001:ffff:ffff:ffff::1 SomeNode-core.olsr # myself 47 | # 10.0.0.1 SomeNode # 10.0.0.1 48 | set -f 49 | set +f -- $line 50 | ip="$1" 51 | hostname="$2" 52 | 53 | # global vars, e.g. 54 | # IP_1_2_3_4='foo' or IP_2001_ffff_ffff_ffff__1='bar' 55 | eval IP_${ip//[.:]/_}="$hostname" 56 | ;; 57 | esac 58 | } done <"$file" 59 | } done 60 | } 61 | 62 | read_hostnames 63 | 64 | VARS='localIP:Local remoteIP:Remote validityTime:vTime linkQuality:LQ' 65 | VARS="$VARS neighborLinkQuality:NLQ linkCost:Cost remoteHostname:Host" 66 | 67 | for HOST in '127.0.0.1' '::1';do 68 | # check for availability of HOST 69 | nc $HOST 9090 >/dev/null 2>&1 70 | if [ $? != 0 ]; then 71 | continue 72 | fi 73 | 74 | json_init 75 | json_load "$( echo /links | nc $HOST 9090 | sed -n '/^[}{ ]/p' )" # remove header/non-json 76 | 77 | if json_is_a links array;then 78 | json_select links 79 | for v in ${VARS};do 80 | eval _${v%:*}=0 81 | done 82 | for j in 0 1;do 83 | case ${j} in 1) 84 | for v in ${VARS};do 85 | eval printf \"%-\${_${v%:*}}s \" ${v#*:} 86 | done 87 | echo 88 | ;;esac 89 | i=1;while json_is_a ${i} object;do 90 | json_select ${i} 91 | json_get_vars $(for v in ${VARS};do echo ${v%:*};done) 92 | case ${j} in 0) 93 | for v in ${VARS};do 94 | eval "test \${_${v%:*}} -lt \${#${v%:*}} && _${v%:*}=\${#${v%:*}}" 95 | done 96 | ;;*) 97 | for v in ${VARS};do 98 | eval printf \"%-\${_${v%:*}}s \" \$${v%:*} 99 | eval remoteHostname="\$IP_${remoteIP//[.:]/_}" 100 | done 101 | echo 102 | ;;esac 103 | json_select .. 104 | i=$(( i + 1 )) 105 | done 106 | done 107 | fi 108 | echo 109 | done 110 | -------------------------------------------------------------------------------- /olsrd/files/olsrd.config: -------------------------------------------------------------------------------- 1 | config olsrd 2 | # uncomment the following line to use a custom config file instead: 3 | #option config_file '/etc/olsrd.conf' 4 | 5 | config LoadPlugin 6 | option library 'olsrd_arprefresh.so.0.1' 7 | 8 | config LoadPlugin 9 | option library 'olsrd_dyn_gw.so.0.5' 10 | 11 | config LoadPlugin 12 | option library 'olsrd_httpinfo.so.0.1' 13 | option port '1978' 14 | list Net '0.0.0.0 0.0.0.0' 15 | 16 | config LoadPlugin 17 | option library 'olsrd_nameservice.so.0.4' 18 | 19 | config LoadPlugin 20 | option library 'olsrd_txtinfo.so.1.1' 21 | option accept '0.0.0.0' 22 | 23 | config Interface 24 | list interface 'wlan' 25 | 26 | config procd procd 27 | option respawn_threshold '3600' 28 | option respawn_timeout '15' 29 | option respawn_retry '0' 30 | -------------------------------------------------------------------------------- /olsrd/files/olsrd.pud.position.conf: -------------------------------------------------------------------------------- 1 | # 2 | # OLSrd PUD plugin position configuration file 3 | # 4 | 5 | # GPS operating mode. 6 | # Values : bad, 2d, 3d 7 | # Default: bad 8 | # Note : a value of 'bad' will make the resulting position information invalid 9 | # (the mask will indicate that all other information is not present) 10 | #fix = bad 11 | 12 | # GPS quality indicator. 13 | # Values : bad, low, mid, high 14 | # Default: high 15 | #sig = high 16 | 17 | # HDOP (Horizontal Dilution Of Precision) 18 | # Values : floating point value 19 | # Default: 0.0 20 | # Note : From HDOP, VDOP and PDOP are determined: VDOP = HDOP, and PDOP = sqrt(2) * HDOP. 21 | #hdop = 0.0 22 | 23 | # Latitude 24 | # Values : floating point value 25 | # Unit is NMEA like latitude: ddmm.sssss (d=degrees, m=minutes, s=seconds) 26 | # Default: 0000.00000 27 | #lat = 0000.00000 28 | 29 | # Longitude 30 | # Values: floating point value 31 | # Unit is NMEA like longitude: dddmm.sssss (d=degrees, m=minutes, s=seconds) 32 | # Default: 00000.00000 33 | #lon = 00000.00000 34 | 35 | # Elevation 36 | # Values: floating point value 37 | # Unit is meters above the mean sea level (geoid) 38 | # Default: 0.0 39 | #elv = 0.0 40 | 41 | # Speed 42 | # Values: floating point value 43 | # Unit is over the ground in kph 44 | # Default: 0.0 45 | #speed = 0.0 46 | 47 | # Direction/Track 48 | # Values: floating point value 49 | # Unit is (compass) degrees 50 | # Default: 0.0 51 | #direction = 0.0 52 | -------------------------------------------------------------------------------- /olsrd/files/olsrd.sgw.speed.conf: -------------------------------------------------------------------------------- 1 | # 2 | # OLSrd Smart Gateway uplink speed configuration file 3 | # 4 | 5 | 6 | # 7 | # Upstream speed in kilobit/s 8 | # Default: 128 9 | #upstream=128 10 | 11 | # 12 | # Downstream speed in kilobit/s 13 | # Default: 1024 14 | #downstream=1024 15 | -------------------------------------------------------------------------------- /olsrd/files/olsrd4.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2008-2013 OpenWrt.org 3 | 4 | . $IPKG_INSTROOT/lib/functions/olsrd.sh 5 | 6 | START=65 7 | USE_PROCD=1 8 | BIN=/usr/sbin/olsrd 9 | OLSRD=olsrd 10 | CONF=/var/etc/$OLSRD.conf 11 | PID=/var/run/olsrd.pid 12 | 13 | wait_for_network() 14 | { 15 | ubus -t 15 wait_for network.interface.$1 2>/dev/null 16 | } 17 | 18 | wait_for_wireless() 19 | { 20 | local count=0 21 | ubus -t 15 wait_for network.wireless 2>/dev/null 22 | while [ $count -lt 30 ]; do 23 | if [ "$(ubus call network.wireless status | jsonfilter -e '@[*]["pending"]' | grep true | wc -l)" == "0" ]; then 24 | break 25 | fi 26 | count=$((count+1)) 27 | sleep 1 28 | done 29 | } 30 | 31 | boot() 32 | { 33 | config_load network 34 | config_foreach wait_for_network interface 35 | wait_for_wireless 36 | rc_procd start_service 37 | } 38 | 39 | start_service() { 40 | olsrd_generate_config $OLSRD 41 | 42 | procd_open_instance 43 | 44 | config_load olsrd 45 | local _respawn_threshold 46 | local _respawn_timeout 47 | local _respawn_retry 48 | 49 | config_get _respawn_threshold procd respawn_threshold 3600 50 | config_get _respawn_timeout procd respawn_timeout 15 51 | config_get _respawn_retry procd respawn_retry 0 52 | 53 | procd_set_param command "$BIN" 54 | procd_append_param command -f ${CONF} 55 | procd_append_param command -nofork 56 | procd_append_param command -pidfile ${PID} 57 | 58 | # restart if olsrd dies 59 | procd_set_param respawn $_respawn_threshold $_respawn_timeout $_respawn_retry 60 | 61 | # automatically restart olsrd if generated cfg has changed 62 | procd_set_param file $CONF 63 | 64 | procd_set_param pidfile $PID 65 | 66 | procd_close_instance 67 | 68 | olsrd_setup_smartgw_rules 69 | } 70 | 71 | service_triggers() { 72 | # reload if config changed via uci 73 | procd_add_reload_trigger "olsrd" 74 | 75 | # restart on ifup interface events 76 | for n in $(olsrd_list_configured_interfaces $OLSRD); do 77 | procd_add_reload_interface_trigger $n /etc/init.d/$OLSRD reload 78 | done 79 | } 80 | -------------------------------------------------------------------------------- /olsrd/files/olsrd6.config: -------------------------------------------------------------------------------- 1 | config olsrd 2 | # uncomment the following line to use a custom config file instead: 3 | #option config_file '/etc/olsrd6.conf' 4 | 5 | config LoadPlugin 6 | option library 'olsrd_txtinfo.so.1.1' 7 | option accept '::' 8 | option port '2007' 9 | 10 | config Interface 11 | list interface 'wlan' 12 | 13 | config procd procd 14 | option respawn_threshold '3600' 15 | option respawn_timeout '15' 16 | option respawn_retry '0' 17 | -------------------------------------------------------------------------------- /olsrd/files/olsrd6.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2008-2013 OpenWrt.org 3 | 4 | . $IPKG_INSTROOT/lib/functions/olsrd.sh 5 | 6 | START=65 7 | USE_PROCD=1 8 | BIN=/usr/sbin/olsrd 9 | OLSRD=olsrd6 10 | CONF=/var/etc/$OLSRD.conf 11 | PID=/var/run/olsrd6.pid 12 | 13 | wait_for_network() 14 | { 15 | ubus -t 15 wait_for network.interface.$1 2>/dev/null 16 | } 17 | 18 | wait_for_wireless() 19 | { 20 | local count=0 21 | ubus -t 15 wait_for network.wireless 2>/dev/null 22 | while [ $count -lt 30 ]; do 23 | if [ "$(ubus call network.wireless status | jsonfilter -e '@[*]["pending"]' | grep true | wc -l)" == "0" ]; then 24 | break 25 | fi 26 | count=$((count+1)) 27 | sleep 1 28 | done 29 | } 30 | 31 | boot() 32 | { 33 | config_load network 34 | config_foreach wait_for_network interface 35 | wait_for_wireless 36 | rc_procd start_service 37 | } 38 | 39 | start_service() { 40 | olsrd_generate_config $OLSRD 41 | 42 | procd_open_instance 43 | 44 | config_load olsrd6 45 | local _respawn_threshold 46 | local _respawn_timeout 47 | local _respawn_retry 48 | 49 | config_get _respawn_threshold procd _respawn_threshold 3600 50 | config_get _respawn_timeout procd respawn_timeout 15 51 | config_get _respawn_retry procd respawn_retry 0 52 | 53 | procd_set_param command "$BIN" 54 | procd_append_param command -f ${CONF} 55 | procd_append_param command -nofork 56 | procd_append_param command -pidfile ${PID} 57 | 58 | # restart if olsrd dies 59 | procd_set_param respawn $_respawn_threshold $_respawn_timeout $_respawn_retry 60 | 61 | # automatically restart olsrd if generated cfg has changed 62 | procd_set_param file $CONF 63 | 64 | procd_set_param pidfile $PID 65 | 66 | procd_close_instance 67 | 68 | olsrd_setup_smartgw_rules 69 | } 70 | 71 | service_triggers() { 72 | # reload if config changed via uci 73 | procd_add_reload_trigger "olsrd6" 74 | 75 | # restart on ifup interface events 76 | for n in $(olsrd_list_configured_interfaces $OLSRD); do 77 | procd_add_reload_interface_trigger $n /etc/init.d/$OLSRD reload 78 | done 79 | } 80 | -------------------------------------------------------------------------------- /olsrd/files/olsrd_secure_key: -------------------------------------------------------------------------------- 1 | 1234567890123456 -------------------------------------------------------------------------------- /olsrd/patches/102-olsrd-prevent-storm-patches.patch: -------------------------------------------------------------------------------- 1 | From 4dabd94d598dd893aaaffbd71c315923c8827a14 Mon Sep 17 00:00:00 2001 2 | From: Nick Hainke 3 | Date: Wed, 22 Jun 2022 14:08:04 +0200 4 | Subject: [PATCH] olsrd: prevent storm patches 5 | 6 | As described in the PR: 7 | 8 | Limit the positive sequence number difference which is considered valid, 9 | and prevent network storms. 10 | Source: https://github.com/aredn/aredn_packages/pull/5 11 | 12 | Signed-off-by: Nick Hainke 13 | --- 14 | src/duplicate_set.c | 16 ++++++++-------- 15 | src/duplicate_set.h | 5 +++-- 16 | 2 files changed, 11 insertions(+), 10 deletions(-) 17 | 18 | --- a/src/duplicate_set.c 19 | +++ b/src/duplicate_set.c 20 | @@ -70,7 +70,7 @@ void olsr_cleanup_duplicates(union olsr_ 21 | 22 | entry = (struct dup_entry *)olsrd_avl_find(&duplicate_set, orig); 23 | if (entry != NULL) { 24 | - entry->too_low_counter = DUP_MAX_TOO_LOW - 2; 25 | + entry->out_of_bounds_counter = DUP_MAX_OUT_OF_BOUNDS - 2; 26 | } 27 | } 28 | 29 | @@ -82,7 +82,7 @@ olsr_create_duplicate_entry(void *ip, ui 30 | if (entry != NULL) { 31 | memcpy(&entry->ip, ip, olsr_cnf->ip_version == AF_INET ? sizeof(entry->ip.v4) : sizeof(entry->ip.v6)); 32 | entry->seqnr = seqnr; 33 | - entry->too_low_counter = 0; 34 | + entry->out_of_bounds_counter = 0; 35 | entry->olsrd_avl.key = &entry->ip; 36 | entry->array = 0; 37 | } 38 | @@ -160,12 +160,12 @@ olsr_message_is_duplicate(union olsr_mes 39 | } 40 | 41 | diff = olsr_seqno_diff(seqnr, entry->seqnr); 42 | - if (diff < -31) { 43 | - entry->too_low_counter++; 44 | + if (diff < -31 || diff > DUP_SEQNR_DIFF_HIGH_LIMIT) { 45 | + entry->out_of_bounds_counter++; 46 | 47 | - // client did restart with a lower number ? 48 | - if (entry->too_low_counter > DUP_MAX_TOO_LOW) { 49 | - entry->too_low_counter = 0; 50 | + // client did restart with a too low or too high number ? 51 | + if (entry->out_of_bounds_counter > DUP_MAX_OUT_OF_BOUNDS) { 52 | + entry->out_of_bounds_counter = 0; 53 | entry->seqnr = seqnr; 54 | entry->array = 1; 55 | return false; /* start with a new sequence number, so NO duplicate */ 56 | @@ -174,7 +174,7 @@ olsr_message_is_duplicate(union olsr_mes 57 | return true; /* duplicate ! */ 58 | } 59 | 60 | - entry->too_low_counter = 0; 61 | + entry->out_of_bounds_counter = 0; 62 | if (diff <= 0) { 63 | uint32_t bitmask = 1u << ((uint32_t) (-diff)); 64 | 65 | --- a/src/duplicate_set.h 66 | +++ b/src/duplicate_set.h 67 | @@ -54,13 +54,14 @@ 68 | #define DUPLICATE_CLEANUP_INTERVAL 15000 69 | #define DUPLICATE_CLEANUP_JITTER 25 70 | #define DUPLICATE_VTIME 120000 71 | -#define DUP_MAX_TOO_LOW 16 72 | +#define DUP_MAX_OUT_OF_BOUNDS 16 73 | +#define DUP_SEQNR_DIFF_HIGH_LIMIT 0x2000 74 | 75 | struct dup_entry { 76 | struct olsrd_avl_node olsrd_avl; 77 | union olsr_ip_addr ip; 78 | uint16_t seqnr; 79 | - uint16_t too_low_counter; 80 | + uint16_t out_of_bounds_counter; 81 | uint32_t array; 82 | uint32_t valid_until; 83 | }; 84 | -------------------------------------------------------------------------------- /olsrd/patches/600-add-ubus-support.patch: -------------------------------------------------------------------------------- 1 | --- a/src/scheduler.c 2 | +++ b/src/scheduler.c 3 | @@ -59,6 +59,8 @@ 4 | #include 5 | #include 6 | 7 | +#include "ubus.h" 8 | + 9 | #ifdef __MACH__ 10 | #include "mach/clock_gettime.h" 11 | #endif 12 | @@ -363,6 +365,8 @@ poll_sockets(void) 13 | } 14 | OLSR_FOR_ALL_SOCKETS_END(entry); 15 | 16 | + hfd = olsrd_ubus_add_read_sock(&ibits, hfd); 17 | + 18 | /* Running select on the FD set */ 19 | do { 20 | n = olsr_select(hfd, fdsets & SP_PR_READ ? &ibits : NULL, fdsets & SP_PR_WRITE ? &obits : NULL, NULL, &tvp); 21 | @@ -395,6 +399,7 @@ poll_sockets(void) 22 | } 23 | } 24 | OLSR_FOR_ALL_SOCKETS_END(entry); 25 | + olsrd_ubus_receive(&ibits); 26 | } 27 | 28 | static void 29 | --- a/src/main.c 30 | +++ b/src/main.c 31 | @@ -74,6 +74,8 @@ 32 | #include "lock_file.h" 33 | #include "cli.h" 34 | 35 | +#include "ubus.h" 36 | + 37 | #if defined(__GLIBC__) && defined(__linux__) && !defined(__ANDROID__) && !defined(__UCLIBC__) 38 | #define OLSR_HAVE_EXECINFO_H 39 | #endif 40 | @@ -771,6 +773,9 @@ int main(int argc, char *argv[]) { 41 | signal(SIGUSR2, SIG_IGN); 42 | #endif /* _WIN32 */ 43 | 44 | + /* Adding ubus */ 45 | + olsrd_add_ubus(); 46 | + 47 | /* Starting scheduler */ 48 | olsr_scheduler(); 49 | 50 | --- a/Makefile.inc 51 | +++ b/Makefile.inc 52 | @@ -252,7 +252,7 @@ else 53 | ifeq ($(OS),win32) 54 | LDFLAGS += -Wl,-export-all-symbols 55 | else 56 | - LDFLAGS += -Wl,-export-dynamic 57 | + LDFLAGS += -Wl,-export-dynamic,-lubus,-lubox 58 | endif 59 | ifeq ($(NORPATH),0) 60 | LDFLAGS += -Wl,-rpath,$(LIBDIR) 61 | -------------------------------------------------------------------------------- /olsrd/src/src/ubus.h: -------------------------------------------------------------------------------- 1 | /* 2 | IPC integration of olsrd with OpenWrt. 3 | 4 | The ubus interface offers following functions: 5 | - add_inteface '{"ifname":"wg_51820", "lqm": "0.5"}' 6 | - del_inteface '{"ifname":"wg_51820"}' 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | /** 13 | * Initialize ubus interface. 14 | * 15 | * Connect to the ubus daemon and expose the ubus functions. 16 | * 17 | * @return if initializing ubus was successful 18 | */ 19 | bool olsrd_add_ubus(); 20 | 21 | /** 22 | * Add ubus socket to given filedescriptor set. 23 | * 24 | * We need to check repeatedly if the ubus socket has something to read. 25 | * The functions allows to add the ubus socket to the normal while(1)-loop of 26 | * olsrd. 27 | * 28 | * @param readfs: the filedescriptor set 29 | * @param maxfd: the current maximum file descriptor 30 | * @return the maximum file descriptor 31 | */ 32 | int olsrd_ubus_add_read_sock(fd_set *readfds, int maxfd); 33 | 34 | /** 35 | * Check and process ubus socket. 36 | * 37 | * If the ubus-socket signals that data is available, the ubus_handle_event is 38 | * called. 39 | */ 40 | void olsrd_ubus_receive(fd_set *readfds); 41 | -------------------------------------------------------------------------------- /oonf-dlep-proxy/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=oonf-dlep-proxy 4 | PKG_RELEASE:=1 5 | 6 | PKG_SOURCE_PROTO:=git 7 | PKG_SOURCE_URL:=https://github.com/OLSR/OONF.git 8 | PKG_SOURCE_DATE:=2022-08-25 9 | PKG_SOURCE_VERSION:=fb15d54d6a7a087cb0c5ec37c49804f6ce432396 10 | PKG_MIRROR_HASH:=f3a4512a53a56c27564c602a0efec211988825caf77bf52e86769cd8d413522c 11 | 12 | CMAKE_INSTALL:=1 13 | 14 | include $(INCLUDE_DIR)/package.mk 15 | include $(INCLUDE_DIR)/cmake.mk 16 | 17 | CMAKE_OPTIONS+=-D OONF_NO_WERROR:Bool=true \ 18 | -D OONF_LOGGING_LEVEL:String=debug \ 19 | -D OONF_NO_TESTING:Bool=true \ 20 | -D UCI:Bool=true \ 21 | -D OONF_APP_DEFAULT_CFG_HANDLER:String=uci \ 22 | -D OONF_STATIC_PLUGINS:String="class;clock;layer2;packet_socket;socket;stream_socket;telnet;timer;viewer;os_clock;os_fd;os_interface;os_system;nl80211_listener;layer2info;systeminfo;cfg_uciloader;cfg_compact;dlep_proxy" \ 23 | -D OONF_LIB_GIT:String=v$(PKG_SOURCE_VERSION) \ 24 | -D VERSION_SUB_TAG:String=$(PKG_SOURCE_DATE) \ 25 | -D INSTALL_LIB_DIR:Path=lib/oonf \ 26 | -D INSTALL_INCLUDE_DIR:Path=include/oonf \ 27 | -D INSTALL_CMAKE_DIR:Path=lib/oonf \ 28 | -D CMAKE_PREFIX_PATH=$(STAGING_DIR)/usr 29 | 30 | define Package/oonf-git/template 31 | SECTION:=net 32 | CATEGORY:=Network 33 | MAINTAINER:=Henning Rogge 34 | SUBMENU:=OLSR.org network framework 35 | URL:=http://www.olsr.org/ 36 | endef 37 | 38 | define Package/oonf-dlep-proxy 39 | $(call Package/oonf-git/template) 40 | TITLE:= Build DLEP Radio+Router Agent 41 | DEPENDS:=+librt +libnl-tiny +libuci +oonf-init-scripts 42 | VERSION:=$(PKG_VERSION) 43 | endef 44 | 45 | Build/Compile=$(call Build/Compile/Default,dlep_radio_static) 46 | Build/Install= 47 | 48 | define Build/Install 49 | $(INSTALL_BIN) -D $(PKG_BUILD_DIR)/$(MAKE_PATH)/dlep_radio_static $(PKG_INSTALL_DIR)/usr/sbin/dlep_proxy; 50 | endef 51 | 52 | TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include -I${STAGING_DIR}/usr/include/libnl-tiny 53 | 54 | define Package/oonf-dlep-proxy/install 55 | $(INSTALL_BIN) -D $(PKG_BUILD_DIR)/dlep_radio_static $(1)/usr/sbin/dlep_proxy 56 | $(INSTALL_BIN) -D ./files/dlep_proxy.init $(1)/etc/init.d/dlep_proxy 57 | $(INSTALL_BIN) -D ./files/dlep_proxy.hotplug $(1)/etc/hotplug.d/iface/50-dlep_proxy 58 | $(INSTALL_DATA) -D ./files/dlep_proxy.uci $(1)/etc/config/dlep_proxy 59 | endef 60 | 61 | define Package/oonf-dlep-proxy/conffiles 62 | /etc/config/dlep_proxy 63 | endef 64 | 65 | $(eval $(call BuildPackage,oonf-dlep-proxy)) 66 | -------------------------------------------------------------------------------- /oonf-dlep-proxy/files/dlep_proxy.hotplug: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DAEMON='dlep_proxy' 4 | 5 | . /lib/functions/oonf_hotplug.sh 6 | -------------------------------------------------------------------------------- /oonf-dlep-proxy/files/dlep_proxy.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | 3 | START=82 4 | DAEMON='dlep_proxy' 5 | 6 | [ -n "$IPKG_INSTROOT" ] || { 7 | . /lib/functions/oonf_init.sh 8 | } -------------------------------------------------------------------------------- /oonf-dlep-proxy/files/dlep_proxy.uci: -------------------------------------------------------------------------------- 1 | config global 2 | option 'failfast' 'no' 3 | option 'pidfile' '/var/run/dlep_proxy.pid' 4 | option 'lockfile' '/var/lock/dlep_proxy' 5 | 6 | config log 7 | option 'syslog' 'true' 8 | option 'stderr' 'true' 9 | # option 'file' '/var/log/dlep_proxy.log' 10 | # option 'info' 'all' 11 | # option 'debug' 'all' 12 | 13 | config telnet 14 | # option 'port' '2009' 15 | 16 | #config dlep_radio 17 | # list 'name' 'eth0' 18 | # option 'datapath_if' 'eth1' 19 | # option 'not_proxied' 'false' 20 | # option 'proxied' 'true' 21 | 22 | #config dlep-router 23 | # list 'name' 'eth0' 24 | # option 'datapath_if' 'eth0' 25 | -------------------------------------------------------------------------------- /oonf-dlep-radio/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=oonf-dlep-radio 4 | PKG_RELEASE:=1 5 | 6 | PKG_SOURCE_PROTO:=git 7 | PKG_SOURCE_URL:=https://github.com/OLSR/OONF.git 8 | PKG_SOURCE_DATE:=2022-08-25 9 | PKG_SOURCE_VERSION:=fb15d54d6a7a087cb0c5ec37c49804f6ce432396 10 | PKG_MIRROR_HASH:=9a17ada9ba95bef28ded5f8855a96950d9c0fde95612eb9e102d6ec967f8c304 11 | 12 | PKG_MAINTAINER:=Henning Rogge 13 | 14 | CMAKE_INSTALL:=1 15 | 16 | include $(INCLUDE_DIR)/package.mk 17 | include $(INCLUDE_DIR)/cmake.mk 18 | 19 | CMAKE_OPTIONS+=-D OONF_NO_WERROR:Bool=true \ 20 | -D OONF_LOGGING_LEVEL:String=debug \ 21 | -D OONF_NO_TESTING:Bool=true \ 22 | -D UCI:Bool=true \ 23 | -D OONF_APP_DEFAULT_CFG_HANDLER:String=uci \ 24 | -D OONF_STATIC_PLUGINS:String="class;clock;layer2;packet_socket;socket;stream_socket;telnet;timer;viewer;os_clock;os_fd;os_interface;os_system;nl80211_listener;layer2info;systeminfo;cfg_uciloader;cfg_compact;dlep_radio" \ 25 | -D OONF_LIB_GIT:String=$(PKG_SOURCE_VERSION) \ 26 | -D VERSION_SUB_TAG:String=$(PKG_SOURCE_DATE) \ 27 | -D INSTALL_LIB_DIR:Path=lib/oonf \ 28 | -D INSTALL_INCLUDE_DIR:Path=include/oonf \ 29 | -D INSTALL_CMAKE_DIR:Path=lib/oonf \ 30 | -D CMAKE_PREFIX_PATH=$(STAGING_DIR)/usr 31 | 32 | define Package/oonf-git/template 33 | SECTION:=net 34 | CATEGORY:=Network 35 | MAINTAINER:=Henning Rogge 36 | SUBMENU:=OLSR.org network framework 37 | URL:=http://www.olsr.org/ 38 | endef 39 | 40 | define Package/oonf-dlep-radio 41 | $(call Package/oonf-git/template) 42 | TITLE:=Build DLEP Radio Agent 43 | DEPENDS:=+librt +libnl-tiny +libuci +oonf-init-scripts 44 | VERSION:=$(PKG_VERSION) 45 | endef 46 | 47 | Build/Compile=$(call Build/Compile/Default,dlep_radio_static) 48 | Build/Install= 49 | 50 | define Build/Install 51 | $(INSTALL_BIN) -D $(PKG_BUILD_DIR)/$(MAKE_PATH)/dlep_radio_static $(PKG_INSTALL_DIR)/usr/sbin/dlep_radio; 52 | endef 53 | 54 | TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include -I${STAGING_DIR}/usr/include/libnl-tiny 55 | 56 | define Package/oonf-dlep-radio/install 57 | $(INSTALL_BIN) -D $(PKG_BUILD_DIR)/dlep_radio_static $(1)/usr/sbin/dlep_radio 58 | $(INSTALL_BIN) -D ./files/dlep_radio.init $(1)/etc/init.d/dlep_radio 59 | $(INSTALL_BIN) -D ./files/dlep_radio.hotplug $(1)/etc/hotplug.d/iface/50-dlep_radio 60 | $(INSTALL_DATA) -D ./files/dlep_radio.uci $(1)/etc/config/dlep_radio 61 | endef 62 | 63 | define Package/oonf-dlep-radio/conffiles 64 | /etc/config/dlep_radio 65 | endef 66 | 67 | $(eval $(call BuildPackage,oonf-dlep-radio)) 68 | -------------------------------------------------------------------------------- /oonf-dlep-radio/files/dlep_radio.hotplug: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DAEMON='dlep_radio' 4 | 5 | . /lib/functions/oonf_hotplug.sh 6 | -------------------------------------------------------------------------------- /oonf-dlep-radio/files/dlep_radio.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | 3 | START=82 4 | DAEMON='dlep_radio' 5 | 6 | [ -n "$IPKG_INSTROOT" ] || { 7 | . /lib/functions/oonf_init.sh 8 | } 9 | -------------------------------------------------------------------------------- /oonf-dlep-radio/files/dlep_radio.uci: -------------------------------------------------------------------------------- 1 | config global 2 | option 'failfast' 'no' 3 | option 'pidfile' '/var/run/dlep_radio.pid' 4 | option 'lockfile' '/var/lock/dlep_radio' 5 | 6 | config log 7 | option 'syslog' 'true' 8 | option 'stderr' 'true' 9 | # option 'file' '/var/log/dlep_radio.log' 10 | # option 'info' 'all' 11 | # option 'debug' 'all' 12 | 13 | config telnet 14 | # option 'port' '2009' 15 | 16 | config dlep_radio 17 | list 'name' 'wlan0' 18 | option 'datapath_if' 'br-lan' 19 | option 'not_proxied' 'false' 20 | option 'proxied' 'true' 21 | 22 | config nl80211_listener 23 | option 'if' 'wlan0' 24 | option 'interval' '1.0' 25 | -------------------------------------------------------------------------------- /oonf-init-scripts/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | include $(INCLUDE_DIR)/kernel.mk 3 | 4 | PKG_NAME:=oonf-init-scripts 5 | PKG_VERSION:=0.9.1-r3 6 | PKG_RELEASE:=1 7 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) 8 | 9 | include $(INCLUDE_DIR)/package.mk 10 | 11 | define Package/oonf-init-scripts 12 | SECTION:=net 13 | CATEGORY:=Network 14 | MAINTAINER:=Henning Rogge 15 | SUBMENU:=OLSR.org network framework 16 | URL:=http://www.olsr.org/ 17 | TITLE:= Common OONF startup scripts 18 | VERSION:=$(PKG_VERSION) 19 | endef 20 | 21 | define Build/Prepare 22 | mkdir -p $(PKG_BUILD_DIR) 23 | endef 24 | 25 | define Build/Configure 26 | endef 27 | 28 | define Build/Compile 29 | endef 30 | 31 | define Package/oonf-init-scripts/install 32 | $(INSTALL_BIN) -D ./files/oonf_init.sh $(1)/lib/functions/oonf_init.sh 33 | $(INSTALL_BIN) -D ./files/oonf_hotplug.sh $(1)/lib/functions/oonf_hotplug.sh 34 | endef 35 | 36 | $(eval $(call BuildPackage,oonf-init-scripts)) 37 | -------------------------------------------------------------------------------- /oonf-init-scripts/files/oonf_hotplug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | case "${ACTION}" in 4 | ifup) 5 | . /etc/rc.common /etc/init.d/${DAEMON} enabled && { 6 | logger -t "${DAEMON}[hotplug]" -p daemon.info 'reloading configuration' 7 | . /etc/rc.common /etc/init.d/${DAEMON} reload 8 | } 9 | ;; 10 | esac 11 | -------------------------------------------------------------------------------- /oonf-init-scripts/files/oonf_init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . /usr/share/libubox/jshn.sh 4 | 5 | oonf_log() 6 | { 7 | logger -s -t ${DAEMON} -p daemon.info "${1}" 8 | } 9 | 10 | oonf_get_layer3_device() 11 | { 12 | local interface="${1}" # e.g. 'mywifi' 13 | local status dev proto 14 | local query="{ \"interface\" : \"${interface}\" }" 15 | 16 | status="$( ubus -S call network.interface status "${query}" )" && { 17 | json_load "${status}" 18 | json_get_var 'dev' l3_device 19 | json_get_var 'proto' proto 20 | case "${proto}" in 21 | pppoe) 22 | # TODO: otherwise it segfaults 23 | oonf_log "refusing to add '$interface', because of proto '${proto}'" 24 | ;; 25 | *) 26 | echo "${dev}" # e.g. 'wlan0-1' 27 | ;; 28 | esac 29 | } 30 | } 31 | 32 | oonf_add_devices_to_configuration() 33 | { 34 | local i=0 35 | local device_name= section= interface= single_interface= 36 | 37 | # make a copy of configuration and 38 | # add a 'name' (physical name) for all 39 | # 'interface-names' (e.g. mywifi) 40 | # 41 | # olsrd2.@interface[2]=interface 42 | # olsrd2.@interface[2].ifname='wan lan wlanadhoc wlanadhocRADIO1' 43 | 44 | # /var is in ramdisc/tmpfs 45 | uci export ${DAEMON} >"/var/run/${DAEMON}_dev" 46 | 47 | while section="$( uci -q -c /etc/config get "${DAEMON}.@[${i}]" )"; do { 48 | echo "section: ${section}" 49 | 50 | interface="$( uci -q -c /etc/config get "${DAEMON}.@[${i}].ifname" )" || { 51 | i=$(( i + 1 )) 52 | continue 53 | } 54 | 55 | case "$( uci -q get "${DAEMON}.@[${i}].ignore" )" in 56 | 1|on|true|enabled|yes) 57 | oonf_log "removing/ignore section '$section'" 58 | uci -q -c /var/run delete "${DAEMON}_dev.@[${j}]" 59 | i=$(( i + 1 )) 60 | 61 | continue 62 | ;; 63 | esac 64 | 65 | for single_interface in ${interface}; do { 66 | device_name="$( oonf_get_layer3_device "${single_interface}" )" 67 | 68 | echo "Interface: ${single_interface} = ${device_name}" 69 | 70 | if [ ! -z "${device_name}" ] 71 | then 72 | # add option 'name' for 'ifname' (e.g. 'mywifi') 73 | uci -q -c /var/run add_list "${DAEMON}_dev.@[${i}].name=${device_name}" 74 | fi 75 | } done 76 | i=$(( $i + 1 )) 77 | } done 78 | 79 | uci -q -c /var/run commit "${DAEMON}_dev" 80 | 81 | oonf_log "wrote '/var/run/${DAEMON}_dev'" 82 | } 83 | 84 | oonf_reread_config() 85 | { 86 | local pid 87 | local pidfile="/var/run/${DAEMON}.pid" 88 | 89 | if [ -e "${pidfile}" ]; then 90 | read pid <"${pidfile}" 91 | elif pidfile="$( uci -q get "${DAEMON}.@global[0].pidfile" )"; then 92 | read pid <"${pidfile}" 93 | fi 94 | 95 | # if empty, ask kernel 96 | pid="${pid:-$( pidof ${DAEMON} )}" 97 | 98 | [ -n "${pid}" ] && kill -SIGHUP ${pid} 99 | } 100 | 101 | start() 102 | { 103 | oonf_add_devices_to_configuration 104 | 105 | # produce coredumps 106 | ulimit -c unlimited 107 | 108 | service_start /usr/sbin/${DAEMON} --set global.fork=true --load uci:///var/run/${DAEMON}_dev 109 | } 110 | 111 | stop() 112 | { 113 | service_stop /usr/sbin/${DAEMON} 114 | } 115 | 116 | reload() 117 | { 118 | oonf_add_devices_to_configuration 119 | oonf_reread_config 120 | } 121 | 122 | running() 123 | { 124 | # check if we have a pidfile and then check if that pid still exists. 125 | # since we don't use -e this has to be explicitly returned. exit would stop the process. 126 | test -e "/tmp/run/olsrd2.pid" && test -e "/proc/$(cat "/tmp/run/olsrd2.pid")" && return 0 127 | return 1 128 | } 129 | 130 | status() 131 | { 132 | if running; then 133 | echo "running" 134 | else 135 | echo "stopped" 136 | fi 137 | } 138 | -------------------------------------------------------------------------------- /oonf-olsrd2/Config.in: -------------------------------------------------------------------------------- 1 | # OONF Olsrd2 configuration 2 | menu "Optional Plugins" 3 | depends on PACKAGE_oonf-olsrd2 4 | 5 | config OONF_NHDP_AUTOLL4 6 | bool "Auto_LL4 plugin enabled" 7 | help 8 | The auto_ll4 plugin automatically generates linklocal IPv4 addresses on interfaces that do not contain IPv4 addresses. 9 | default n 10 | 11 | config OONF_OLSRV2_LAN_IMPORT 12 | bool "Lan_import plugin enabled" 13 | help 14 | The lan_import plugin can read routing tables and automatically export them as locally attached networks in olsrd2. 15 | default y 16 | 17 | config OONF_OLSRV2_ROUTE_MODIFIER 18 | bool "route_modifier plugin enabled" 19 | help 20 | The route_modifier plugin allows you to overwrite aspects of routes (like table/protocol) for certain destinations. 21 | default y 22 | 23 | config OONF_GENERIC_DLEP_ROUTER 24 | bool "dlep_router plugin enabled" 25 | help 26 | The dlep_router plugin can receive linklayer metadata over the DLEP protocol. 27 | default n 28 | 29 | config OONF_GENERIC_REMOTECONTROL 30 | bool "remotecontrol plugin enabled" 31 | help 32 | The remotecontrol plugin allows you to control configuration and logging over the telnet plugin. Be careful not to open this functionality over the network without securing it. 33 | default y 34 | 35 | config OONF_GENERIC_HTTP 36 | bool "http plugin enabled" 37 | help 38 | The HTTP plugin allows HTTP access to all telnet commands. 39 | default n 40 | 41 | config OONF_OLSRV2_MPR 42 | bool "MPR plugin enabled" 43 | help 44 | The MPR plugin reduce the routing graph to limit the overhead of the OLSRv2 protocol 45 | default y 46 | 47 | config OONF_OLSRV2_LAN 48 | bool "New config option for Locally attached entries" 49 | help 50 | Adds the 'lan' section to the config to configure LANs without setting multiple settings in a single key/value pair 51 | default y 52 | 53 | config OONF_OLSRV2_OLD_LAN 54 | bool "Legacy option for Locally attached entries" 55 | help 56 | Adds the olsr 'lan' config key in the olsrv2 section 57 | default n 58 | 59 | endmenu 60 | -------------------------------------------------------------------------------- /oonf-olsrd2/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=oonf-olsrd2 4 | PKG_RELEASE:=2 5 | 6 | PKG_SOURCE_PROTO:=git 7 | PKG_SOURCE_URL:=https://github.com/OLSR/OONF.git 8 | PKG_SOURCE_DATE:=2022-08-25 9 | PKG_SOURCE_VERSION:=1cec9b21086fb52ab4262c69aabd087e4d2d3a44 10 | PKG_MIRROR_HASH:=3350037ecb4d2e08f54a3fb8afe4f2d4e4884e1dec42ffdba1a6c5233df1b6cf 11 | 12 | CMAKE_INSTALL:=1 13 | 14 | include $(INCLUDE_DIR)/package.mk 15 | include $(INCLUDE_DIR)/cmake.mk 16 | 17 | # ref https://stackoverflow.com/a/10571900/3990041 18 | SPACE:= $(subst ,, ) 19 | CMAKE_OPTIONAL_PLUGINS:= $(subst $(SPACE),;,$(strip \ 20 | $(if $(filter y,$(CONFIG_OONF_NHDP_AUTOLL4)),auto_ll4,) \ 21 | $(if $(filter y,$(CONFIG_OONF_OLSRV2_LAN_IMPORT)),lan_import,) \ 22 | $(if $(filter y,$(CONFIG_OONF_OLSRV2_ROUTE_MODIFIER)),route_modifier,) \ 23 | $(if $(filter y,$(CONFIG_OONF_GENERIC_DLEP_ROUTER)),dlep,) \ 24 | $(if $(filter y,$(CONFIG_OONF_GENERIC_REMOTECONTROL)),remotecontrol,) \ 25 | $(if $(filter y,$(CONFIG_OONF_OLSRV2_MPR)),mpr,) \ 26 | $(if $(filter y,$(CONFIG_OONF_GENERIC_HTTP)),http,) \ 27 | $(if $(filter y,$(CONFIG_OONF_OLSRV2_LAN)),olsrv2_lan,) \ 28 | $(if $(filter y,$(CONFIG_OONF_OLSRV2_OLD_LAN)),olsrv2_old_lan,) \ 29 | )) 30 | 31 | BUILD_TYPE:= $(if $(filter y,$(CONFIG_DEBUG)),Debug,Release) 32 | 33 | CMAKE_OPTIONS+=-D CMAKE_BUILD_TYPE:String=$(BUILD_TYPE) \ 34 | -D OONF_NO_WERROR:Bool=true \ 35 | -D OONF_LOGGING_LEVEL:String=debug \ 36 | -D OONF_NO_TESTING:Bool=true \ 37 | -D UCI:Bool=true \ 38 | -D OONF_APP_DEFAULT_CFG_HANDLER:String=uci \ 39 | -D OONF_STATIC_PLUGINS:String="class;callback;clock;duplicate_set;layer2;packet_socket;rfc5444;socket;stream_socket;telnet;timer;viewer;os_clock;os_fd;os_interface;os_routing;os_system;nhdp;olsrv2;ff_dat_metric;neighbor_probing;nl80211_listener;link_config;layer2info;systeminfo;cfg_uciloader;cfg_compact;nhdpinfo;olsrv2info;netjsoninfo;${CMAKE_OPTIONAL_PLUGINS}" \ 40 | -D OONF_LIB_GIT:String=$(PKG_SOURCE_VERSION) \ 41 | -D VERSION_SUB_TAG:String=$(PKG_SOURCE_DATE) \ 42 | -D INSTALL_LIB_DIR:Path=lib/oonf \ 43 | -D INSTALL_INCLUDE_DIR:Path=include/oonf \ 44 | -D INSTALL_CMAKE_DIR:Path=lib/oonf \ 45 | -D CMAKE_PREFIX_PATH=$(STAGING_DIR)/usr \ 46 | -D CMAKE_GENERATOR=Ninja 47 | 48 | define Package/oonf-git/template 49 | SECTION:=net 50 | CATEGORY:=Network 51 | MAINTAINER:=Henning Rogge 52 | SUBMENU:=OLSR.org network framework 53 | URL:=http://www.olsr.org/ 54 | MENU:=1 55 | endef 56 | 57 | define Package/oonf-olsrd2 58 | $(call Package/oonf-git/template) 59 | TITLE:= Build Olsrd V2 Routing Agent 60 | DEPENDS:=+librt +libnl-tiny +libuci +oonf-init-scripts 61 | VERSION:=$(PKG_VERSION) 62 | endef 63 | 64 | define Package/oonf-olsrd2/config 65 | source "$(SOURCE)/Config.in" 66 | endef 67 | 68 | Build/Compile=$(call Build/Compile/Default,olsrd2_static) 69 | Build/Install= 70 | 71 | define Build/Install 72 | $(INSTALL_BIN) -D $(PKG_BUILD_DIR)/$(MAKE_PATH)/olsrd2_static $(PKG_INSTALL_DIR)/usr/sbin/olsrd2; 73 | endef 74 | 75 | TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include -I${STAGING_DIR}/usr/include/libnl-tiny 76 | 77 | define Package/oonf-olsrd2/install 78 | $(INSTALL_BIN) -D $(PKG_BUILD_DIR)/olsrd2_static $(1)/usr/sbin/olsrd2 79 | $(INSTALL_BIN) -D ./files/olsrd2.init $(1)/etc/init.d/olsrd2 80 | $(INSTALL_BIN) -D ./files/olsrd2.hotplug $(1)/etc/hotplug.d/iface/50-olsrd2 81 | $(INSTALL_DATA) -D ./files/olsrd2.uci $(1)/etc/config/olsrd2 82 | endef 83 | 84 | define Package/oonf-olsrd2/conffiles 85 | /etc/config/olsrd2 86 | endef 87 | 88 | $(eval $(call BuildPackage,oonf-olsrd2)) 89 | -------------------------------------------------------------------------------- /oonf-olsrd2/files/olsrd2.hotplug: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DAEMON='olsrd2' 4 | 5 | . /lib/functions/oonf_hotplug.sh 6 | -------------------------------------------------------------------------------- /oonf-olsrd2/files/olsrd2.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | 3 | START=82 4 | DAEMON='olsrd2' 5 | 6 | [ -n "$IPKG_INSTROOT" ] || { 7 | . /lib/functions/oonf_init.sh 8 | 9 | extra_command "running" "Check if service is running" 10 | extra_command "status" "Service status" 11 | } 12 | -------------------------------------------------------------------------------- /oonf-olsrd2/files/olsrd2.uci: -------------------------------------------------------------------------------- 1 | config global 2 | option 'failfast' 'no' 3 | option 'pidfile' '/var/run/olsrd2.pid' 4 | option 'lockfile' '/var/lock/olsrd2' 5 | 6 | config log 7 | option 'syslog' 'true' 8 | option 'stderr' 'true' 9 | # option 'file' '/var/log/olsrd2.log' 10 | # option 'info' 'all' 11 | # option 'debug' 'all' 12 | 13 | config telnet 14 | # option 'port' '2009' 15 | 16 | config olsrv2 17 | # list 'lan' '::/0' 18 | # list 'lan' '0.0.0.0/0' 19 | 20 | config interface 21 | option 'ifname' 'loopback' 22 | 23 | config interface 24 | list 'ifname' 'WIFI' 25 | list 'ifname' 'wlanadhoc' 26 | list 'ifname' 'wlanadhocRADIO1' 27 | 28 | config interface 29 | list 'ifname' 'wan' 30 | option 'ignore' '1' 31 | # option 'rx_bitrate' '100M' 32 | # option 'tx_bitrate' '100M' 33 | # option 'signal' '-20' 34 | 35 | config interface 36 | list 'ifname' 'lan' 37 | option 'ignore' '1' 38 | # option 'rx_bitrate' '1G' 39 | # option 'tx_bitrate' '1G' 40 | # option 'signal' '-10' 41 | -------------------------------------------------------------------------------- /oonf-olsrd2/patches/100-enable-lan-import-plugin.patch: -------------------------------------------------------------------------------- 1 | --- a/src/olsrv2/CMakeLists.txt 2 | +++ b/src/olsrv2/CMakeLists.txt 3 | @@ -6,4 +6,5 @@ add_subdirectory(olsrv2_old_lan) 4 | add_subdirectory(olsrv2_l2import) 5 | add_subdirectory(olsrv2_lan) 6 | add_subdirectory(route_modifier) 7 | +add_subdirectory(lan_import) 8 | 9 | -------------------------------------------------------------------------------- /pimbd/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=pimbd 4 | PKG_RELEASE:=4 5 | 6 | PKG_SOURCE_PROTO:=git 7 | PKG_SOURCE_URL:=https://github.com/Oryon/pimbd.git 8 | PKG_SOURCE_DATE:=2018-06-19 9 | PKG_SOURCE_VERSION:=dbf4e5913b06e3160f506df15e6a047a403a5f21 10 | PKG_MIRROR_HASH:=ed794402da1959e0c8cdf819a8bd7370f9bb092e62b33d96f94ad1228a4975d7 11 | 12 | PKG_MAINTAINER:=Pierre Pfister 13 | PKG_LICENSE:=Apache-2.0 14 | PKG_LICENSE_FILES:=LICENSE 15 | 16 | include $(INCLUDE_DIR)/package.mk 17 | include $(INCLUDE_DIR)/cmake.mk 18 | 19 | # Spammy debug builds for now 20 | CMAKE_OPTIONS += -DL_LEVEL=7 \ 21 | -DWITH_LIBUBOX=1 22 | 23 | define Package/pimbd 24 | SECTION:=net 25 | CATEGORY:=Network 26 | TITLE:=PIM BIDIR daemon 27 | URL:=https://github.com/Oryon/pimbd.git 28 | DEPENDS+=@IPV6 29 | DEPENDS+=netifd 30 | endef 31 | 32 | define Package/pimbd/description 33 | This package provides a daemon which implements the Protocol Independent 34 | Multicast BIDIR routing protocol. Note that a routing protocol must be 35 | installed and running in order for PIM to function. 36 | endef 37 | 38 | define Package/pimbd/install 39 | $(INSTALL_DIR) $(1)/usr/sbin/ 40 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/pimbd $(1)/usr/sbin/pimbd 41 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/pimbc.sh $(1)/usr/sbin/pimbc 42 | ln -s pimbd $(1)/usr/sbin/pimb-ipc 43 | $(INSTALL_DIR) $(1)/etc/init.d 44 | $(INSTALL_BIN) ./files/pimbd.init $(1)/etc/init.d/pimbd 45 | $(INSTALL_DIR) $(1)/etc/uci-defaults 46 | $(INSTALL_BIN) files/firewall-uci.sh $(1)/etc/uci-defaults/99_pimbd_firewall 47 | $(INSTALL_DIR) $(1)/etc/config 48 | $(INSTALL_CONF) ./files/pimb.config $(1)/etc/config/pimb 49 | endef 50 | 51 | $(eval $(call BuildPackage,pimbd)) 52 | -------------------------------------------------------------------------------- /pimbd/files/firewall-uci.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | pim_rule () { 4 | uci -q batch <<-EOT 5 | delete firewall.$1 6 | set firewall.$1=rule 7 | set firewall.$1.name='$2 multicast forward for $3' 8 | set firewall.$1.src='*' 9 | set firewall.$1.dest='*' 10 | set firewall.$1.family='$2' 11 | set firewall.$1.proto='udp' 12 | set firewall.$1.dest_ip='$3' 13 | set firewall.$1.target='ACCEPT' 14 | EOT 15 | } 16 | 17 | pim_rule pimbd4 ipv4 224.0.0.0/4 18 | pim_rule pimbd6 ipv6 ff00::/8 19 | uci commit firewall 20 | 21 | exit 0 22 | 23 | -------------------------------------------------------------------------------- /pimbd/files/pimb.config: -------------------------------------------------------------------------------- 1 | # The interface section allows to enable pimb on an interface. 2 | # Several options can be enabled for the interface. 3 | # All options are disabled by default. 4 | # 5 | #config interface '' 6 | # option pim '' - enable or disable pim 7 | # option ssbidir '' - enable or disable ssbidir 8 | # option mld '' - enable or disable mld 9 | # option igmp '' - enable or disable igmp 10 | # option dev '' - set the device name 11 | 12 | # The rpa section allows to configure a rendevous point. 13 | # The interface and the networks must be configured for every rendevous. 14 | # 15 | #config rpa '' 16 | # option address '' - rendevous point address 17 | # list prefix '/' - prefix for the rpa 18 | 19 | 20 | 21 | # Uncomment the following following section to enable pimb on the interface eth1. 22 | #config interface 'ETH1' 23 | # option pim 'on' 24 | # option ssbidir 'on' 25 | # option mld 'on' 26 | # option igmp 'on' 27 | # option dev 'eth1' 28 | 29 | 30 | # Uncomment the following section to configure a rendevous point. 31 | #config rpa '172_16_0_1' 32 | # option address '172.16.0.1' 33 | # list prefix '224.0.0.0/4' 34 | 35 | -------------------------------------------------------------------------------- /pimbd/files/pimbd.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | 3 | START=90 4 | STOP=10 5 | USE_PROCD=1 6 | 7 | TYPE='' 8 | 9 | DEV='' 10 | PIM='off' 11 | SSBIDIR='off' 12 | MLD='off' 13 | IGMP='off' 14 | 15 | RPAADDRESS='' 16 | RPALIST='' 17 | 18 | reset_link_values() { 19 | PIM='off' 20 | SSBIDIR='off' 21 | MLD='off' 22 | IGMP='off' 23 | } 24 | 25 | apply_link() { 26 | if test ! -z "$DEV"; then 27 | echo "Setting pimbc link set $DEV pim $PIM ssbidir $SSBIDIR mld $MLD igmp $IGMP" 28 | echo "link set $DEV pim $PIM ssbidir $SSBIDIR mld $MLD igmp $IGMP" >> /tmp/pimbd.conf 29 | fi 30 | reset_link_values 31 | } 32 | 33 | apply_rpa() { 34 | if test -z "$RPAADDRESS"; then 35 | echo "No RPA address is set!" 36 | return 37 | fi 38 | for i in $RPALIST; do 39 | echo "adding pimbc rpa add $RPAADDRESS $i" 40 | echo "rpa add $RPAADDRESS $i" >> /tmp/pimbd.conf 41 | done 42 | RPAADDRESS='' 43 | RPALIST='' 44 | } 45 | 46 | store_interface_option() { 47 | local name="$1" 48 | local value="$2" 49 | case $name in 50 | dev) 51 | DEV=$value 52 | ;; 53 | pim) 54 | PIM=$value 55 | ;; 56 | ssbidir) 57 | SSBIDIR=$value 58 | ;; 59 | mld) 60 | MLD=$value 61 | ;; 62 | igmp) 63 | IGMP=$value 64 | ;; 65 | esac 66 | } 67 | 68 | store_rpa_option() { 69 | local name="$1" 70 | local value="$2" 71 | echo "store_rpa_option $name $value" 72 | case $name in 73 | address) 74 | RPAADDRESS="$value" 75 | ;; 76 | esac 77 | } 78 | 79 | store_rpa_list() { 80 | local name="$1" 81 | local value="$2" 82 | echo "store rpa_list $name $value" 83 | case $name in 84 | prefix) 85 | RPALIST="${RPALIST} $value" 86 | ;; 87 | esac 88 | } 89 | 90 | start_service() { 91 | . /lib/functions.sh 92 | . /lib/functions/network.sh 93 | 94 | rm -f /tmp/pimbd.conf 95 | 96 | config_cb() { 97 | local name="$1" 98 | local value="$2" 99 | # commands to be run for every option 100 | echo "config_cb $name $value" 101 | case $TYPE in 102 | interface) 103 | apply_link 104 | ;; 105 | rpa) 106 | apply_rpa 107 | ;; 108 | esac 109 | TYPE=$name 110 | DEV=$value 111 | } 112 | 113 | option_cb() { 114 | local name="$1" 115 | local value="$2" 116 | # commands to be run for every option 117 | echo "option_cb $name $value" 118 | case $TYPE in 119 | interface) 120 | store_interface_option "$name" "$value" 121 | ;; 122 | rpa) 123 | store_rpa_option "$name" "$value" 124 | ;; 125 | esac 126 | } 127 | 128 | list_cb() { 129 | local name="$1" 130 | local value="$2" 131 | # commands to be run for every list item 132 | echo "list_cb $name $value" 133 | 134 | case $TYPE in 135 | rpa) 136 | store_rpa_list "$name" "$value" 137 | ;; 138 | esac 139 | } 140 | config_load pimb 141 | 142 | procd_open_instance 143 | procd_set_param command /usr/sbin/pimbd 144 | procd_append_param command -S 145 | procd_append_param command -L 6 146 | procd_append_param command -c /tmp/pimbd.conf 147 | 148 | procd_set_param respawn 149 | procd_close_instance 150 | } 151 | -------------------------------------------------------------------------------- /prince/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2009-2018 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=prince 11 | PKG_VERSION:=0.4 12 | PKG_RELEASE:=3 13 | 14 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 15 | PKG_SOURCE_URL:=https://github.com/AdvancedNetworkingSystems/prince/archive/refs/tags/v$(PKG_VERSION).tar.gz? 16 | PKG_HASH:=9e3ce87343f5ea1d66757f8c704b62ff47d5eb245a191cf1e6a9ec106c5da90e 17 | 18 | PKG_MAINTAINER:=Gabriele Gemmi 19 | PKG_LICENSE:=MIT 20 | PKG_LICENSE_FILES:=LICENSE 21 | 22 | PKG_BUILD_FLAGS:=no-mips16 23 | 24 | # out of source build 25 | CMAKE_BINARY_SUBDIR:=build 26 | 27 | include $(INCLUDE_DIR)/package.mk 28 | include $(INCLUDE_DIR)/cmake.mk 29 | 30 | define Package/prince 31 | SECTION:=net 32 | CATEGORY:=Network 33 | SUBMENU:=Routing and Redirection 34 | TITLE:=Prince 35 | URL:=https://github.com/AdvancedNetworkingSystems/prince 36 | DEPENDS:=+libjson-c +libpthread 37 | endef 38 | 39 | define Package/prince/description 40 | Prince is an open source implementation of the PopRouting Algorithm. 41 | It has been developed as a Google Summer of Code Project in collaboration with Freifunk and the University of Trento. 42 | 43 | Prince fetches topology data from a Link State routing daemon (OONF, OLSR, OSPF, etc), 44 | calculates the betweenness centrality using the topology and then computes the 45 | the timers' optimal values using these data. At the end of the computation the timers are pushed back to the routing daemon. 46 | Since v0.4 it supports both OONF and OLSRd. 47 | endef 48 | 49 | define Package/prince/install 50 | $(INSTALL_DIR) $(1)/usr/bin 51 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/build/prince $(1)/usr/bin/prince 52 | 53 | $(INSTALL_DIR) $(1)/usr/lib 54 | $(INSTALL_DATA) $(PKG_BUILD_DIR)/build/libprince_oonf.so $(1)/usr/lib 55 | $(INSTALL_DATA) $(PKG_BUILD_DIR)/build/libprince_olsr.so $(1)/usr/lib 56 | 57 | $(INSTALL_DIR) $(1)/etc/init.d 58 | $(INSTALL_BIN) ./files/prince.init $(1)/etc/init.d/prince 59 | $(INSTALL_DATA) ./files/prince.conf $(1)/etc/prince.conf 60 | endef 61 | 62 | CFLAGS += $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) 63 | LDFLAGS += $(TARGET_LDFLAGS) 64 | 65 | $(eval $(call BuildPackage,prince)) 66 | -------------------------------------------------------------------------------- /prince/files/prince.conf: -------------------------------------------------------------------------------- 1 | { 2 | "proto": { 3 | "protocol": "oonf", 4 | "host": "127.0.0.1", 5 | "port": 2009 , 6 | "refresh": 10, 7 | "timer_port": 2009 8 | }, 9 | "graph-parser": { 10 | "heuristic": 1, 11 | "weights": 1, 12 | "recursive": 0, 13 | "stop_unchanged": 0, 14 | "multithreaded": 0 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /prince/files/prince.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Init script for Prince 3 | # Copyright (C) 2018 OpenWrt.org 4 | 5 | USE_PROCD=1 6 | START=99 7 | STOP=15 8 | 9 | PROG="/usr/bin/prince" 10 | CONF="/etc/prince.conf" 11 | 12 | start_service(){ 13 | procd_open_instance 14 | procd_set_param command $PROG $CONF 15 | procd_set_param stdout 1 16 | procd_set_param stderr 1 17 | procd_set_param user nobody 18 | procd_close_instance 19 | echo "Prince started" 20 | } 21 | -------------------------------------------------------------------------------- /prince/patches/010-gcc10.patch: -------------------------------------------------------------------------------- 1 | --- a/prince/include/common.h 2 | +++ b/prince/include/common.h 3 | @@ -35,12 +35,12 @@ typedef struct routing_plugin_ { 4 | 5 | } routing_plugin; 6 | 7 | -routing_plugin *(*new_plugin_p)(char *host, int port, int json_type, 8 | +static routing_plugin *(*new_plugin_p)(char *host, int port, int json_type, 9 | int timer_port); 10 | 11 | -int (*get_initial_timers_p)(routing_plugin *o, struct timers *t); 12 | -int (*get_topology_p)(routing_plugin *o); 13 | -int (*push_timers_p)(routing_plugin *o, struct timers t); 14 | -void (*delete_plugin_p)(routing_plugin *o); 15 | +static int (*get_initial_timers_p)(routing_plugin *o, struct timers *t); 16 | +static int (*get_topology_p)(routing_plugin *o); 17 | +static int (*push_timers_p)(routing_plugin *o, struct timers t); 18 | +static void (*delete_plugin_p)(routing_plugin *o); 19 | 20 | #endif /* SRC_COMMON_H_ */ 21 | -------------------------------------------------------------------------------- /vis/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008-2011 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=vis 11 | PKG_RELEASE:=9 12 | 13 | PKG_SOURCE_PROTO:=git 14 | PKG_SOURCE_DATE:=2013-04-07 15 | PKG_SOURCE_VERSION:=7710cce42e8d63ea114056a4a140835d4a452933 16 | PKG_SOURCE_URL:=https://git.open-mesh.org/vis.git 17 | PKG_MIRROR_HASH:=2544df816f9294e192cd6bb3592695416796fc6b254d182f1f124e686833f50d 18 | 19 | PKG_MAINTAINER:=Corinna "Elektra" Aichele 20 | PKG_LICENSE:=GPL-2.0-only 21 | 22 | PKG_BUILD_PARALLEL:=1 23 | 24 | include $(INCLUDE_DIR)/package.mk 25 | 26 | define Package/vis 27 | SECTION:=net 28 | CATEGORY:=Network 29 | SUBMENU:=Routing and Redirection 30 | DEPENDS:=+libpthread 31 | TITLE:=visualization server for B.A.T.M.A.N. layer 3 32 | URL:=https://www.open-mesh.org/ 33 | endef 34 | 35 | define Package/vis/description 36 | visualization server for B.A.T.M.A.N. layer 3 37 | endef 38 | 39 | MAKE_FLAGS += \ 40 | EXTRA_CFLAGS='-DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA -DREVISION_VERSION=\"\ rv$(PKG_REV)\" -D_GNU_SOURCE' \ 41 | REVISION="$(PKG_REV)" \ 42 | CC="$(TARGET_CC)" \ 43 | vis 44 | 45 | define Package/vis/install 46 | $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d 47 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/vis $(1)/usr/sbin/ 48 | $(INSTALL_BIN) ./files/etc/init.d/vis $(1)/etc/init.d 49 | $(INSTALL_DATA) ./files/etc/config/vis $(1)/etc/config 50 | endef 51 | 52 | define Package/vis/conffiles 53 | /etc/config/vis 54 | endef 55 | 56 | $(eval $(call BuildPackage,vis)) 57 | -------------------------------------------------------------------------------- /vis/files/etc/config/vis: -------------------------------------------------------------------------------- 1 | config vis general 2 | option interface ath0 3 | 4 | -------------------------------------------------------------------------------- /vis/files/etc/init.d/vis: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | START=90 3 | USE_PROCD=1 4 | 5 | vis_start() { 6 | local config="$1" 7 | local interface 8 | 9 | [ "$config" = "general" ] || return 1 10 | 11 | config_get interface "$config" interface 12 | if [ "$interface" = "" ]; then 13 | echo $1 Error, you must specify at least a network interface 14 | return 1 15 | fi 16 | 17 | procd_open_instance "${config}" 18 | procd_set_param command /usr/sbin/vis 19 | procd_append_param command -D 20 | procd_append_param command ${interface} 21 | procd_set_param netdev $interface 22 | procd_close_instance 23 | } 24 | 25 | start_service() { 26 | config_load "vis" 27 | config_foreach vis_start vis 28 | } 29 | 30 | service_triggers() { 31 | procd_add_reload_trigger "vis" 32 | 33 | procd_open_trigger 34 | procd_add_raw_trigger "interface.*" 1000 /etc/init.d/vis reload 35 | procd_close_trigger 36 | } 37 | -------------------------------------------------------------------------------- /vis/patches/0001-Allow-one-to-disable-forking-to-background-in-debug_.patch: -------------------------------------------------------------------------------- 1 | From: Sven Eckelmann 2 | Date: Sun, 1 Dec 2013 14:39:00 +0100 3 | Subject: Allow one to disable forking to background in debug_mode 0 4 | 5 | --- 6 | posix/init.c | 19 ++++++++++++++----- 7 | 1 file changed, 14 insertions(+), 5 deletions(-) 8 | 9 | --- a/vis.c 10 | +++ b/vis.c 11 | @@ -58,6 +58,7 @@ buffer_t *fillme = NULL; 12 | 13 | static int8_t stop; 14 | uint8_t debug_level = 0; 15 | +static int no_detach = 0; 16 | 17 | formats selected_formats = dot_draw; 18 | 19 | @@ -718,6 +719,7 @@ void print_usage() { 20 | printf( "Usage: vis \n" ); 21 | printf( "\t-j output mesh topology as json on port %d\n", JSON_PORT ); 22 | printf( "\t-d debug level\n" ); 23 | + printf( "\t-D run in foreground\n" ); 24 | printf( "\t-h help\n" ); 25 | printf( "\t-v Version\n\n" ); 26 | printf( "Olsrs3d / Meshs3d is an application to visualize a mesh network.\nIt is a part of s3d, have a look at s3d.sourceforge.net\n\n" ); 27 | @@ -738,7 +740,7 @@ int main( int argc, char **argv ) { 28 | fd_set wait_sockets, tmp_wait_sockets; 29 | 30 | 31 | - while ( ( optchar = getopt ( argc, argv, "jd:hv" ) ) != -1 ) { 32 | + while ( ( optchar = getopt ( argc, argv, "jd:hvD" ) ) != -1 ) { 33 | 34 | switch( optchar ) { 35 | 36 | @@ -773,6 +775,11 @@ int main( int argc, char **argv ) { 37 | selected_formats |= json; 38 | found_args++; 39 | break; 40 | + 41 | + case 'D': 42 | + no_detach = 1; 43 | + found_args++; 44 | + break; 45 | 46 | default: 47 | print_usage(); 48 | @@ -891,7 +898,7 @@ int main( int argc, char **argv ) { 49 | 50 | 51 | /* daemonize */ 52 | - if ( debug_level == 0 ) { 53 | + if ( debug_level == 0 && !no_detach) { 54 | 55 | if ( my_daemon() < 0 ) 56 | exit_error( "Error - can't fork to background: %s\n", strerror(errno) ); 57 | --------------------------------------------------------------------------------