├── olsrd ├── files │ ├── olsrd_secure_key │ ├── olsrd.sgw.speed.conf │ ├── olsrd6.config │ ├── olsrd.config │ ├── olsrd.pud.position.conf │ ├── olsrd4.init │ ├── olsrd6.init │ └── olsrd-neigh.sh ├── src │ └── src │ │ ├── ubus.h │ │ └── ubus.c └── patches │ ├── 600-add-ubus-support.patch │ └── 102-olsrd-prevent-storm-patches.patch ├── bird2 ├── test.sh ├── patches │ ├── 000-ospf-bus-error.patch │ └── 0001-birdc-Use-var-tmp-for-history-file.patch ├── files │ └── bird.init └── Makefile ├── bird3 ├── test.sh ├── files │ └── bird.init ├── patches │ └── 0001-birdc-Use-var-tmp-for-history-file.patch └── Makefile ├── luci-app-cjdns ├── luasrc │ ├── view │ │ ├── admin_status │ │ │ └── index │ │ │ │ └── cjdns.htm │ │ └── cjdns │ │ │ ├── value.htm │ │ │ └── status.htm │ ├── model │ │ └── cbi │ │ │ └── cjdns │ │ │ ├── overview.lua │ │ │ ├── cjdrouteconf.lua │ │ │ ├── iptunnel.lua │ │ │ ├── settings.lua │ │ │ └── peering.lua │ └── controller │ │ └── cjdns.lua ├── files │ └── luci-app-cjdns.json └── Makefile ├── vis ├── files │ └── etc │ │ ├── config │ │ └── vis │ │ └── init.d │ │ └── vis ├── Makefile └── patches │ └── 0001-Allow-one-to-disable-forking-to-background-in-debug_.patch ├── cjdns ├── files │ ├── luci-app-cjdns.json │ ├── cjdns.init │ ├── cjdrouteconf │ └── cjdns.defaults ├── lua │ └── cjdns │ │ ├── common.lua │ │ ├── init.lua │ │ ├── admin.lua │ │ └── udp.lua ├── patches │ ├── 040-gyp-python_310.patch │ ├── 001-five-mins-builder-zonk.patch │ ├── 020-prefer-python2.patch │ └── 030-fix-invalid-pointer.patch └── Makefile ├── ohybridproxy ├── files │ ├── ohybridproxy.hotplug │ ├── ohybridproxy.config │ └── ohybridproxy.init ├── patches │ └── 100-CMakeLists-support-CMake-4.0-version.patch └── Makefile ├── alfred ├── files │ ├── alfred.config │ ├── alfred.init │ └── bat-hosts.lua ├── Config.in └── Makefile ├── .github ├── pull_request_template ├── workflows │ ├── multi-arch-test-build.yml │ ├── scripts │ │ └── ci_helpers.sh │ └── formal.yml └── issue_template ├── nodogsplash ├── files │ ├── usr │ │ └── lib │ │ │ └── nodogsplash │ │ │ └── restart.sh │ └── etc │ │ ├── uci-defaults │ │ └── 40_nodogsplash │ │ ├── init.d │ │ └── nodogsplash │ │ └── config │ │ └── nodogsplash └── Makefile ├── naywatch ├── files │ ├── naywatch.config │ ├── naywatch.init │ └── naywatch.sh └── Makefile ├── prince ├── files │ ├── prince.conf │ └── prince.init ├── patches │ └── 010-gcc10.patch └── Makefile ├── batmand ├── files │ └── etc │ │ ├── config │ │ └── batmand │ │ └── init.d │ │ └── batmand └── Makefile ├── ndppd ├── files │ └── ndppd.init ├── patches │ ├── 0001-Version-bump.patch │ ├── 0003-fix-poll-header.patch │ └── 0002-Fixes-strerror_r-GNU-XSI.patch └── Makefile ├── pimbd ├── files │ ├── firewall-uci.sh │ ├── pimb.config │ └── pimbd.init ├── patches │ └── 100-CMakeLists-bump-to-3.10-to-support-CMake-4.0.patch └── Makefile ├── bmx7 ├── files │ └── etc │ │ ├── init.d │ │ └── bmx7 │ │ └── config │ │ └── bmx7 ├── patches │ └── 020-siocgstamp.patch └── Makefile ├── README.md ├── batman-adv ├── files │ ├── lib │ │ └── netifd │ │ │ └── proto │ │ │ ├── batadv_vlan.sh │ │ │ ├── batadv_hardif.sh │ │ │ └── batadv.sh │ └── etc │ │ └── uci-defaults │ │ └── 99-migrate-batadv_hardif ├── patches │ └── 0001-fix-batadv_is_cfg80211_netdev.patch ├── Config.in ├── Makefile └── src │ └── compat-hacks.h ├── MAINTAINERS ├── ahcpd ├── files │ ├── ahcpd.config │ └── ahcpd.init └── Makefile ├── babel-pinger └── Makefile ├── babeld ├── files │ ├── babeld.conf │ ├── babeld.config │ └── babeld.init ├── Makefile ├── src │ └── ubus.h └── patches │ └── 600-add-ubus.patch ├── mesh11sd └── Makefile ├── opennds └── Makefile └── batctl └── Makefile /olsrd/files/olsrd_secure_key: -------------------------------------------------------------------------------- 1 | 1234567890123456 -------------------------------------------------------------------------------- /bird2/test.sh: -------------------------------------------------------------------------------- 1 | bird --version 2>&1 | grep "$PKG_VERSION" 2 | -------------------------------------------------------------------------------- /bird3/test.sh: -------------------------------------------------------------------------------- 1 | bird --version 2>&1 | grep "$PKG_VERSION" 2 | -------------------------------------------------------------------------------- /luci-app-cjdns/luasrc/view/admin_status/index/cjdns.htm: -------------------------------------------------------------------------------- 1 | <%+cjdns/status%> 2 | -------------------------------------------------------------------------------- /vis/files/etc/config/vis: -------------------------------------------------------------------------------- 1 | config vis general 2 | option interface ath0 3 | 4 | -------------------------------------------------------------------------------- /cjdns/files/luci-app-cjdns.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": "cjdns", 3 | "init": "cjdns" 4 | } 5 | -------------------------------------------------------------------------------- /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.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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.github/workflows/scripts/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.github/workflows/formal.yml: -------------------------------------------------------------------------------- 1 | name: Test Formalities 2 | 3 | on: 4 | pull_request: 5 | 6 | permissions: 7 | contents: read 8 | pull-requests: write 9 | 10 | jobs: 11 | formalities: 12 | name: Test Formalities 13 | uses: openwrt/actions-shared-workflows/.github/workflows/formal.yml@main 14 | # with: 15 | # # Post formality check summaries to the PR. 16 | # # Repo's permissions need to be updated for actions to modify PRs: 17 | # # https://docs.github.com/en/rest/issues/comments?apiVersion=2022-11-28#create-an-issue-comment 18 | # post_comment: true 19 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | @@ -309,8 +309,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 | -------------------------------------------------------------------------------- /pimbd/patches/100-CMakeLists-bump-to-3.10-to-support-CMake-4.0.patch: -------------------------------------------------------------------------------- 1 | From 415b9a4e6cb043fb9bbf07840b5150f0b0380f4c Mon Sep 17 00:00:00 2001 2 | From: Christian Marangi 3 | Date: Thu, 13 Nov 2025 15:45:58 +0100 4 | Subject: [PATCH 1/2] CMakeLists: bump to 3.10 to support CMake >= 4.0 5 | 6 | Bump to minimum required version for CMake to 3.10 to support 7 | CMake >= 4.0 version. 8 | 9 | Signed-off-by: Christian Marangi 10 | --- 11 | CMakeLists.txt | 2 +- 12 | 1 file changed, 1 insertion(+), 1 deletion(-) 13 | 14 | --- a/CMakeLists.txt 15 | +++ b/CMakeLists.txt 16 | @@ -1,4 +1,4 @@ 17 | -cmake_minimum_required(VERSION 2.8.8) 18 | +cmake_minimum_required(VERSION 3.10) 19 | 20 | project(pimbd C) 21 | 22 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ohybridproxy/patches/100-CMakeLists-support-CMake-4.0-version.patch: -------------------------------------------------------------------------------- 1 | From c1352c9df7f1dea1a86e1deece87cfbff4d04789 Mon Sep 17 00:00:00 2001 2 | From: Christian Marangi 3 | Date: Thu, 13 Nov 2025 16:12:16 +0100 4 | Subject: [PATCH] CMakeLists: support CMake >= 4.0 version 5 | 6 | Bump minimum CMake version to 3.10 to support CMake >= 4.0 version. 7 | 8 | Signed-off-by: Christian Marangi 9 | --- 10 | CMakeLists.txt | 2 +- 11 | 1 file changed, 1 insertion(+), 1 deletion(-) 12 | 13 | diff --git a/CMakeLists.txt b/CMakeLists.txt 14 | index 1c970d9..cfb878e 100644 15 | --- a/CMakeLists.txt 16 | +++ b/CMakeLists.txt 17 | @@ -1,4 +1,4 @@ 18 | -cmake_minimum_required(VERSION 2.8) 19 | +cmake_minimum_required(VERSION 3.10) 20 | project(ohybridproxy C) 21 | 22 | set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") 23 | -- 24 | 2.51.0 25 | 26 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /bird2/patches/0001-birdc-Use-var-tmp-for-history-file.patch: -------------------------------------------------------------------------------- 1 | From e77b14853c1dcb3034e1af155f49e3b943203c4e Mon Sep 17 00:00:00 2001 2 | From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= 3 | Date: Mon, 24 Nov 2025 12:57:52 +0100 4 | Subject: [PATCH] birdc: Use /var/tmp for history file 5 | MIME-Version: 1.0 6 | Content-Type: text/plain; charset=UTF-8 7 | Content-Transfer-Encoding: 8bit 8 | 9 | We don't want birdc to write its history file to flash, so hard-code the 10 | history file to /var/tmp instead. 11 | 12 | Signed-off-by: Toke Høiland-Jørgensen 13 | --- 14 | client/birdc.c | 4 +--- 15 | 1 file changed, 1 insertion(+), 3 deletions(-) 16 | 17 | --- a/client/birdc.c 18 | +++ b/client/birdc.c 19 | @@ -146,9 +146,7 @@ input_help(int arg, int key UNUSED) 20 | void 21 | history_init(void) 22 | { 23 | - const char *homedir = getenv("HOME"); 24 | - if (!homedir) 25 | - homedir = "."; 26 | + const char *homedir = "/var/tmp"; 27 | history_file = malloc(strlen(homedir) + sizeof(HISTORY)); 28 | if (!history_file) 29 | die("couldn't alloc enough memory for history file name"); 30 | -------------------------------------------------------------------------------- /bird3/patches/0001-birdc-Use-var-tmp-for-history-file.patch: -------------------------------------------------------------------------------- 1 | From e77b14853c1dcb3034e1af155f49e3b943203c4e Mon Sep 17 00:00:00 2001 2 | From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= 3 | Date: Mon, 24 Nov 2025 12:57:52 +0100 4 | Subject: [PATCH] birdc: Use /var/tmp for history file 5 | MIME-Version: 1.0 6 | Content-Type: text/plain; charset=UTF-8 7 | Content-Transfer-Encoding: 8bit 8 | 9 | We don't want birdc to write its history file to flash, so hard-code the 10 | history file to /var/tmp instead. 11 | 12 | Signed-off-by: Toke Høiland-Jørgensen 13 | --- 14 | client/birdc.c | 4 +--- 15 | 1 file changed, 1 insertion(+), 3 deletions(-) 16 | 17 | --- a/client/birdc.c 18 | +++ b/client/birdc.c 19 | @@ -146,9 +146,7 @@ input_help(int arg, int key UNUSED) 20 | void 21 | history_init(void) 22 | { 23 | - const char *homedir = getenv("HOME"); 24 | - if (!homedir) 25 | - homedir = "."; 26 | + const char *homedir = "/var/tmp"; 27 | history_file = malloc(strlen(homedir) + sizeof(HISTORY)); 28 | if (!history_file) 29 | die("couldn't alloc enough memory for history file name"); 30 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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:=https://www.irif.fr/~jch/software/files/ 13 | PKG_HASH:=c411430bb102f08d3d68d2fb5010b5da0149908b671ac0fb12abd8c8ee6380c5 14 | 15 | PKG_MAINTAINER:=Gabriel Kerneis 16 | 17 | include $(INCLUDE_DIR)/package.mk 18 | 19 | define Package/babel-pinger 20 | SECTION:=net 21 | CATEGORY:=Network 22 | SUBMENU:=Routing and Redirection 23 | TITLE:=Babel-pinger 24 | URL:=https://www.irif.fr/~jch/software/babel/ 25 | DEPENDS:=+librt 26 | endef 27 | 28 | define Package/babel-pinger/description 29 | Babel-pinger is a hack to export a default route into Babel for people 30 | using DHCP to configure their routers rather than speaking to their 31 | upstream provider with a proper routing protocol. 32 | endef 33 | 34 | MAKE_FLAGS+= \ 35 | CFLAGS="$(TARGET_CFLAGS)" \ 36 | 37 | define Package/babel-pinger/install 38 | $(INSTALL_DIR) $(1)/usr/sbin 39 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/babel-pinger $(1)/usr/sbin/ 40 | endef 41 | 42 | $(eval $(call BuildPackage,babel-pinger)) 43 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /naywatch/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-only 2 | # 3 | # Copyright (C) 2021 Nick Hainke 4 | # 5 | 6 | include $(TOPDIR)/rules.mk 7 | 8 | PKG_NAME:=naywatch 9 | PKG_VERSION:=1 10 | PKG_RELEASE:=8 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_CONF) ./files/naywatch.config $(1)/etc/config/naywatch 48 | endef 49 | 50 | $(eval $(call BuildPackage,naywatch)) 51 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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:=10 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 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_CONF) ./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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | PKG_RELEASE:=2 12 | 13 | PKG_SOURCE_PROTO:=git 14 | PKG_SOURCE_URL:=https://git.open-mesh.org/batmand.git 15 | PKG_MIRROR_HASH:=bb8b74bea9f70ae91b3ef3ef089aa3149e3f5335b6e1db31ea7870d899b0a176 16 | PKG_SOURCE_VERSION:=2f62b17d4132f82c4716b672101eb7faa916192a 17 | PKG_SOURCE_DATE:=2022-12-31 18 | 19 | PKG_LICENSE:=GPL-2.0-only 20 | PKG_MAINTAINER:=Corinna Aichele 21 | 22 | PKG_BUILD_PARALLEL:=1 23 | 24 | include $(INCLUDE_DIR)/package.mk 25 | 26 | define Package/batmand 27 | SECTION:=net 28 | CATEGORY:=Network 29 | SUBMENU:=Routing and Redirection 30 | TITLE:=B.A.T.M.A.N. layer 3 routing daemon 31 | URL:=https://www.open-mesh.org/ 32 | DEPENDS:=+libpthread +kmod-tun 33 | endef 34 | 35 | define Package/batmand/description 36 | B.A.T.M.A.N. layer 3 routing daemon 37 | endef 38 | 39 | MAKE_FLAGS += \ 40 | EXTRA_CFLAGS='-DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA -DREVISION_VERSION=\"\ rv$(PKG_SOURCE_VERSION)\" -D_GNU_SOURCE' \ 41 | REVISION="$(PKG_SOURCE_VERSION)" \ 42 | CC="$(TARGET_CC)" \ 43 | UNAME="Linux" \ 44 | batmand 45 | 46 | define Package/batmand/install 47 | $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d 48 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/batmand $(1)/usr/sbin/ 49 | $(INSTALL_BIN) ./files/etc/init.d/batmand $(1)/etc/init.d 50 | $(INSTALL_CONF) ./files/etc/config/batmand $(1)/etc/config 51 | endef 52 | 53 | define Package/batmand/conffiles 54 | /etc/config/batmand 55 | endef 56 | 57 | $(eval $(call BuildPackage,batmand)) 58 | -------------------------------------------------------------------------------- /pimbd/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=pimbd 4 | PKG_RELEASE:=5 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 |
-------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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_MCAST 47 | bool "Multicast optimisation" 48 | depends on PACKAGE_kmod-batman-adv 49 | default y 50 | help 51 | This option enables the multicast optimisation which aims to 52 | reduce the air overhead while improving the reliability of 53 | multicast messages. 54 | 55 | config BATMAN_ADV_DEBUG 56 | bool "B.A.T.M.A.N. debugging" 57 | depends on PACKAGE_kmod-batman-adv 58 | help 59 | This is an option for use by developers; most people should 60 | say N here. This enables compilation of support for 61 | outputting debugging information to the debugfs log or tracing 62 | buffer. The output is controlled via the batadv netdev specific 63 | log_level setting. 64 | 65 | config BATMAN_ADV_TRACING 66 | bool "B.A.T.M.A.N. tracing support" 67 | depends on PACKAGE_kmod-batman-adv 68 | select KERNEL_FTRACE 69 | select KERNEL_ENABLE_DEFAULT_TRACERS 70 | help 71 | This is an option for use by developers; most people should 72 | say N here. Select this option to gather traces like the debug 73 | messages using the generic tracing infrastructure of the kernel. 74 | BATMAN_ADV_DEBUG must also be selected to get trace events for 75 | batadv_dbg. 76 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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.5 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:=75c12c1c3c39cdb2246f61fca5d4d9f61e240fe2827129fab7a03deef855ffe8 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_CONF) ./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 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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.5 7 | PKG_RELEASE:=2 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:=1adbe823991e9718e307f3766ea96405fe1f284c19bcb98c662d7a1faa324c35 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_MCAST \ 27 | CONFIG_BATMAN_ADV_DEBUG \ 28 | CONFIG_BATMAN_ADV_TRACING 29 | 30 | include $(INCLUDE_DIR)/kernel.mk 31 | include $(INCLUDE_DIR)/package.mk 32 | 33 | define KernelPackage/batman-adv 34 | SUBMENU:=Network Support 35 | TITLE:=B.A.T.M.A.N. Adv 36 | URL:=https://www.open-mesh.org/ 37 | DEPENDS:=+BATMAN_ADV_BLA:kmod-lib-crc16 +kmod-lib-crc32c +kmod-cfg80211 +batctl 38 | FILES:=$(PKG_BUILD_DIR)/net/batman-adv/batman-adv.$(LINUX_KMOD_SUFFIX) 39 | AUTOLOAD:=$(call AutoProbe,batman-adv) 40 | endef 41 | 42 | define KernelPackage/batman-adv/description 43 | B.A.T.M.A.N. (better approach to mobile ad-hoc networking) is 44 | a routing protocol for multi-hop ad-hoc mesh networks. The 45 | networks may be wired or wireless. See 46 | https://www.open-mesh.org/ for more information and user space 47 | tools. This package builds version $(PKG_VERSION) of the kernel 48 | module. 49 | endef 50 | 51 | define KernelPackage/batman-adv/config 52 | source "$(SOURCE)/Config.in" 53 | endef 54 | 55 | define Package/kmod-batman-adv/conffiles 56 | /etc/config/batman-adv 57 | endef 58 | 59 | PKG_EXTRA_KCONFIG:= \ 60 | CONFIG_BATMAN_ADV=m \ 61 | CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_BATMAN_ADV_DEBUG),y,n) \ 62 | CONFIG_BATMAN_ADV_BLA=$(if $(CONFIG_BATMAN_ADV_BLA),y,n) \ 63 | CONFIG_BATMAN_ADV_DAT=$(if $(CONFIG_BATMAN_ADV_DAT),y,n) \ 64 | CONFIG_BATMAN_ADV_MCAST=$(if $(CONFIG_BATMAN_ADV_MCAST),y,n) \ 65 | CONFIG_BATMAN_ADV_BATMAN_V=$(if $(CONFIG_BATMAN_ADV_BATMAN_V),y,n) \ 66 | CONFIG_BATMAN_ADV_TRACING=$(if $(CONFIG_BATMAN_ADV_TRACING),y,n) \ 67 | 68 | PKG_EXTRA_CFLAGS:= \ 69 | $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(PKG_EXTRA_KCONFIG)))) \ 70 | $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(PKG_EXTRA_KCONFIG)))) \ 71 | 72 | NOSTDINC_FLAGS = \ 73 | $(KERNEL_NOSTDINC_FLAGS) \ 74 | -I$(PKG_BUILD_DIR)/net/batman-adv \ 75 | -I$(STAGING_DIR)/usr/include/mac80211-backport \ 76 | -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \ 77 | -I$(STAGING_DIR)/usr/include/mac80211 \ 78 | -I$(STAGING_DIR)/usr/include/mac80211/uapi \ 79 | -I$(PKG_BUILD_DIR)/include/ \ 80 | -include backport/autoconf.h \ 81 | -include backport/backport.h \ 82 | -include $(PKG_BUILD_DIR)/compat-hacks.h \ 83 | -DBATADV_SOURCE_VERSION=\\\"$(PKG_VERSION)-openwrt-$(PKG_RELEASE)\\\" 84 | 85 | define Build/Compile 86 | $(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \ 87 | $(KERNEL_MAKE_FLAGS) \ 88 | M="$(PKG_BUILD_DIR)/net/batman-adv" \ 89 | $(PKG_EXTRA_KCONFIG) \ 90 | EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS)" \ 91 | NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \ 92 | modules 93 | endef 94 | 95 | define KernelPackage/batman-adv/install 96 | $(CP) ./files/. $(1)/ 97 | endef 98 | 99 | $(eval $(call KernelPackage,batman-adv)) 100 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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_int 'orig_interval' 28 | proto_config_add_string 'routing_algo' 29 | } 30 | 31 | proto_batadv_setup() { 32 | local config="$1" 33 | local iface="$config" 34 | 35 | local aggregated_ogms 36 | local ap_isolation 37 | local bonding 38 | local bridge_loop_avoidance 39 | local distributed_arp_table 40 | local fragmentation 41 | local gw_bandwidth 42 | local gw_mode 43 | local gw_sel_class 44 | local hop_penalty 45 | local isolation_mark 46 | local log_level 47 | local multicast_fanout 48 | local multicast_mode 49 | local orig_interval 50 | local routing_algo 51 | 52 | json_get_vars aggregated_ogms 53 | json_get_vars ap_isolation 54 | json_get_vars bonding 55 | json_get_vars bridge_loop_avoidance 56 | json_get_vars distributed_arp_table 57 | json_get_vars fragmentation 58 | json_get_vars gw_bandwidth 59 | json_get_vars gw_mode 60 | json_get_vars gw_sel_class 61 | json_get_vars hop_penalty 62 | json_get_vars isolation_mark 63 | json_get_vars log_level 64 | json_get_vars multicast_fanout 65 | json_get_vars multicast_mode 66 | json_get_vars orig_interval 67 | json_get_vars routing_algo 68 | 69 | set_default routing_algo 'BATMAN_IV' 70 | 71 | batctl routing_algo "$routing_algo" 72 | batctl meshif "$iface" interface create 73 | 74 | [ -n "$aggregated_ogms" ] && batctl meshif "$iface" aggregation "$aggregated_ogms" 75 | [ -n "$ap_isolation" ] && batctl meshif "$iface" ap_isolation "$ap_isolation" 76 | [ -n "$bonding" ] && batctl meshif "$iface" bonding "$bonding" 77 | [ -n "$bridge_loop_avoidance" ] && batctl meshif "$iface" bridge_loop_avoidance "$bridge_loop_avoidance" 2>&- 78 | [ -n "$distributed_arp_table" ] && batctl meshif "$iface" distributed_arp_table "$distributed_arp_table" 2>&- 79 | [ -n "$fragmentation" ] && batctl meshif "$iface" fragmentation "$fragmentation" 80 | 81 | case "$gw_mode" in 82 | server) 83 | if [ -n "$gw_bandwidth" ]; then 84 | batctl meshif "$iface" gw_mode "server" "$gw_bandwidth" 85 | else 86 | batctl meshif "$iface" gw_mode "server" 87 | fi 88 | ;; 89 | client) 90 | if [ -n "$gw_sel_class" ]; then 91 | batctl meshif "$iface" gw_mode "client" "$gw_sel_class" 92 | else 93 | batctl meshif "$iface" gw_mode "client" 94 | fi 95 | ;; 96 | *) 97 | batctl meshif "$iface" gw_mode "off" 98 | ;; 99 | esac 100 | 101 | [ -n "$hop_penalty" ] && batctl meshif "$iface" hop_penalty "$hop_penalty" 102 | [ -n "$isolation_mark" ] && batctl meshif "$iface" isolation_mark "$isolation_mark" 103 | [ -n "$multicast_fanout" ] && batctl meshif "$iface" multicast_fanout "$multicast_fanout" 104 | [ -n "$multicast_mode" ] && batctl meshif "$iface" multicast_mode "$multicast_mode" 2>&- 105 | [ -n "$log_level" ] && batctl meshif "$iface" loglevel "$log_level" 2>&- 106 | [ -n "$orig_interval" ] && batctl meshif "$iface" orig_interval "$orig_interval" 107 | 108 | proto_init_update "$iface" 1 109 | proto_send_update "$config" 110 | } 111 | 112 | proto_batadv_teardown() { 113 | local config="$1" 114 | local iface="$config" 115 | 116 | batctl meshif "$iface" interface destroy 117 | } 118 | 119 | add_protocol batadv 120 | -------------------------------------------------------------------------------- /batman-adv/files/etc/uci-defaults/99-migrate-batadv_hardif: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This UCI-Defaults script will split the batadv proto network interfaces 4 | # in batadv_hardif and batadv proto. The configuration options from 5 | # /etc/config/batman-adv will be moved to the latter. 6 | 7 | . /lib/functions.sh 8 | 9 | proto_batadv_to_batadv_hardif() { 10 | local section="$1" 11 | local proto 12 | local mesh 13 | local routing_algo 14 | 15 | config_get proto "${section}" proto 16 | config_get mesh "${section}" mesh 17 | config_get routing_algo "${section}" routing_algo 18 | 19 | if [ -z "$mesh" -o "${proto}" != "batadv" ]; then 20 | continue 21 | fi 22 | 23 | uci set network."${section}".proto="batadv_hardif" 24 | uci rename network."${section}".mesh="master" 25 | uci delete network."${section}".routing_algo 26 | 27 | # create new section or adjust existing one 28 | uci set network."${mesh}"=interface 29 | uci set network."${mesh}".proto=batadv 30 | [ -n "${routing_algo}" ] && uci set network."${mesh}".routing_algo="${routing_algo}" 31 | } 32 | 33 | mv_batadv_config_section() { 34 | local section="$1" 35 | local aggregated_ogms 36 | local ap_isolation 37 | local bonding 38 | local bridge_loop_avoidance 39 | local distributed_arp_table 40 | local fragmentation 41 | local gw_bandwidth 42 | local gw_mode 43 | local gw_sel_class 44 | local hop_penalty 45 | local isolation_mark 46 | local log_level 47 | local multicast_mode 48 | local orig_interval 49 | 50 | config_get aggregated_ogms "${section}" aggregated_ogms 51 | config_get ap_isolation "${section}" ap_isolation 52 | config_get bonding "${section}" bonding 53 | config_get bridge_loop_avoidance "${section}" bridge_loop_avoidance 54 | config_get distributed_arp_table "${section}" distributed_arp_table 55 | config_get fragmentation "${section}" fragmentation 56 | config_get gw_bandwidth "${section}" gw_bandwidth 57 | config_get gw_mode "${section}" gw_mode 58 | config_get gw_sel_class "${section}" gw_sel_class 59 | config_get hop_penalty "${section}" hop_penalty 60 | config_get isolation_mark "${section}" isolation_mark 61 | config_get log_level "${section}" log_level 62 | config_get multicast_mode "${section}" multicast_mode 63 | config_get orig_interval "${section}" orig_interval 64 | 65 | # update section in case it exists 66 | [ -n "${aggregated_ogms}" ] && uci set network."${section}".aggregated_ogms="${aggregated_ogms}" 67 | [ -n "${ap_isolation}" ] && uci set network."${section}".ap_isolation="${ap_isolation}" 68 | [ -n "${bonding}" ] && uci set network."${section}".bonding="${bonding}" 69 | [ -n "${bridge_loop_avoidance}" ] && uci set network."${section}".bridge_loop_avoidance="${bridge_loop_avoidance}" 70 | [ -n "${distributed_arp_table}" ] && uci set network."${section}".distributed_arp_table="${distributed_arp_table}" 71 | [ -n "${fragmentation}" ] && uci set network."${section}".fragmentation="${fragmentation}" 72 | [ -n "${gw_bandwidth}" ] && uci set network."${section}".gw_bandwidth="${gw_bandwidth}" 73 | [ -n "${gw_mode}" ] && uci set network."${section}".gw_mode="${gw_mode}" 74 | [ -n "${gw_sel_class}" ] && uci set network."${section}".gw_sel_class="${gw_sel_class}" 75 | [ -n "${hop_penalty}" ] && uci set network."${section}".hop_penalty="${hop_penalty}" 76 | [ -n "${isolation_mark}" ] && uci set network."${section}".isolation_mark="${isolation_mark}" 77 | [ -n "${log_level}" ] && uci set network."${section}".log_level="${log_level}" 78 | [ -n "${multicast_mode}" ] && uci set network."${section}".multicast_mode="${multicast_mode}" 79 | [ -n "${orig_interval}" ] && uci set network."${section}".orig_interval="${orig_interval}" 80 | } 81 | 82 | if [ -f /etc/config/batman-adv ]; then 83 | config_load network 84 | config_foreach proto_batadv_to_batadv_hardif 'interface' 85 | uci commit network 86 | 87 | config_load batman-adv 88 | config_foreach mv_batadv_config_section 'mesh' 89 | uci commit network 90 | 91 | rm -f /etc/config/batman-adv 92 | fi 93 | 94 | exit 0 95 | -------------------------------------------------------------------------------- /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, 15, 0) 9 | #include 10 | #endif /* LINUX_VERSION_IS_LESS(6, 15, 0) */ 11 | 12 | #if LINUX_VERSION_IS_LESS(6, 16, 0) 13 | 14 | #define timer_container_of(var, callback_timer, timer_fieldname) \ 15 | from_timer(var, callback_timer, timer_fieldname) 16 | 17 | #endif /* LINUX_VERSION_IS_LESS(6, 16, 0) */ 18 | 19 | #if LINUX_VERSION_IS_LESS(6, 16, 0) || !defined(CONFIG_NET_CRC32C) 20 | 21 | #include 22 | #include 23 | 24 | static inline u32 batadv_skb_crc32c(struct sk_buff *skb, int offset, 25 | int len, u32 crc) 26 | { 27 | unsigned int to = offset + len; 28 | unsigned int consumed = 0; 29 | struct skb_seq_state st; 30 | unsigned int l; 31 | const u8 *data; 32 | 33 | if (len <= 0) 34 | return crc; 35 | 36 | skb_prepare_seq_read(skb, offset, to, &st); 37 | while ((l = skb_seq_read(consumed, &data, &st)) != 0) { 38 | crc = crc32c(crc, data, l); 39 | consumed += l; 40 | } 41 | 42 | return crc; 43 | } 44 | 45 | #define skb_crc32c batadv_skb_crc32c 46 | 47 | #endif /* LINUX_VERSION_IS_LESS(6, 16, 0) || !defined(CONFIG_NET_CRC32C) */ 48 | 49 | /* */ 50 | 51 | #include 52 | #include_next 53 | 54 | #include 55 | 56 | #ifdef DECLARE_EWMA 57 | #undef DECLARE_EWMA 58 | #endif /* DECLARE_EWMA */ 59 | 60 | /* 61 | * Exponentially weighted moving average (EWMA) 62 | * 63 | * This implements a fixed-precision EWMA algorithm, with both the 64 | * precision and fall-off coefficient determined at compile-time 65 | * and built into the generated helper funtions. 66 | * 67 | * The first argument to the macro is the name that will be used 68 | * for the struct and helper functions. 69 | * 70 | * The second argument, the precision, expresses how many bits are 71 | * used for the fractional part of the fixed-precision values. 72 | * 73 | * The third argument, the weight reciprocal, determines how the 74 | * new values will be weighed vs. the old state, new values will 75 | * get weight 1/weight_rcp and old values 1-1/weight_rcp. Note 76 | * that this parameter must be a power of two for efficiency. 77 | */ 78 | 79 | #define DECLARE_EWMA(name, _precision, _weight_rcp) \ 80 | struct ewma_##name { \ 81 | unsigned long internal; \ 82 | }; \ 83 | static inline void ewma_##name##_init(struct ewma_##name *e) \ 84 | { \ 85 | BUILD_BUG_ON(!__builtin_constant_p(_precision)); \ 86 | BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \ 87 | /* \ 88 | * Even if you want to feed it just 0/1 you should have \ 89 | * some bits for the non-fractional part... \ 90 | */ \ 91 | BUILD_BUG_ON((_precision) > 30); \ 92 | BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \ 93 | e->internal = 0; \ 94 | } \ 95 | static inline unsigned long \ 96 | ewma_##name##_read(struct ewma_##name *e) \ 97 | { \ 98 | BUILD_BUG_ON(!__builtin_constant_p(_precision)); \ 99 | BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \ 100 | BUILD_BUG_ON((_precision) > 30); \ 101 | BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \ 102 | return e->internal >> (_precision); \ 103 | } \ 104 | static inline void ewma_##name##_add(struct ewma_##name *e, \ 105 | unsigned long val) \ 106 | { \ 107 | unsigned long internal = READ_ONCE(e->internal); \ 108 | unsigned long weight_rcp = ilog2(_weight_rcp); \ 109 | unsigned long precision = _precision; \ 110 | \ 111 | BUILD_BUG_ON(!__builtin_constant_p(_precision)); \ 112 | BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \ 113 | BUILD_BUG_ON((_precision) > 30); \ 114 | BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \ 115 | \ 116 | WRITE_ONCE(e->internal, internal ? \ 117 | (((internal << weight_rcp) - internal) + \ 118 | (val << precision)) >> weight_rcp : \ 119 | (val << precision)); \ 120 | } 121 | 122 | /* */ 123 | -------------------------------------------------------------------------------- /bird3/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-only 2 | 3 | include $(TOPDIR)/rules.mk 4 | 5 | PKG_NAME:=bird3 6 | PKG_VERSION:=3.1.4 7 | PKG_RELEASE:=2 8 | 9 | PKG_SOURCE:=bird-$(PKG_VERSION).tar.gz 10 | PKG_SOURCE_URL:=https://bird.nic.cz/download/ 11 | PKG_HASH:=a5757b60e1de9ac5efc9765f87b7c8baefa31db789966c83870d070f7608278c 12 | 13 | PKG_MAINTAINER:=Toke Høiland-Jørgensen , Nick Hainke 14 | PKG_LICENSE:=GPL-2.0-or-later 15 | 16 | PKG_BUILD_DEPENDS:=ncurses readline 17 | PKG_BUILD_DIR:=$(BUILD_DIR)/bird-$(PKG_VERSION) 18 | 19 | include $(INCLUDE_DIR)/package.mk 20 | 21 | define Package/bird3 22 | TITLE:=The BIRD Internet Routing Daemon (v3) 23 | URL:=https://bird.nic.cz/ 24 | SECTION:=net 25 | CATEGORY:=Network 26 | SUBMENU:=Routing and Redirection 27 | DEPENDS:=+libpthread +libatomic 28 | CONFLICTS:=bird2 29 | endef 30 | 31 | define Package/bird3c 32 | TITLE:=The BIRD command-line client (v3) 33 | URL:=https://bird.nic.cz/ 34 | SECTION:=net 35 | CATEGORY:=Network 36 | SUBMENU:=Routing and Redirection 37 | DEPENDS:=+bird3 +libreadline +libncurses 38 | CONFLICTS:=bird2 39 | endef 40 | 41 | define Package/bird3cl 42 | TITLE:=The BIRD lightweight command-line client (v2) 43 | URL:=https://bird.nic.cz/ 44 | SECTION:=net 45 | CATEGORY:=Network 46 | SUBMENU:=Routing and Redirection 47 | DEPENDS:=+bird3 48 | CONFLICTS:=bird2 49 | endef 50 | 51 | define Package/bird3/Default/description 52 | BIRD is an internet routing daemon which manages TCP/IP routing tables 53 | with support of modern routing protocols, easy to use configuration 54 | interface and powerful route filtering language. It is lightweight and 55 | efficient and therefore appropriate for small embedded routers. 56 | endef 57 | 58 | define Package/bird3/description 59 | $(call Package/bird3/Default/description) 60 | 61 | BIRD supports OSPFv2, RIPv2, Babel and BGP protocols for IPv4 and 62 | OSPFv3, RIPng, Babel and BGP protocols for IPv6. 63 | 64 | In BGP, BIRD supports communities, multiprotocol extensions, MD5 65 | authentication, 32bit AS numbers and could act as a route server or a 66 | route reflector. BIRD also supports multiple RIBs, multiple kernel 67 | routing tables and redistribution between the protocols with a powerful 68 | configuration syntax. 69 | 70 | This is the 3.0 branch of Bird which is a multithreaded rewrite. 71 | endef 72 | 73 | define Package/bird3c/description 74 | $(call Package/bird3/Default/description) 75 | 76 | This is a BIRD command-line client. It is used to send commands to BIRD, 77 | commands can perform simple actions such as enabling/disabling of 78 | protocols, telling BIRD to show various information, telling it to show 79 | a routing table filtered by a filter, or asking BIRD to reconfigure. 80 | 81 | Unless you can't afford dependency on ncurses and readline, you 82 | should install BIRD command-line client together with BIRD. 83 | endef 84 | 85 | define Package/bird3cl/description 86 | $(call Package/bird3/Default/description) 87 | 88 | This is a BIRD lightweight command-line client. It is used to send commands 89 | to BIRD, commands can perform simple actions such as enabling/disabling of 90 | protocols, telling BIRD to show various information, telling it to show 91 | a routing table filtered by a filter, or asking BIRD to reconfigure. 92 | endef 93 | 94 | CONFIGURE_ARGS += --disable-libssh 95 | TARGET_LDFLAGS += -latomic 96 | 97 | define Package/bird3/conffiles 98 | /etc/bird.conf 99 | /etc/bird4.conf 100 | /etc/bird6.conf 101 | endef 102 | 103 | define Package/bird3/install 104 | $(INSTALL_DIR) $(1)/usr/sbin 105 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/bird $(1)/usr/sbin/ 106 | $(INSTALL_DIR) $(1)/etc 107 | $(INSTALL_DATA) $(PKG_BUILD_DIR)/doc/bird.conf.example $(1)/etc/bird.conf 108 | $(INSTALL_DIR) $(1)/etc/init.d 109 | $(INSTALL_BIN) ./files/bird.init $(1)/etc/init.d/bird 110 | endef 111 | 112 | define Package/bird3c/install 113 | $(INSTALL_DIR) $(1)/usr/sbin 114 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/birdc $(1)/usr/sbin/ 115 | endef 116 | 117 | define Package/bird3cl/install 118 | $(INSTALL_DIR) $(1)/usr/sbin 119 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/birdcl $(1)/usr/sbin/ 120 | endef 121 | 122 | $(eval $(call BuildPackage,bird3)) 123 | $(eval $(call BuildPackage,bird3c)) 124 | $(eval $(call BuildPackage,bird3cl)) 125 | -------------------------------------------------------------------------------- /babeld/files/babeld.config: -------------------------------------------------------------------------------- 1 | package babeld 2 | 3 | # Detailed documentation: https://openwrt.org/docs/guide-user/services/babeld 4 | 5 | # Babeld reads options from the following files (the last one takes precedence 6 | # if an option is defined in several places): 7 | # - the file defined by the option conf_file (default: /etc/babeld.conf), 8 | # - *.conf files in the directory defined by conf_dir (default: /tmp/babel.d/), 9 | # - this UCI configuration file. 10 | 11 | # See "man babeld" for all available options ("Global options"). 12 | # Important: remember to use '_' instead of '-' in option names. 13 | config general 14 | # option 'random_id' 'true' 15 | # option 'debug' '1' 16 | # option 'local_port' '33123' 17 | # option 'log_file' '/var/log/babeld.log' 18 | ## Enable ipv6-subtrees by default since OpenWrt should ship with a 19 | ## recent enough kernel for it to work. 20 | option 'ipv6_subtrees' 'true' 21 | # list 'import_table' '42' 22 | # list 'import_table' '100' 23 | ## Alternative configuration file and directory. 24 | ## See comment at the top of this file for more details. 25 | # option 'conf_file' '/etc/babeld.conf' 26 | # option 'conf_dir' '/tmp/babel.d/' 27 | # option 'ubus_bindings' 'false' 28 | 29 | config interface 30 | ## Remove this line to enable babeld on this interface 31 | option 'ignore' 'true' 32 | ## You can use aliases (like lan, wlan) or real names (like eth0.0). 33 | ## If you use an alias, it must be already defined when babeld starts. 34 | ## Otherwise, the name is taken literally and the interface can be 35 | ## brought up later (useful for tunnels for instance). 36 | option 'ifname' 'wlan' 37 | ## You can set options, see babeld man page ("Interface configuration") 38 | # option 'rxcost' '256' 39 | # option 'hello_interval' '1' 40 | 41 | config interface 42 | option 'ignore' 'true' 43 | ## Physical interface name 44 | option 'ifname' 'tun-example' 45 | ## Specify the type of interface: tunnels use the RTT-based metric. 46 | option 'type' 'tunnel' 47 | ## Other options that can be overriden. 48 | # option 'max_rtt_penalty' '96' 49 | 50 | # A config interface without "option ifname" will set default options 51 | # for all interfaces. Interface-specific configuration always overrides 52 | # default configuration. 53 | config interface 54 | # option 'enable_timestamps' 'true' 55 | # option 'update_interval' '30' 56 | 57 | 58 | # A filter consists of a type ('in', 'out', 'redistribute' or 'install'), 59 | # a set of selectors ('ip', 'eq', etc.) and a set of actions to perform 60 | # ('allow', 'deny', 'metric xxx', 'src-prefix xxx', 'table xxx', 'pref-src xxx'). 61 | # See babeld man page ("Filtering rules") for more details. 62 | 63 | # Below is a sample filter that redistributes the default route if its 64 | # protocol number is "boot", e.g. when it is installed by dhcp (see 65 | # /etc/iproute2/rt_protos). This filter is disabled thanks to the 'ignore' 66 | # setting. 67 | config filter 68 | option 'ignore' 'true' 69 | # Type of filter 70 | option 'type' 'redistribute' 71 | # Selectors: ip, eq, le, ge, src_ip, src_eq, src_le, src_ge, neigh, id, 72 | # proto, local, if. 73 | option 'ip' '0.0.0.0/0' 74 | option 'eq' '0' 75 | option 'proto' '3' 76 | # Action, which can be any of: allow, deny, metric , src-prefix , 77 | # table , pref-src . 78 | # The action defaults to "allow" if not specified. Here, we specify a higher 79 | # redistribution metric than the default (0). 80 | option 'action' 'metric 128' 81 | 82 | # Another example filter: don't redistribute local addresses in a certain IP prefix. 83 | # By default, babeld redistributes *all* local addresses. 84 | config filter 85 | option 'ignore' 'true' 86 | option 'type' 'redistribute' 87 | # Only apply to routes/addresses within this prefix. 88 | option 'ip' '198.51.100.0/24' 89 | # Notice that the 'local' selector is a boolean. 90 | option 'local' 'true' 91 | # Don't redistribute. 92 | option 'action' 'deny' 93 | 94 | # Example install filter, to change or filter routes before they are inserted 95 | # into the kernel. 96 | config filter 97 | option 'ignore' 'true' 98 | option 'type' 'install' 99 | # Optional: only apply to routes within 2001:db8:cafe::/48 100 | option 'ip' '2001:db8:cafe::/48' 101 | # We specify the kernel routing table and the preferred source address to use for these routes. 102 | # "Allow" is implicit. 103 | option 'action' 'table 200 pref-src 2001:db8:ba:be1::42' 104 | -------------------------------------------------------------------------------- /bird2/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2009-2017 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:=bird2 10 | PKG_VERSION:=2.17.2 11 | PKG_RELEASE:=2 12 | 13 | PKG_SOURCE:=bird-$(PKG_VERSION).tar.gz 14 | PKG_SOURCE_URL:=https://bird.nic.cz/download/ 15 | PKG_HASH:=440dd2d3aca64323b46fd45532e573accaf8bdde639ee4bfcd68ea9b13328cdd 16 | 17 | PKG_MAINTAINER:=Toke Høiland-Jørgensen 18 | PKG_LICENSE:=GPL-2.0-or-later 19 | PKG_CPE_ID:=cpe:/a:nic:bird 20 | 21 | PKG_BUILD_DEPENDS:=ncurses readline 22 | PKG_BUILD_DIR:=$(BUILD_DIR)/bird-$(PKG_VERSION) 23 | 24 | include $(INCLUDE_DIR)/package.mk 25 | 26 | define Package/bird2 27 | TITLE:=The BIRD Internet Routing Daemon (v2) 28 | URL:=https://bird.nic.cz/ 29 | SECTION:=net 30 | CATEGORY:=Network 31 | SUBMENU:=Routing and Redirection 32 | DEPENDS:=+libpthread 33 | CONFLICTS:=bird1-ipv4 bird1-ipv6 bird4 bird6 34 | endef 35 | 36 | define Package/bird2c 37 | TITLE:=The BIRD command-line client (v2) 38 | URL:=https://bird.nic.cz/ 39 | SECTION:=net 40 | CATEGORY:=Network 41 | SUBMENU:=Routing and Redirection 42 | DEPENDS:=+bird2 +libreadline +libncurses 43 | CONFLICTS:=bird1c-ipv4 bird1c-ipv6 birdc4 birdc6 44 | endef 45 | 46 | define Package/bird2cl 47 | TITLE:=The BIRD lightweight command-line client (v2) 48 | URL:=https://bird.nic.cz/ 49 | SECTION:=net 50 | CATEGORY:=Network 51 | SUBMENU:=Routing and Redirection 52 | DEPENDS:=+bird2 53 | CONFLICTS:=bird1cl-ipv4 bird1cl-ipv6 birdcl4 birdcl6 54 | endef 55 | 56 | define Package/bird2/Default/description 57 | BIRD is an internet routing daemon which manages TCP/IP routing tables 58 | with support of modern routing protocols, easy to use configuration 59 | interface and powerful route filtering language. It is lightweight and 60 | efficient and therefore appropriate for small embedded routers. 61 | endef 62 | 63 | define Package/bird2/description 64 | $(call Package/bird2/Default/description) 65 | 66 | BIRD supports OSPFv2, RIPv2, Babel and BGP protocols for IPv4 and 67 | OSPFv3, RIPng, Babel and BGP protocols for IPv6. 68 | 69 | In BGP, BIRD supports communities, multiprotocol extensions, MD5 70 | authentication, 32bit AS numbers and could act as a route server or a 71 | route reflector. BIRD also supports multiple RIBs, multiple kernel 72 | routing tables and redistribution between the protocols with a powerful 73 | configuration syntax. 74 | 75 | This is the 2.0 branch of Bird which integrates support for IPv4 and IPv6 76 | into a single branch, and also adds support for the Babel routing protocol. 77 | endef 78 | 79 | define Package/bird2c/description 80 | $(call Package/bird2/Default/description) 81 | 82 | This is a BIRD command-line client. It is used to send commands to BIRD, 83 | commands can perform simple actions such as enabling/disabling of 84 | protocols, telling BIRD to show various information, telling it to show 85 | a routing table filtered by a filter, or asking BIRD to reconfigure. 86 | 87 | Unless you can't afford dependency on ncurses and readline, you 88 | should install BIRD command-line client together with BIRD. 89 | endef 90 | 91 | define Package/bird2cl/description 92 | $(call Package/bird2/Default/description) 93 | 94 | This is a BIRD lightweight command-line client. It is used to send commands 95 | to BIRD, commands can perform simple actions such as enabling/disabling of 96 | protocols, telling BIRD to show various information, telling it to show 97 | a routing table filtered by a filter, or asking BIRD to reconfigure. 98 | endef 99 | 100 | CONFIGURE_ARGS += --disable-libssh 101 | 102 | define Package/bird2/conffiles 103 | /etc/bird.conf 104 | /etc/bird4.conf 105 | /etc/bird6.conf 106 | endef 107 | 108 | define Package/bird2/install 109 | $(INSTALL_DIR) $(1)/usr/sbin 110 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/bird $(1)/usr/sbin/ 111 | $(INSTALL_DIR) $(1)/etc 112 | $(INSTALL_DATA) $(PKG_BUILD_DIR)/doc/bird.conf.example $(1)/etc/bird.conf 113 | $(INSTALL_DIR) $(1)/etc/init.d 114 | $(INSTALL_BIN) ./files/bird.init $(1)/etc/init.d/bird 115 | endef 116 | 117 | define Package/bird2c/install 118 | $(INSTALL_DIR) $(1)/usr/sbin 119 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/birdc $(1)/usr/sbin/ 120 | endef 121 | 122 | define Package/bird2cl/install 123 | $(INSTALL_DIR) $(1)/usr/sbin 124 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/birdcl $(1)/usr/sbin/ 125 | endef 126 | 127 | $(eval $(call BuildPackage,bird2)) 128 | $(eval $(call BuildPackage,bird2c)) 129 | $(eval $(call BuildPackage,bird2cl)) 130 | -------------------------------------------------------------------------------- /opennds/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:=opennds 9 | PKG_VERSION:=10.3.1 10 | PKG_RELEASE:=2 11 | 12 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 13 | PKG_SOURCE_URL:=https://codeload.github.com/opennds/opennds/tar.gz/v$(PKG_VERSION)? 14 | PKG_HASH:=f82fe0fa2e4e8ab66abf33cae7cb20e79661c8a183af82eefa11307e9c66968d 15 | PKG_BUILD_DIR:=$(BUILD_DIR)/openNDS-$(PKG_VERSION) 16 | 17 | PKG_MAINTAINER:=Rob White 18 | PKG_LICENSE:=GPL-2.0-or-later 19 | PKG_LICENSE_FILES:=COPYING 20 | PKG_CPE_ID:=cpe:/a:opennds:captive_portal 21 | 22 | PKG_FIXUP:=autoreconf 23 | PKG_BUILD_PARALLEL:=1 24 | 25 | include $(INCLUDE_DIR)/package.mk 26 | 27 | define Package/opennds 28 | SUBMENU:=Captive Portals 29 | SECTION:=net 30 | CATEGORY:=Network 31 | DEPENDS:=+libmicrohttpd-no-ssl 32 | TITLE:=open Network Demarcation Service 33 | URL:=https://github.com/opennds/opennds 34 | CONFLICTS:=nodogsplash 35 | endef 36 | 37 | define Package/opennds/description 38 | openNDS (open Network Demarcation Service) is a high performance, small footprint, Captive Portal. 39 | It provides a border control gateway between a public local area network and the Internet. 40 | It supports all scenarios ranging from small stand alone venues through to large mesh networks with multiple portal entry points. 41 | Both the client driven Captive Portal Detection method (CPD) and gateway driven Captive Portal Identification method (CPI - RFC 8910 and RFC 8908) are supported. 42 | This version uses nftables. 43 | endef 44 | 45 | define Package/opennds/install 46 | $(INSTALL_DIR) $(1)/usr/bin 47 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/opennds $(1)/usr/bin/ 48 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/ndsctl $(1)/usr/bin/ 49 | $(INSTALL_DIR) $(1)/etc/opennds/htdocs/images 50 | $(INSTALL_DIR) $(1)/etc/config 51 | $(INSTALL_DIR) $(1)/etc/init.d 52 | $(INSTALL_DIR) $(1)/etc/uci-defaults 53 | $(INSTALL_DIR) $(1)/usr/lib/opennds 54 | $(CP) $(PKG_BUILD_DIR)/resources/splash.css $(1)/etc/opennds/htdocs/ 55 | $(CP) $(PKG_BUILD_DIR)/resources/splash.jpg $(1)/etc/opennds/htdocs/images/ 56 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/linux_openwrt/opennds/files/etc/config/opennds $(1)/etc/config/ 57 | $(CP) $(PKG_BUILD_DIR)/linux_openwrt/opennds/files/etc/config/opennds $(1)/etc/opennds/config.uci 58 | $(CP) $(PKG_BUILD_DIR)/linux_openwrt/opennds/files/etc/init.d/opennds $(1)/etc/init.d/ 59 | $(CP) $(PKG_BUILD_DIR)/linux_openwrt/opennds/files/etc/uci-defaults/40_opennds $(1)/etc/uci-defaults/ 60 | $(CP) $(PKG_BUILD_DIR)/linux_openwrt/opennds/files/usr/lib/opennds/restart.sh $(1)/usr/lib/opennds/ 61 | $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/binauth/binauth_log.sh $(1)/usr/lib/opennds/ 62 | $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/binauth/custombinauth.sh $(1)/usr/lib/opennds/ 63 | $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/libopennds.sh $(1)/usr/lib/opennds/ 64 | $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/PreAuth/theme_click-to-continue-basic.sh $(1)/usr/lib/opennds/ 65 | $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/PreAuth/theme_click-to-continue-custom-placeholders.sh $(1)/usr/lib/opennds/ 66 | $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/PreAuth/theme_user-email-login-basic.sh $(1)/usr/lib/opennds/ 67 | $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/PreAuth/theme_user-email-login-custom-placeholders.sh $(1)/usr/lib/opennds/ 68 | $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/get_client_interface.sh $(1)/usr/lib/opennds/ 69 | $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/client_params.sh $(1)/usr/lib/opennds/ 70 | $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/authmon.sh $(1)/usr/lib/opennds/ 71 | $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/dnsconfig.sh $(1)/usr/lib/opennds/ 72 | $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/download_resources.sh $(1)/usr/lib/opennds/ 73 | $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/post-request.php $(1)/usr/lib/opennds/ 74 | $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/fas-aes/fas-aes.php $(1)/etc/opennds/ 75 | $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/fas-hid/fas-hid.php $(1)/etc/opennds/ 76 | $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/fas-hid/fas-hid-https.php $(1)/etc/opennds/ 77 | $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/fas-aes/fas-aes-https.php $(1)/etc/opennds/ 78 | endef 79 | 80 | define Package/opennds/postrm 81 | #!/bin/sh 82 | uci delete firewall.opennds 83 | uci commit firewall 84 | endef 85 | 86 | define Package/opennds/conffiles 87 | /etc/config/opennds 88 | endef 89 | 90 | $(eval $(call BuildPackage,opennds)) 91 | -------------------------------------------------------------------------------- /babeld/patches/600-add-ubus.patch: -------------------------------------------------------------------------------- 1 | --- a/babeld.c 2 | +++ b/babeld.c 3 | @@ -54,6 +54,8 @@ THE SOFTWARE. 4 | #include "local.h" 5 | #include "version.h" 6 | 7 | +#include "ubus.h" 8 | + 9 | struct timeval now; 10 | 11 | unsigned char myid[8]; 12 | @@ -505,6 +507,9 @@ main(int argc, char **argv) 13 | } 14 | } 15 | 16 | + if(ubus_bindings) 17 | + babeld_add_ubus(); 18 | + 19 | init_signals(); 20 | rc = resize_receive_buffer(1500); 21 | if(rc < 0) 22 | @@ -597,6 +602,8 @@ main(int argc, char **argv) 23 | FD_SET(local_sockets[i].fd, &readfds); 24 | maxfd = MAX(maxfd, local_sockets[i].fd); 25 | } 26 | + if(ubus_bindings) 27 | + maxfd = babeld_ubus_add_read_sock(&readfds, maxfd); 28 | rc = select(maxfd + 1, &readfds, NULL, NULL, &tv); 29 | if(rc < 0) { 30 | if(errno != EINTR) { 31 | @@ -665,6 +672,9 @@ main(int argc, char **argv) 32 | i++; 33 | } 34 | 35 | + if(ubus_bindings) 36 | + babeld_ubus_receive(&readfds); 37 | + 38 | if(reopening) { 39 | kernel_dump_time = now.tv_sec; 40 | check_neighbours_timeout = now; 41 | --- a/generate-version.sh 42 | +++ b/generate-version.sh 43 | @@ -10,4 +10,4 @@ else 44 | version="unknown" 45 | fi 46 | 47 | -echo "#define BABELD_VERSION \"$version\"" 48 | +echo "#define BABELD_VERSION \"$version-ubus-mod\"" 49 | --- a/configuration.c 50 | +++ b/configuration.c 51 | @@ -42,6 +42,8 @@ THE SOFTWARE. 52 | #include "hmac.h" 53 | #include "configuration.h" 54 | 55 | +#include "ubus.h" 56 | + 57 | static struct filter *input_filters = NULL; 58 | static struct filter *output_filters = NULL; 59 | static struct filter *redistribute_filters = NULL; 60 | @@ -1024,7 +1026,8 @@ parse_option(int c, gnc_t gnc, void *clo 61 | strcmp(token, "daemonise") == 0 || 62 | strcmp(token, "skip-kernel-setup") == 0 || 63 | strcmp(token, "ipv6-subtrees") == 0 || 64 | - strcmp(token, "reflect-kernel-metric") == 0) { 65 | + strcmp(token, "reflect-kernel-metric") == 0 || 66 | + strcmp(token, "ubus-bindings") == 0) { 67 | int b; 68 | c = getbool(c, &b, gnc, closure); 69 | if(c < -1) 70 | @@ -1042,6 +1045,8 @@ parse_option(int c, gnc_t gnc, void *clo 71 | has_ipv6_subtrees = b; 72 | else if(strcmp(token, "reflect-kernel-metric") == 0) 73 | reflect_kernel_metric = b; 74 | + else if(strcmp(token, "ubus-bindings") == 0) 75 | + ubus_bindings = b; 76 | else 77 | abort(); 78 | } else if(strcmp(token, "protocol-group") == 0) { 79 | --- a/local.c 80 | +++ b/local.c 81 | @@ -42,6 +42,8 @@ THE SOFTWARE. 82 | #include "local.h" 83 | #include "version.h" 84 | 85 | +#include "ubus.h" 86 | + 87 | int local_server_socket = -1; 88 | struct local_socket local_sockets[MAX_LOCAL_SOCKETS]; 89 | int num_local_sockets = 0; 90 | @@ -191,6 +193,8 @@ local_notify_neighbour(struct neighbour 91 | if(local_sockets[i].monitor) 92 | local_notify_neighbour_1(&local_sockets[i], neigh, kind); 93 | } 94 | + if(ubus_bindings) 95 | + ubus_notify_neighbour(neigh, kind); 96 | } 97 | 98 | static void 99 | @@ -228,6 +232,8 @@ local_notify_xroute(struct xroute *xrout 100 | if(local_sockets[i].monitor) 101 | local_notify_xroute_1(&local_sockets[i], xroute, kind); 102 | } 103 | + if(ubus_bindings) 104 | + ubus_notify_xroute(xroute, kind); 105 | } 106 | 107 | static void 108 | @@ -273,6 +279,8 @@ local_notify_route(struct babel_route *r 109 | if(local_sockets[i].monitor) 110 | local_notify_route_1(&local_sockets[i], route, kind); 111 | } 112 | + if(ubus_bindings) 113 | + ubus_notify_route(route, kind); 114 | } 115 | 116 | static void 117 | --- a/Makefile 118 | +++ b/Makefile 119 | @@ -11,11 +11,11 @@ LDLIBS = -lrt 120 | 121 | SRCS = babeld.c net.c kernel.c util.c interface.c source.c neighbour.c \ 122 | route.c xroute.c message.c resend.c configuration.c local.c \ 123 | - hmac.c rfc6234/sha224-256.c BLAKE2/ref/blake2s-ref.c 124 | + hmac.c ubus.c rfc6234/sha224-256.c BLAKE2/ref/blake2s-ref.c 125 | 126 | OBJS = babeld.o net.o kernel.o util.o interface.o source.o neighbour.o \ 127 | route.o xroute.o message.o resend.o configuration.o local.o \ 128 | - hmac.o rfc6234/sha224-256.o BLAKE2/ref/blake2s-ref.o 129 | + hmac.o ubus.o rfc6234/sha224-256.o BLAKE2/ref/blake2s-ref.o 130 | 131 | babeld: $(OBJS) 132 | $(CC) $(CFLAGS) $(LDFLAGS) -o babeld $(OBJS) $(LDLIBS) 133 | -------------------------------------------------------------------------------- /cjdns/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2014,2015 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:=cjdns 20 | PKG_VERSION:=21.1 21 | PKG_RELEASE:=6 22 | 23 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 24 | PKG_SOURCE_URL:=https://codeload.github.com/cjdelisle/cjdns/tar.gz/$(PKG_NAME)-v$(PKG_VERSION)? 25 | PKG_HASH:=a6158ce7847159aa44e86f74ccc7b6ded6910a230ed8f3830db53cda5838f0b0 26 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_NAME)-v$(PKG_VERSION) 27 | 28 | PKG_MAINTAINER:=William Fleurant 29 | PKG_LICENSE:=GPL-3.0-or-later 30 | PKG_LICENSE_FILES:=LICENSE 31 | 32 | include $(INCLUDE_DIR)/package.mk 33 | 34 | define Package/cjdns 35 | SECTION:=net 36 | CATEGORY:=Network 37 | SUBMENU:=Routing and Redirection 38 | TITLE:=Encrypted near-zero-conf mesh routing protocol 39 | URL:=https://github.com/cjdelisle/cjdns 40 | DEPENDS:=@!arc @IPV6 +kmod-tun +libnl-tiny +libpthread +librt \ 41 | +libuci-lua +lua-bencode +dkjson +luasocket +lua-sha2 42 | endef 43 | 44 | define Package/cjdns/description 45 | Cjdns implements an encrypted IPv6 network using public-key cryptography \ 46 | for address allocation and a distributed hash table for routing. \ 47 | This provides near-zero-configuration networking, and prevents many \ 48 | of the security and scalability issues that plague existing networks. 49 | endef 50 | 51 | define Package/cjdns-tests 52 | SECTION:=net 53 | CATEGORY:=Network 54 | SUBMENU:=Routing and Redirection 55 | TITLE:=cjdns test cases 56 | URL:=https://github.com/cjdelisle/cjdns 57 | DEPENDS:=+libpthread +librt @!arc 58 | endef 59 | 60 | define Package/cjdns-test/description 61 | Builds cjdns test cases binary test_testcjdroute_c 62 | endef 63 | 64 | define Build/Configure 65 | endef 66 | 67 | PKG_DO_VARS:=CJDNS_RELEASE_VERSION=$(PKG_SOURCE_VERSION) 68 | 69 | ifneq ($(CONFIG_KERNEL_SECCOMP_FILTER),y) 70 | PKG_DO_VARS+= Seccomp_NO=1 71 | endif 72 | 73 | ifneq ($(CONFIG_USE_UCLIBC),) 74 | PKG_DO_VARS+= UCLIBC=1 75 | endif 76 | 77 | define Build/Compile 78 | $(INSTALL_DIR) $(PKG_BUILD_DIR)/tmp 79 | (cd $(PKG_BUILD_DIR) && \ 80 | CROSS="true" \ 81 | CC="$(TARGET_CC_NOCACHE)" \ 82 | AR="$(TARGET_AR)" \ 83 | RANLIB="$(TARGET_RANLIB)" \ 84 | CFLAGS="$(TARGET_CFLAGS) -U_FORTIFY_SOURCE -Wno-error=array-bounds -Wno-error=stringop-overflow -Wno-error=stringop-overread -Wno-error=calloc-transposed-args" \ 85 | LDFLAGS="$(TARGET_LDFLAGS)" \ 86 | SYSTEM="linux" \ 87 | TARGET_ARCH="$(CONFIG_ARCH)" \ 88 | SSP_SUPPORT="$(CONFIG_SSP_SUPPORT)" \ 89 | GYP_ADDITIONAL_ARGS="-f make-linux" \ 90 | CJDNS_BUILD_TMPDIR="$(PKG_BUILD_DIR)/tmp" \ 91 | $(PKG_DO_VARS) \ 92 | exec ./do) 93 | endef 94 | 95 | define Package/cjdns/install 96 | $(INSTALL_DIR) \ 97 | $(1)/usr/sbin \ 98 | $(1)/usr/bin \ 99 | $(1)/etc/config \ 100 | $(1)/etc/init.d \ 101 | $(1)/etc/uci-defaults \ 102 | $(1)/usr/lib/lua/cjdns \ 103 | $(1)/usr/share/ucitrack 104 | 105 | $(INSTALL_BIN) \ 106 | ./files/cjdrouteconf \ 107 | $(1)/usr/bin 108 | 109 | $(INSTALL_BIN) \ 110 | $(PKG_BUILD_DIR)/cjdroute \ 111 | $(1)/usr/sbin 112 | 113 | $(INSTALL_BIN) \ 114 | $(PKG_BUILD_DIR)/publictoip6 \ 115 | $(1)/usr/bin 116 | 117 | $(INSTALL_BIN) \ 118 | ./files/cjdns.init \ 119 | $(1)/etc/init.d/cjdns 120 | 121 | $(INSTALL_BIN) \ 122 | ./files/cjdns.defaults \ 123 | $(1)/etc/uci-defaults/cjdns 124 | 125 | $(INSTALL_DATA) \ 126 | ./files/luci-app-cjdns.json \ 127 | $(1)/usr/share/ucitrack 128 | 129 | $(CP) \ 130 | ./lua/cjdns/* \ 131 | $(1)/usr/lib/lua/cjdns 132 | endef 133 | 134 | define Package/cjdns/postinst 135 | #!/bin/sh 136 | if [ -z $${IPKG_INSTROOT} ] ; then 137 | ( . /etc/uci-defaults/cjdns ) && rm -f /etc/uci-defaults/cjdns 138 | /etc/init.d/cjdns enabled || /etc/init.d/cjdns enable 139 | exit 0 140 | fi 141 | endef 142 | 143 | define Package/cjdns-tests/install 144 | $(INSTALL_DIR) $(1)/usr/bin 145 | $(INSTALL_BIN) \ 146 | $(PKG_BUILD_DIR)/build_linux/test_testcjdroute_c \ 147 | $(1)/usr/bin 148 | endef 149 | 150 | $(eval $(call BuildPackage,cjdns)) 151 | $(eval $(call BuildPackage,cjdns-tests)) 152 | -------------------------------------------------------------------------------- /bmx7/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=bmx7 4 | PKG_VERSION:=2024.06.11 5 | PKG_RELEASE:=2 6 | 7 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 8 | 9 | PKG_SOURCE_PROTO:=git 10 | PKG_SOURCE_URL:=https://github.com/bmx-routing/bmx7.git 11 | PKG_SOURCE_VERSION:=9020896f89006bc5d3487222eefc7ddea9e8b2bd 12 | PKG_MIRROR_HASH:=a085904a48544d71ec815fa61c329925d89aca72a051941551290d292a6150d7 13 | 14 | PKG_MAINTAINER:=Axel Neumann 15 | PKG_LICENSE:=GPL-2.0-or-later 16 | PKG_LICENSE_FILES:=LICENSE 17 | 18 | PKG_BUILD_PARALLEL:=1 19 | 20 | include $(INCLUDE_DIR)/package.mk 21 | 22 | TARGET_CFLAGS += $(FPIC) 23 | 24 | MAKE_ARGS += EXTRA_CFLAGS="$(TARGET_CFLAGS) \ 25 | -I. \ 26 | -I$(STAGING_DIR)/usr/include \ 27 | -DCORE_LIMIT=20000 \ 28 | -DTRAFFIC_DUMP \ 29 | -DNO_TRACE_FUNCTION_CALLS \ 30 | -DBMX7_LIB_IWINFO" \ 31 | EXTRA_LDFLAGS="$(TARGET_LDFLAGS) \ 32 | -L$(STAGING_DIR)/usr/lib -liwinfo" \ 33 | GIT_REV="$(PKG_REV)" \ 34 | CC="$(TARGET_CC)" \ 35 | INSTALL_DIR="$(PKG_INSTALL_DIR)" \ 36 | build_all 37 | 38 | MAKE_PATH:=src 39 | 40 | define Package/bmx7/Default 41 | SECTION:=net 42 | CATEGORY:=Network 43 | SUBMENU:=Routing and Redirection 44 | TITLE:=BMX7 layer 3 routing daemon 45 | URL:=https://github.com/bmx-routing/bmx7 46 | DEPENDS:=+zlib +libmbedtls +libiwinfo 47 | endef 48 | 49 | define Package/bmx7/description 50 | BMX7 routing daemon supporting securely-entrusted IPv6 (and IPv4in6) routing 51 | endef 52 | 53 | define Package/bmx7 54 | $(call Package/bmx7/Default) 55 | MENU:=1 56 | endef 57 | 58 | define Package/bmx7-uci-config 59 | $(call Package/bmx7/Default) 60 | DEPENDS:=bmx7 +libuci 61 | TITLE:=configuration plugin based on uci (recommended!) 62 | endef 63 | 64 | define Package/bmx7-iwinfo 65 | $(call Package/bmx7/Default) 66 | DEPENDS:=bmx7 +libiwinfo 67 | TITLE:=link characteristics plugin via libiwinfo (recommended!) 68 | endef 69 | 70 | define Package/bmx7-topology 71 | $(call Package/bmx7/Default) 72 | DEPENDS:=bmx7 73 | TITLE:=topology plugin 74 | endef 75 | 76 | define Package/bmx7-json 77 | $(call Package/bmx7/Default) 78 | DEPENDS:=bmx7 +libjson-c 79 | TITLE:=json plugin based on json-c 80 | endef 81 | 82 | define Package/bmx7-sms 83 | $(call Package/bmx7/Default) 84 | DEPENDS:=bmx7 85 | TITLE:=sms plugin 86 | endef 87 | 88 | define Package/bmx7-tun 89 | $(call Package/bmx7/Default) 90 | DEPENDS:=bmx7 +kmod-ip6-tunnel +kmod-iptunnel6 +kmod-tun 91 | TITLE:=ipip-based tunnel plugin (recommended!) 92 | endef 93 | 94 | define Package/bmx7-table 95 | $(call Package/bmx7/Default) 96 | DEPENDS:=bmx7 +bmx7-tun 97 | TITLE:=plugin to announce routes from tables via tunnels 98 | endef 99 | 100 | define Package/bmx7/install 101 | $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d 102 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/bmx7 $(1)/usr/sbin/bmx7 103 | endef 104 | 105 | define Build/Compile 106 | $(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) $(MAKE_ARGS) 107 | endef 108 | 109 | define Package/bmx7-uci-config/conffiles 110 | /etc/config/bmx7 111 | /etc/bmx7 112 | endef 113 | 114 | define Package/bmx7-uci-config/install 115 | $(INSTALL_DIR) $(1)/usr/lib $(1)/etc/config $(1)/etc/init.d 116 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_uci_config/bmx7_config.so \ 117 | $(1)/usr/lib/bmx7_config.so 118 | $(INSTALL_BIN) ./files/etc/init.d/bmx7 $(1)/etc/init.d/bmx7 119 | $(INSTALL_CONF) ./files/etc/config/bmx7 $(1)/etc/config/bmx7 120 | endef 121 | 122 | define Package/bmx7-iwinfo/install 123 | $(INSTALL_DIR) $(1)/usr/lib 124 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_iwinfo/bmx7_iwinfo.so \ 125 | $(1)/usr/lib/bmx7_iwinfo.so 126 | endef 127 | 128 | define Package/bmx7-topology/install 129 | $(INSTALL_DIR) $(1)/usr/lib 130 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_topology/bmx7_topology.so \ 131 | $(1)/usr/lib/bmx7_topology.so 132 | endef 133 | 134 | define Package/bmx7-json/install 135 | $(INSTALL_DIR) $(1)/usr/lib 136 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_json/bmx7_json.so \ 137 | $(1)/usr/lib/bmx7_json.so 138 | endef 139 | 140 | define Package/bmx7-sms/install 141 | $(INSTALL_DIR) $(1)/usr/lib 142 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_sms/bmx7_sms.so \ 143 | $(1)/usr/lib/bmx7_sms.so 144 | endef 145 | 146 | define Package/bmx7-tun/install 147 | $(INSTALL_DIR) $(1)/usr/lib 148 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_tun/bmx7_tun.so \ 149 | $(1)/usr/lib/bmx7_tun.so 150 | endef 151 | 152 | define Package/bmx7-table/install 153 | $(INSTALL_DIR) $(1)/usr/lib 154 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_table/bmx7_table.so \ 155 | $(1)/usr/lib/bmx7_table.so 156 | endef 157 | 158 | $(eval $(call BuildPackage,bmx7)) 159 | $(eval $(call BuildPackage,bmx7-uci-config)) 160 | $(eval $(call BuildPackage,bmx7-iwinfo)) 161 | $(eval $(call BuildPackage,bmx7-topology)) 162 | $(eval $(call BuildPackage,bmx7-json)) 163 | $(eval $(call BuildPackage,bmx7-sms)) 164 | $(eval $(call BuildPackage,bmx7-table)) 165 | $(eval $(call BuildPackage,bmx7-tun)) 166 | -------------------------------------------------------------------------------- /nodogsplash/files/etc/init.d/nodogsplash: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | 3 | # 4 | # Startup/shutdown script for nodogsplash captive portal 5 | # 6 | 7 | START=95 8 | STOP=95 9 | 10 | USE_PROCD=1 11 | 12 | IPT=/usr/sbin/iptables 13 | WD_DIR=/usr/bin 14 | 15 | # Run in PROCD (-f) and log to SYSLOG (-s) 16 | OPTIONS="-f -s" 17 | # 18 | 19 | CONFIG="" 20 | 21 | 22 | addline() { 23 | append CONFIG "$1" "$N" 24 | } 25 | 26 | setup_mac_lists() { 27 | local cfg="$1" 28 | local macs="" 29 | local val 30 | 31 | append_mac() { 32 | append macs "$1" "," 33 | } 34 | 35 | config_get val "$cfg" macmechanism 36 | if [ -z "$val" ]; then 37 | # Check if we have AllowedMACList or BlockedMACList defined they will be ignored 38 | config_get val "$cfg" allowedmac 39 | if [ -n "$val" ]; then 40 | echo "Ignoring allowedmac - macmechanism not \"allow\"" >&2 41 | fi 42 | 43 | config_get val "$cfg" blockedmac 44 | if [ -n "$val" ]; then 45 | echo "Ignoring blockedmac - macmechanism not \"block\"" >&2 46 | fi 47 | elif [ "$val" = "allow" ]; then 48 | config_list_foreach "$cfg" allowedmac append_mac 49 | addline "MACmechanism allow" 50 | addline "AllowedMACList $macs" 51 | elif [ "$val" = "block" ]; then 52 | config_list_foreach "$cfg" blockedmac append_mac 53 | addline "MACmechanism block" 54 | addline "BlockedMACList $macs" 55 | else 56 | echo "Invalid macmechanism '$val' - allow or block are valid." >&2 57 | return 1 58 | fi 59 | 60 | macs="" 61 | config_list_foreach "$cfg" trustedmac append_mac 62 | if [ -n "$macs" ]; then 63 | addline "TrustedMACList $macs" 64 | fi 65 | 66 | return 0 67 | } 68 | 69 | setup_firewall() { 70 | local cfg="$1" 71 | local uci_name 72 | local val 73 | 74 | append_firewall() { 75 | addline " FirewallRule $1" 76 | } 77 | 78 | for rule in authenticated-users preauthenticated-users users-to-router trusted-users trusted-users-to-router; do 79 | # uci does not allow dashes 80 | uci_name=${rule//-/_} 81 | addline "FirewallRuleSet $rule {" 82 | config_list_foreach "$cfg" "$uci_name" append_firewall 83 | addline "}" 84 | config_get val "$cfg" "policy_${uci_name}" 85 | if [ -n "$val" ]; then 86 | addline "EmptyRuleSetPolicy $rule $val" 87 | fi 88 | done 89 | } 90 | 91 | wait_for_interface() { 92 | local ifname="$1" 93 | local timeout=10 94 | 95 | for i in $(seq $timeout); do 96 | if [ $(ip -4 addr show dev $ifname 2> /dev/null | grep -c inet) -ne 0 ]; then 97 | break 98 | fi 99 | sleep 1 100 | if [ $i = $timeout ]; then 101 | echo "Interface $ifname not detected." >&2 102 | return 1 103 | fi 104 | done 105 | 106 | return 0 107 | } 108 | 109 | generate_uci_config() { 110 | local cfg="$1" 111 | local val 112 | local ifname 113 | local download 114 | local upload 115 | 116 | # Init config file content 117 | CONFIG="# auto-generated config file from /etc/config/nodogsplash" 118 | 119 | config_get val "$cfg" config 120 | if [ -n "$val" ]; then 121 | if [ ! -f "$val" ]; then 122 | echo "Configuration file '$file' doesn't exist." >&2 123 | return 1 124 | fi 125 | addline "$(cat $val)" 126 | fi 127 | 128 | config_get ifname "$cfg" gatewayinterface 129 | 130 | # Get device name if interface name is a section name in /etc/config/network 131 | if network_get_device tmp "$ifname"; then 132 | ifname="$tmp" 133 | fi 134 | 135 | if [ -z "$ifname" ]; then 136 | echo "Option network or gatewayinterface missing." >&2 137 | return 1 138 | fi 139 | 140 | wait_for_interface "$ifname" || return 1 141 | 142 | addline "GatewayInterface $ifname" 143 | 144 | for option in preauth binauth \ 145 | daemon debuglevel maxclients gatewayname gatewayinterface gatewayiprange \ 146 | gatewayaddress gatewayport webroot splashpage statuspage \ 147 | redirecturl sessiontimeout preauthidletimeout authidletimeout checkinterval \ 148 | setmss mssvalue trafficcontrol downloadlimit uploadlimit \ 149 | syslogfacility ndsctlsocket fw_mark_authenticated \ 150 | fw_mark_blocked fw_mark_trusted 151 | do 152 | config_get val "$cfg" "$option" 153 | 154 | if [ -n "$val" ]; then 155 | addline "$option $val" 156 | fi 157 | done 158 | for option in fasport fasremoteip faspath fas_secure_enabled ; do 159 | config_get val "$cfg" "$option" 160 | if [ -n "$val" ]; then 161 | echo "Warning: nodogsplash does not support $val" 162 | return 1 163 | fi 164 | done 165 | config_get download "$cfg" downloadlimit 166 | config_get upload "$cfg" uploadlimit 167 | 168 | if [ -n "$upload" -o -n "$download" ]; then 169 | addline "TrafficControl yes" 170 | fi 171 | 172 | setup_mac_lists "$cfg" || return 1 173 | setup_firewall "$cfg" 174 | 175 | echo "$CONFIG" > "/tmp/etc/nodogsplash_$cfg.conf" 176 | return 0 177 | } 178 | 179 | # setup configuration and start instance 180 | create_instance() { 181 | local cfg="$1" 182 | local val 183 | 184 | config_get_bool val "$cfg" enabled 0 185 | [ $val -gt 0 ] || return 0 186 | 187 | if ! generate_uci_config "$cfg"; then 188 | echo "Can not generate uci config. Will not start instance $cfg." >&2 189 | return 1 190 | fi 191 | 192 | procd_open_instance $cfg 193 | procd_set_param command /usr/bin/nodogsplash -c "/tmp/etc/nodogsplash_$cfg.conf" $OPTIONS 194 | procd_set_param respawn 195 | procd_set_param file "/tmp/etc/nodogsplash_$cfg.conf" 196 | procd_close_instance 197 | } 198 | 199 | start_service() { 200 | # For network_get_device() 201 | include /lib/functions 202 | 203 | # For nodogsplash.conf file 204 | mkdir -p /tmp/etc/ 205 | 206 | config_load nodogsplash 207 | config_foreach create_instance nodogsplash 208 | } 209 | 210 | stop_service() { 211 | # When procd terminates nodogsplash, it does not exit fast enough. 212 | # Otherwise procd will restart nodogsplash twice. First time starting 213 | # nodogsplash fails, second time it succeeds. 214 | sleep 1 215 | } 216 | -------------------------------------------------------------------------------- /babeld/files/babeld.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | 3 | . $IPKG_INSTROOT/lib/functions/network.sh 4 | 5 | USE_PROCD=1 6 | START=70 7 | 8 | CONFIGFILE='/var/etc/babeld.conf' 9 | OTHERCONFIGFILE="/etc/babeld.conf" 10 | OTHERCONFIGDIR="/tmp/babeld.d/" 11 | EXTRA_COMMANDS="status" 12 | EXTRA_HELP=" status Dump Babel's table to the log file." 13 | 14 | # Append a line to the configuration file 15 | cfg_append() { 16 | local value="$1" 17 | echo "$value" >> "$CONFIGFILE" 18 | } 19 | 20 | cfg_append_option() { 21 | local section="$1" 22 | local option="$2" 23 | local value 24 | config_get value "$section" "$option" 25 | # babeld convention for options is '-', not '_' 26 | [ -n "$value" ] && cfg_append "${option//_/-} $value" 27 | } 28 | 29 | # Append to the "$buffer" variable 30 | append_ifname() { 31 | local section="$1" 32 | local option="$2" 33 | local switch="$3" 34 | local _name 35 | config_get _name "$section" "$option" 36 | [ -z "$_name" ] && return 0 37 | local ifname=$(uci_get_state network "$_name" ifname "$_name") 38 | append buffer "$switch $ifname" 39 | } 40 | 41 | append_bool() { 42 | local section="$1" 43 | local option="$2" 44 | local value="$3" 45 | local _loctmp 46 | config_get_bool _loctmp "$section" "$option" 0 47 | [ "$_loctmp" -gt 0 ] && append buffer "$value" 48 | } 49 | 50 | append_parm() { 51 | local section="$1" 52 | local option="$2" 53 | local switch="$3" 54 | local _loctmp 55 | config_get _loctmp "$section" "$option" 56 | [ -z "$_loctmp" ] && return 0 57 | append buffer "$switch $_loctmp" 58 | } 59 | 60 | babel_filter() { 61 | local cfg="$1" 62 | local _loctmp 63 | 64 | local _ignored 65 | config_get_bool _ignored "$cfg" 'ignore' 0 66 | [ "$_ignored" -eq 1 ] && return 0 67 | 68 | unset buffer 69 | append_parm "$cfg" 'type' '' 70 | 71 | append_bool "$cfg" 'local' 'local' 72 | 73 | append_parm "$cfg" 'ip' 'ip' 74 | append_parm "$cfg" 'eq' 'eq' 75 | append_parm "$cfg" 'le' 'le' 76 | append_parm "$cfg" 'ge' 'ge' 77 | append_parm "$cfg" 'src_ip' 'src-ip' 78 | append_parm "$cfg" 'src_eq' 'src-eq' 79 | append_parm "$cfg" 'src_le' 'src-le' 80 | append_parm "$cfg" 'src_ge' 'src-ge' 81 | append_parm "$cfg" 'neigh' 'neigh' 82 | append_parm "$cfg" 'id' 'id' 83 | append_parm "$cfg" 'proto' 'proto' 84 | 85 | append_ifname "$cfg" 'if' 'if' 86 | 87 | append_parm "$cfg" 'action' '' 88 | 89 | cfg_append "$buffer" 90 | } 91 | 92 | # Only one of babeld's options is allowed multiple times, "import-table". 93 | # We just append it multiple times. 94 | list_cb() { 95 | option_cb "$@" 96 | } 97 | 98 | babel_config_cb() { 99 | local type="$1" 100 | local section="$2" 101 | case "$type" in 102 | "general") 103 | option_cb() { 104 | local option="$1" 105 | local value="$2" 106 | # Ignore options that are not supposed to be given to babeld 107 | [ "$option" = "conf_file" ] && return 108 | [ "$option" = "conf_dir" ] && return 109 | # Skip lists. They will be taken care of by list_cb 110 | test "${option#*_ITEM}" != "$option" && return 111 | test "${option#*_LENGTH}" != "$option" && return 112 | cfg_append "${option//_/-} $value" 113 | } 114 | ;; 115 | "interface") 116 | local _ifname 117 | config_get _ifname "$section" 'ifname' 118 | # Try to resolve the logical interface name 119 | unset interface 120 | network_get_device interface "$_ifname" || interface="$_ifname" 121 | option_cb() { 122 | local option="$1" 123 | local value="$2" 124 | local _interface 125 | # "option ifname" is a special option, don't actually 126 | # generate configuration for it. 127 | [ "$option" = "ifname" ] && return 128 | [ -n "$interface" ] && _interface="interface $interface" || _interface="default" 129 | cfg_append "$_interface ${option//_/-} $value" 130 | } 131 | # Handle ignore options. 132 | local _ignored 133 | # This works because we loaded the whole configuration 134 | # beforehand (see config_load below). 135 | config_get_bool _ignored "$section" 'ignore' 0 136 | if [ "$_ignored" -eq 1 ] 137 | then 138 | option_cb() { return; } 139 | else 140 | # Also include an empty "interface $interface" statement, 141 | # so that babeld operates on this interface. 142 | [ -n "$interface" ] && cfg_append "interface $interface" 143 | fi 144 | ;; 145 | *) 146 | # Don't use reset_cb, this would also reset config_cb 147 | option_cb() { return; } 148 | ;; 149 | esac 150 | } 151 | 152 | # Support for conf_file and conf_dir 153 | babel_configpaths() { 154 | local cfg="$1" 155 | local conf_file 156 | config_get conf_file "$cfg" "conf_file" 157 | [ -n "$conf_file" ] && OTHERCONFIGFILE="$conf_file" 158 | local conf_dir 159 | config_get conf_dir "$cfg" "conf_dir" 160 | [ -n "$conf_dir" ] && OTHERCONFIGDIR="$conf_dir" 161 | } 162 | 163 | start_service() { 164 | mkdir -p /var/lib 165 | mkdir -p /var/etc 166 | 167 | # First load the whole config file, without callbacks, so that we are 168 | # aware of all "ignore" options in the second pass. This also allows 169 | # to load the configuration paths (conf_file and conf_dir). 170 | config_load babeld 171 | 172 | # Configure alternative configuration file and directory 173 | config_foreach babel_configpaths "general" 174 | 175 | # Start by emptying the generated config file 176 | >"$CONFIGFILE" 177 | # Import dynamic config files 178 | mkdir -p "$OTHERCONFIGDIR" 179 | for f in "$OTHERCONFIGDIR"/*.conf; do 180 | [ -f "$f" ] && cat "$f" >> "$CONFIGFILE" 181 | done 182 | 183 | # Parse general and interface sections thanks to the "config_cb()" 184 | # callback. This allows to loop over all options without having to 185 | # know their name in advance. 186 | config_cb() { babel_config_cb "$@"; } 187 | config_load babeld 188 | # Parse filters separately, since we know which options we expect 189 | config_foreach babel_filter filter 190 | procd_open_instance 191 | # Using multiple config files is supported since babeld 1.5.1 192 | procd_set_param command /usr/sbin/babeld -I "" -c "$OTHERCONFIGFILE" -c "$CONFIGFILE" 193 | procd_set_param stdout 1 194 | procd_set_param stderr 1 195 | procd_set_param file "$OTHERCONFIGFILE" "$OTHERCONFIGDIR"/*.conf "$CONFIGFILE" 196 | procd_set_param respawn 197 | procd_close_instance 198 | } 199 | 200 | service_triggers() { 201 | procd_add_reload_trigger babeld 202 | } 203 | 204 | status() { 205 | kill -USR1 $(pgrep -P 1 babeld) 206 | } 207 | -------------------------------------------------------------------------------- /batctl/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-only 2 | 3 | include $(TOPDIR)/rules.mk 4 | 5 | PKG_NAME:=batctl 6 | PKG_VERSION:=2025.5 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:=1e0bcd49f92eeda0d76bc683562adf366024e2ee4c199fa402036f6b93cbb147 12 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) 13 | 14 | PKG_MAINTAINER:=Simon Wunderlich 15 | PKG_LICENSE:=GPL-2.0-only ISC MIT 16 | PKG_LICENSE_FILES:=LICENSES/preferred/GPL-2.0 LICENSES/preferred/MIT LICENSES/deprecated/ISC 17 | 18 | PKG_BUILD_PARALLEL:=1 19 | PKG_BUILD_FLAGS:=gc-sections lto 20 | 21 | include $(INCLUDE_DIR)/package.mk 22 | 23 | define Package/batctl/Default 24 | SECTION:=net 25 | CATEGORY:=Network 26 | URL:=https://www.open-mesh.org/ 27 | DEPENDS:=+libnl-tiny +libc +librt 28 | PROVIDES:=batctl 29 | endef 30 | 31 | define Package/batctl/description 32 | batctl is a more intuitive managment utility for B.A.T.M.A.N.-Advanced. 33 | It is an easier method for configuring batman-adv and provides some 34 | additional tools for debugging as well. This package builds 35 | version $(PKG_VERSION) of the user space utility. 36 | endef 37 | 38 | define Package/batctl-tiny 39 | $(call Package/batctl/Default) 40 | TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Minimal) 41 | VARIANT:=tiny 42 | ALTERNATIVES:=100:/usr/sbin/batctl:/usr/libexec/batctl-tiny 43 | endef 44 | 45 | define Package/batctl-tiny/description 46 | $(Package/batctl/description) 47 | Only configuration relevant subcommands are enabled. 48 | endef 49 | 50 | define Package/batctl-default 51 | $(call Package/batctl/Default) 52 | TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Default) 53 | VARIANT:=default 54 | ALTERNATIVES:=200:/usr/sbin/batctl:/usr/libexec/batctl-default 55 | endef 56 | 57 | define Package/batctl-default/description 58 | $(Package/batctl/description) 59 | Standard subcommands for configuration and online debugging are enabled. 60 | endef 61 | 62 | define Package/batctl-full 63 | $(call Package/batctl/Default) 64 | TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Full) 65 | VARIANT:=full 66 | ALTERNATIVES:=300:/usr/sbin/batctl:/usr/libexec/batctl-full 67 | endef 68 | 69 | define Package/batctl-full/description 70 | $(Package/batctl/description) 71 | Subcommands for configuration, online and offline debugging are enabled. 72 | endef 73 | 74 | MAKE_VARS += \ 75 | LIBNL_NAME="libnl-tiny" \ 76 | LIBNL_GENL_NAME="libnl-tiny" 77 | 78 | MAKE_FLAGS += \ 79 | REVISION="$(PKG_VERSION)-openwrt-$(PKG_RELEASE)" 80 | 81 | config-n := \ 82 | aggregation \ 83 | ap_isolation \ 84 | backbonetable \ 85 | bisect_iv \ 86 | bonding \ 87 | bla_backbone_json \ 88 | bla_claim_json \ 89 | bridge_loop_avoidance \ 90 | claimtable \ 91 | dat_cache \ 92 | dat_cache_json \ 93 | distributed_arp_table \ 94 | elp_interval \ 95 | event \ 96 | fragmentation \ 97 | gateways \ 98 | gateways_json \ 99 | gw_mode \ 100 | hardif_json \ 101 | hardifs_json \ 102 | hop_penalty \ 103 | interface \ 104 | isolation_mark \ 105 | loglevel \ 106 | mcast_flags \ 107 | mcast_flags_json \ 108 | mesh_json \ 109 | multicast_fanout \ 110 | multicast_forceflood \ 111 | multicast_mode \ 112 | neighbors \ 113 | neighbors_json \ 114 | orig_interval \ 115 | originators \ 116 | originators_json \ 117 | ping \ 118 | routing_algo \ 119 | statistics \ 120 | tcpdump \ 121 | throughput_override \ 122 | throughputmeter \ 123 | traceroute \ 124 | transglobal \ 125 | translate \ 126 | translocal \ 127 | transtable_global_json \ 128 | transtable_local_json \ 129 | vlan_json \ 130 | 131 | config-settings := \ 132 | aggregation \ 133 | ap_isolation \ 134 | bonding \ 135 | bridge_loop_avoidance \ 136 | distributed_arp_table \ 137 | elp_interval \ 138 | fragmentation \ 139 | gw_mode \ 140 | hop_penalty \ 141 | interface \ 142 | isolation_mark \ 143 | loglevel \ 144 | multicast_fanout \ 145 | multicast_forceflood \ 146 | multicast_mode \ 147 | orig_interval \ 148 | routing_algo \ 149 | throughput_override \ 150 | 151 | config-tables := \ 152 | backbonetable \ 153 | claimtable \ 154 | dat_cache \ 155 | gateways \ 156 | mcast_flags \ 157 | neighbors \ 158 | originators \ 159 | statistics \ 160 | transglobal \ 161 | translocal \ 162 | 163 | config-json := \ 164 | bla_backbone_json \ 165 | bla_claim_json \ 166 | dat_cache_json \ 167 | gateways_json \ 168 | hardif_json \ 169 | hardifs_json \ 170 | mcast_flags_json \ 171 | mesh_json \ 172 | neighbors_json \ 173 | originators_json \ 174 | transtable_global_json \ 175 | transtable_local_json \ 176 | vlan_json \ 177 | 178 | config-tools := \ 179 | event \ 180 | ping \ 181 | tcpdump \ 182 | throughputmeter \ 183 | traceroute \ 184 | translate \ 185 | 186 | config-extratools := \ 187 | bisect_iv \ 188 | 189 | ifeq ($(BUILD_VARIANT),tiny) 190 | 191 | config-y := \ 192 | $(config-settings) \ 193 | 194 | endif 195 | 196 | ifeq ($(BUILD_VARIANT),default) 197 | 198 | config-y := \ 199 | $(config-settings) \ 200 | $(config-tables) \ 201 | $(config-json) \ 202 | $(config-tools) \ 203 | 204 | endif 205 | 206 | ifeq ($(BUILD_VARIANT),full) 207 | 208 | config-y := \ 209 | $(config-settings) \ 210 | $(config-tables) \ 211 | $(config-json) \ 212 | $(config-tools) \ 213 | $(config-extratools) \ 214 | 215 | endif 216 | 217 | define ConfigVars 218 | $(subst $(space),,$(foreach opt,$(config-$(1)),CONFIG_$(opt)=$(1) 219 | )) 220 | endef 221 | 222 | define batctl_config 223 | $(call ConfigVars,n)$(call ConfigVars,y) 224 | endef 225 | $(eval $(call shexport,batctl_config)) 226 | 227 | MAKE_FLAGS += $$$$$(call shvar,batctl_config) 228 | 229 | define Package/batctl-tiny/install 230 | $(INSTALL_DIR) $(1)/usr/libexec 231 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-tiny 232 | endef 233 | 234 | define Package/batctl-default/install 235 | $(INSTALL_DIR) $(1)/usr/libexec 236 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-default 237 | endef 238 | 239 | define Package/batctl-full/install 240 | $(INSTALL_DIR) $(1)/usr/libexec 241 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-full 242 | endef 243 | 244 | $(eval $(call BuildPackage,batctl-default)) 245 | $(eval $(call BuildPackage,batctl-tiny)) 246 | $(eval $(call BuildPackage,batctl-full)) 247 | -------------------------------------------------------------------------------- /nodogsplash/files/etc/config/nodogsplash: -------------------------------------------------------------------------------- 1 | 2 | # The options available here are an adaptation of the settings used in nodogsplash.conf. 3 | # See https://github.com/nodogsplash/nodogsplash/blob/master/resources/nodogsplash.conf 4 | 5 | config nodogsplash 6 | # Set to 0 to disable nodogsplash 7 | option enabled 1 8 | 9 | # Set to 0 to disable hook that makes nodogsplash restart when the firewall restarts. 10 | # This hook is needed as a restart of Firewall overwrites nodogsplash iptables entries. 11 | option fwhook_enabled '1' 12 | 13 | # WebRoot 14 | # Default: /etc/nodogsplash/htdocs 15 | # 16 | # The local path where the splash page content resides. 17 | # ie. Serve the file splash.html from this directory 18 | #option webroot '/etc/nodogsplash/htdocs' 19 | 20 | # Use plain configuration file 21 | #option config '/etc/nodogsplash/nodogsplash.conf' 22 | 23 | # Use this option to set the device nodogsplash will bind to. 24 | # The value may be an interface section in /etc/config/network or a device name such as br-lan. 25 | option gatewayinterface 'br-lan' 26 | 27 | # GatewayPort 28 | # Default: 2050 29 | # 30 | # Nodogsplash's own http server uses gateway address as its IP address. 31 | # The port it listens to at that IP can be set here; default is 2050. 32 | # 33 | #option gatewayport '2050' 34 | 35 | 36 | option gatewayname 'OpenWrt Nodogsplash' 37 | option maxclients '250' 38 | 39 | # Enables debug output (0-3) 40 | #option debuglevel '1' 41 | 42 | # Client timeouts in minutes 43 | option preauthidletimeout '30' 44 | option authidletimeout '120' 45 | # Session Timeout is the interval after which clients are forced out (a value of 0 means never) 46 | option sessiontimeout '1200' 47 | 48 | # The interval in seconds at which nodogsplash checks client timeout status 49 | option checkinterval '600' 50 | 51 | # Enable BinAuth Support. 52 | # If set, a program is called with several parameters on authentication (request) and deauthentication. 53 | # Request for authentication: 54 | # $ auth_client '' '' 55 | # 56 | # The username and password values may be empty strings and are URL encoded. 57 | # The program is expected to output the number of seconds the client 58 | # is to be authenticated. Zero or negative seconds will cause the authentification request 59 | # to be rejected. The same goes for an exit code that is not 0. 60 | # The output may contain a user specific download and upload limit in KBit/s: 61 | # 62 | # 63 | # Called on authentication or deauthentication: 64 | # $ <*auth|*deauth> 65 | # 66 | # "client_auth": Client authenticated via this script. 67 | # "client_deauth": Client deauthenticated by the client via splash page. 68 | # "idle_deauth": Client was deauthenticated because of inactivity. 69 | # "timeout_deauth": Client was deauthenticated because the session timed out. 70 | # "ndsctl_auth": Client was authenticated manually by the ndsctl tool. 71 | # "ndsctl_deauth": Client was deauthenticated by the ndsctl tool. 72 | # "shutdown_deauth": Client was deauthenticated by Nodogsplash terminating. 73 | # 74 | # Values session_start and session_start are in seconds since 1970 or 0 for unknown/unlimited. 75 | # 76 | #option binauth '/bin/myauth.sh' 77 | # Enable PreAuth Support. 78 | # 79 | # A simple login script is provided in the package. 80 | # This generates a login page asking for usename and email address. 81 | # User logins are recorded in the log file /tmp/ndslog.log 82 | # Details of how the script works are contained in comments in the script itself. 83 | # 84 | # The Preauth program will output html code that will be served to the client by NDS 85 | # Using html GET the Preauth program may call: 86 | # /nodogsplash_preauth/ to ask the client for more information 87 | # or 88 | # /nodogsplash_auth/ to authenticate the client 89 | # 90 | # The Preauth program should append at least the client ip to the query string 91 | # (using html input type hidden) for all calls to /nodogsplash_preauth/ 92 | # It must also obtain the client token using ndsctl (or the original query string if fas_secure_enabled=0) 93 | # for NDS authentication when calling /nodogsplash_auth/ 94 | # 95 | #option preauth '/usr/lib/nodogsplash/login.sh' 96 | 97 | # Your router may have several interfaces, and you 98 | # probably want to keep them private from the gatewayinterface. 99 | # If so, you should block the entire subnets on those interfaces, e.g.: 100 | #list authenticated_users 'block to 192.168.0.0/16' 101 | #list authenticated_users 'block to 10.0.0.0/8' 102 | 103 | # Typical ports you will probably want to open up. 104 | #list authenticated_users 'allow tcp port 22' 105 | #list authenticated_users 'allow tcp port 53' 106 | #list authenticated_users 'allow udp port 53' 107 | #list authenticated_users 'allow tcp port 80' 108 | #list authenticated_users 'allow tcp port 443' 109 | # Or for happy customers allow all 110 | list authenticated_users 'allow all' 111 | 112 | # For preauthenticated users to resolve IP addresses in their 113 | # initial request not using the router itself as a DNS server, 114 | # Leave commented to help prevent DNS tunnelling 115 | #list preauthenticated_users 'allow tcp port 53' 116 | #list preauthenticated_users 'allow udp port 53' 117 | 118 | # Allow ports for SSH/Telnet/DNS/DHCP/HTTP/HTTPS 119 | list users_to_router 'allow tcp port 22' 120 | list users_to_router 'allow tcp port 23' 121 | list users_to_router 'allow tcp port 53' 122 | list users_to_router 'allow udp port 53' 123 | list users_to_router 'allow udp port 67' 124 | list users_to_router 'allow tcp port 80' 125 | 126 | # MAC addresses that are / are not allowed to access the splash page 127 | # Value is either 'allow' or 'block'. The allowedmac or blockedmac list is used. 128 | #option macmechanism 'allow' 129 | #list allowedmac '00:00:C0:01:D0:0D' 130 | #list allowedmac '00:00:C0:01:D0:1D' 131 | #list blockedmac '00:00:C0:01:D0:2D' 132 | 133 | # MAC addresses that do not need to authenticate 134 | #list trustedmac '00:00:C0:01:D0:1D' 135 | 136 | # Nodogsplash uses specific HEXADECIMAL values to mark packets used by iptables as a bitwise mask. 137 | # This mask can conflict with the requirements of other packages such as mwan3, sqm etc 138 | # Any values set here are interpreted as in hex format. 139 | # 140 | # List: fw_mark_authenticated 141 | # Default: 30000 (0011|0000|0000|0000|0000 binary) 142 | # 143 | # List: fw_mark_trusted 144 | # Default: 20000 (0010|0000|0000|0000|0000 binary) 145 | # 146 | # List: fw_mark_blocked 147 | # Default: 10000 (0001|0000|0000|0000|0000 binary) 148 | # 149 | #option fw_mark_authenticated '30000' 150 | #option fw_mark_trusted '20000' 151 | #option fw_mark_blocked '10000' 152 | 153 | -------------------------------------------------------------------------------- /olsrd/src/src/ubus.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include "defs.h" 17 | #include "ifnet.h" 18 | #include "interfaces.h" 19 | #include "link_set.h" 20 | #include "log.h" 21 | #include "olsr.h" 22 | #include "olsr_cfg.h" 23 | 24 | #include "ubus.h" 25 | 26 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) 27 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) 28 | 29 | // Shared state maintained throughout calls to handle ubus messages. 30 | static struct ubus_context *shared_ctx; 31 | 32 | enum { INTERFACE_IFNAME, INTERFACE_LQM, __INTERFACE_MAX }; 33 | 34 | static const struct blobmsg_policy interface_policy[__INTERFACE_MAX] = { 35 | [INTERFACE_IFNAME] = {"ifname", BLOBMSG_TYPE_STRING}, 36 | [INTERFACE_LQM] = {"lqm", BLOBMSG_TYPE_STRING}, 37 | }; 38 | 39 | static int olsrd_ubus_add_interface(struct ubus_context *ctx_local, 40 | struct ubus_object *obj, 41 | struct ubus_request_data *req, 42 | const char *method, struct blob_attr *msg) { 43 | struct blob_attr *tb[__INTERFACE_MAX]; 44 | struct blob_buf b = {0}; 45 | union olsr_ip_addr addr; 46 | int ret; 47 | char *ifname, *lqm; 48 | 49 | blobmsg_parse(interface_policy, __INTERFACE_MAX, tb, blob_data(msg), 50 | blob_len(msg)); 51 | 52 | if (!tb[INTERFACE_IFNAME]) 53 | return UBUS_STATUS_INVALID_ARGUMENT; 54 | 55 | ifname = blobmsg_get_string(tb[INTERFACE_IFNAME]); 56 | 57 | struct interface_olsr *tmp = if_ifwithname(ifname); 58 | if (tmp != NULL) { 59 | return UBUS_STATUS_PERMISSION_DENIED; 60 | } 61 | 62 | struct olsr_if *temp; 63 | for (temp = olsr_cnf->interfaces; temp != NULL; temp = temp->next) { 64 | if (strcmp(temp->name, ifname) == 0) 65 | return UBUS_STATUS_PERMISSION_DENIED; 66 | } 67 | 68 | struct olsr_if *tmp_ifs = olsr_create_olsrif(ifname, false); 69 | tmp_ifs->cnf = 70 | olsr_malloc(sizeof(struct if_config_options), "Set default config"); 71 | *tmp_ifs->cnf = *olsr_cnf->interface_defaults; 72 | 73 | if (tb[INTERFACE_LQM]) { // add interface lqm 74 | lqm = blobmsg_get_string(tb[INTERFACE_LQM]); 75 | memset(&addr, 0, sizeof(addr)); 76 | 77 | struct olsr_lq_mult *mult = malloc(sizeof(*mult)); 78 | if (mult == NULL) { 79 | olsr_syslog(OLSR_LOG_ERR, "Out of memory (LQ multiplier).\n"); 80 | return UBUS_STATUS_UNKNOWN_ERROR; 81 | } 82 | 83 | double lqm_value = atof(lqm); 84 | mult->addr = addr; 85 | mult->value = (uint32_t)(lqm_value * LINK_LOSS_MULTIPLIER); 86 | tmp_ifs->cnf->lq_mult = mult; 87 | tmp_ifs->cnf->orig_lq_mult_cnt++; 88 | } 89 | 90 | blob_buf_init(&b, 0); 91 | blobmsg_add_string(&b, "adding", ifname); 92 | 93 | ret = ubus_send_reply(ctx_local, req, b.head); 94 | if (ret) 95 | olsr_syslog(OLSR_LOG_ERR, "Failed to send reply: %s\n", ubus_strerror(ret)); 96 | 97 | blob_buf_free(&b); 98 | 99 | return ret; 100 | } 101 | 102 | static int olsrd_ubus_del_interface(struct ubus_context *ctx_local, 103 | struct ubus_object *obj, 104 | struct ubus_request_data *req, 105 | const char *method, struct blob_attr *msg) { 106 | struct blob_attr *tb[__INTERFACE_MAX]; 107 | struct blob_buf b = {0}; 108 | int ret; 109 | char *ifname; 110 | struct olsr_if *tmp_if, *del_if; 111 | 112 | blobmsg_parse(interface_policy, __INTERFACE_MAX, tb, blob_data(msg), 113 | blob_len(msg)); 114 | 115 | if (!tb[INTERFACE_IFNAME]) 116 | return UBUS_STATUS_INVALID_ARGUMENT; 117 | 118 | ifname = blobmsg_get_string(tb[INTERFACE_IFNAME]); 119 | 120 | struct interface_olsr *tmp = if_ifwithname(ifname); 121 | 122 | if (tmp != NULL) { 123 | 124 | struct olsr_if *temp = olsr_cnf->interfaces, *prev; 125 | if (temp != NULL && (strcmp(temp->name, ifname) == 0)) { 126 | olsr_cnf->interfaces = temp->next; 127 | olsr_remove_interface(temp); 128 | goto send_reply; 129 | } 130 | 131 | while (temp != NULL && (strcmp(temp->name, ifname) != 0)) { 132 | prev = temp; 133 | temp = temp->next; 134 | } 135 | 136 | if (temp == NULL) { 137 | goto send_reply; 138 | } 139 | 140 | prev->next = temp->next; 141 | olsr_remove_interface(temp); 142 | } else { 143 | return UBUS_STATUS_PERMISSION_DENIED; 144 | } 145 | 146 | send_reply: 147 | 148 | blob_buf_init(&b, 0); 149 | blobmsg_add_string(&b, "deleting", ifname); 150 | 151 | ret = ubus_send_reply(ctx_local, req, b.head); 152 | if (ret) 153 | olsr_syslog(OLSR_LOG_ERR, "Failed to send reply: %s\n", ubus_strerror(ret)); 154 | 155 | blob_buf_free(&b); 156 | 157 | return ret; 158 | } 159 | 160 | // List of functions we expose via the ubus bus. 161 | static const struct ubus_method olsrd_methods[] = { 162 | UBUS_METHOD("add_interface", olsrd_ubus_add_interface, interface_policy), 163 | UBUS_METHOD("del_interface", olsrd_ubus_del_interface, interface_policy), 164 | }; 165 | 166 | // Definition of the ubus object type. 167 | static struct ubus_object_type olsrd_object_type = 168 | UBUS_OBJECT_TYPE("olsrd", olsrd_methods); 169 | 170 | // Object we announce via the ubus bus. 171 | static struct ubus_object olsrd_object = { 172 | .name = "olsrd", 173 | .type = &olsrd_object_type, 174 | .methods = olsrd_methods, 175 | .n_methods = ARRAY_SIZE(olsrd_methods), 176 | }; 177 | 178 | // Registers handlers for olsrd methods in the global ubus context. 179 | static bool ubus_init_object() { 180 | int ret; 181 | 182 | ret = ubus_add_object(shared_ctx, &olsrd_object); 183 | if (ret) { 184 | olsr_syslog(OLSR_LOG_ERR, "Failed to add object: %s\n", ubus_strerror(ret)); 185 | return false; 186 | } 187 | 188 | return true; 189 | } 190 | 191 | // Initializes the global ubus context, connecting to the bus to be able to 192 | // receive and send messages. 193 | static bool olsrd_ubus_init(void) { 194 | if (shared_ctx) 195 | return true; 196 | 197 | shared_ctx = ubus_connect(NULL); 198 | if (!shared_ctx) 199 | return false; 200 | 201 | return true; 202 | } 203 | 204 | void olsrd_ubus_receive(fd_set *readfds) { 205 | if (!shared_ctx) 206 | return; 207 | if (FD_ISSET(shared_ctx->sock.fd, readfds)) 208 | ubus_handle_event(shared_ctx); 209 | } 210 | 211 | int olsrd_ubus_add_read_sock(fd_set *readfds, int maxfd) { 212 | if (!shared_ctx) 213 | return maxfd; 214 | 215 | FD_SET(shared_ctx->sock.fd, readfds); 216 | return MAX(maxfd, shared_ctx->sock.fd + 1); 217 | } 218 | 219 | bool olsrd_add_ubus() { 220 | if (!olsrd_ubus_init()) { 221 | olsr_syslog(OLSR_LOG_ERR, "Failed to initialize ubus!\n"); 222 | return false; 223 | } 224 | if (!ubus_init_object()) { 225 | olsr_syslog(OLSR_LOG_ERR, "Failed to add objects to ubus!\n"); 226 | return false; 227 | } 228 | return true; 229 | } 230 | --------------------------------------------------------------------------------