diff --git a/alfred/Config.in b/alfred/Config.in deleted file mode 100644 index 97f9ea21f..000000000 --- a/alfred/Config.in +++ /dev/null @@ -1,22 +0,0 @@ -config ALFRED_NEEDS_lua - bool - -config ALFRED_NEEDS_libgps - bool - -config PACKAGE_ALFRED_VIS - bool "enable vis server for alfred" - depends on PACKAGE_alfred - default y - -config PACKAGE_ALFRED_BATHOSTS - bool "enable autogeneration of /etc/bat-hosts" - depends on PACKAGE_alfred - select ALFRED_NEEDS_lua - default n - -config PACKAGE_ALFRED_GPSD - bool "enable gpsd service for alfred" - depends on PACKAGE_alfred - select ALFRED_NEEDS_libgps - default n diff --git a/alfred/Makefile b/alfred/Makefile deleted file mode 100644 index c815200aa..000000000 --- a/alfred/Makefile +++ /dev/null @@ -1,88 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only - -include $(TOPDIR)/rules.mk - -PKG_NAME:=alfred -PKG_VERSION:=2026.2 -PKG_RELEASE:=2 - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) -PKG_HASH:=d995748be5f62a42091525ccc102df5ac642186e9b9014698a955a4469b69b96 - -PKG_MAINTAINER:=Simon Wunderlich -PKG_LICENSE:=GPL-2.0-only MIT -PKG_LICENSE_FILES:=LICENSES/preferred/GPL-2.0 LICENSES/preferred/MIT - -PKG_BUILD_PARALLEL:=1 -PKG_BUILD_FLAGS:=gc-sections lto - -PKG_CONFIG_DEPENDS += \ - CONFIG_ALFRED_NEEDS_lua \ - CONFIG_ALFRED_NEEDS_libgps \ - CONFIG_PACKAGE_ALFRED_VIS \ - CONFIG_PACKAGE_ALFRED_BATHOSTS \ - CONFIG_PACKAGE_ALFRED_GPSD - -include $(INCLUDE_DIR)/package.mk - -define Package/alfred - SECTION:=net - CATEGORY:=Network - TITLE:=A.L.F.R.E.D. - Almighty Lightweight Fact Remote Exchange Daemon - URL:=https://www.open-mesh.org/ - DEPENDS:=@IPV6 +libnl-tiny +librt \ - +ALFRED_NEEDS_lua:lua \ - +ALFRED_NEEDS_libgps:libgps -endef - -define Package/alfred/description - alfred is a user space daemon for distributing arbitrary local information - over the mesh/network in a decentralized fashion. This data can be anything - which appears to be useful - originally designed to replace the batman-adv - visualization (vis), you may distribute hostnames, phone books, administration - information, DNS information, the local weather forecast ... - - alfred runs as daemon in the background of the system. A user may insert - information by using the alfred binary on the command line, or use special - programs to communicate with alfred (done via unix sockets). alfred then takes - care of distributing the local information to other alfred servers on other - nodes. This is done via IPv6 link-local multicast, and does not require any - configuration. A user can request data from alfred, and will receive the - information available from all alfred servers in the network. -endef - -define Package/alfred/conffiles -/etc/config/alfred -/etc/alfred/bat-hosts.lua -endef - -define Package/alfred/config - source "$(SOURCE)/Config.in" -endef - -MAKE_FLAGS += \ - CONFIG_ALFRED_VIS=$(if $(CONFIG_PACKAGE_ALFRED_VIS),y,n) \ - CONFIG_ALFRED_GPSD=$(if $(CONFIG_PACKAGE_ALFRED_GPSD),y,n) \ - CONFIG_ALFRED_CAPABILITIES=n \ - LIBNL_NAME="libnl-tiny" \ - LIBNL_GENL_NAME="libnl-tiny" \ - REVISION="$(PKG_VERSION)-openwrt-$(PKG_RELEASE)" - -define Package/alfred/install - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/alfred $(1)/usr/sbin/ - $(if $(CONFIG_PACKAGE_ALFRED_VIS), \ - $(INSTALL_BIN) $(PKG_BUILD_DIR)/vis/batadv-vis $(1)/usr/sbin/) - $(if $(CONFIG_PACKAGE_ALFRED_GPSD), \ - $(INSTALL_BIN) $(PKG_BUILD_DIR)/gpsd/alfred-gpsd $(1)/usr/sbin/) - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/alfred.init $(1)/etc/init.d/alfred - $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_CONF) ./files/alfred.config $(1)/etc/config/alfred - $(INSTALL_DIR) $(1)/etc/alfred - $(if $(CONFIG_PACKAGE_ALFRED_BATHOSTS), \ - $(INSTALL_BIN) ./files/bat-hosts.lua $(1)/etc/alfred/bat-hosts.lua) -endef - -$(eval $(call BuildPackage,alfred)) diff --git a/alfred/files/alfred.config b/alfred/files/alfred.config deleted file mode 100644 index 704adf13b..000000000 --- a/alfred/files/alfred.config +++ /dev/null @@ -1,8 +0,0 @@ -config 'alfred' 'alfred' - list interface 'br-lan' - option mode 'master' - option batmanif 'bat0' - option start_vis '1' - option run_facters '1' -# REMOVE THIS LINE TO ENABLE ALFRED - option disabled '1' diff --git a/alfred/files/alfred.init b/alfred/files/alfred.init deleted file mode 100755 index f191827fd..000000000 --- a/alfred/files/alfred.init +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/sh /etc/rc.common - -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -START=99 -USE_PROCD=1 -alfred_args="" -vis_args="" -facters_dir="/etc/alfred" -enable=0 -vis_enable=0 - -append_interface() -{ - append "interfaces" "$1" "," -} - -alfred_start() { - local args="" - local section="$1" - local disabled interface mode - local interfaces - - # check if section is disabled - config_get_bool disabled "$section" disabled 0 - [ $disabled = 0 ] || return 1 - - args="-f" - - config_list_foreach "$section" "interface" append_interface - if [ -z "$interfaces" ]; then - config_get interface "$section" interface - append_interface "$interface" - fi - append args "-i $interfaces" - - config_get mode "$section" mode - [ "$mode" = "master" ] && append args "-m" - - config_get batmanif "$section" batmanif - append args "-b $batmanif" - - append alfred_args "$args" - enable=1 - - config_get_bool start_vis "$section" start_vis 0 - if [ "$start_vis" = 1 ] && [ -x /usr/sbin/batadv-vis ]; then - vis_enable=1 - append vis_args "-i $batmanif -s" - fi - - config_get_bool run_facters "$section" run_facters 0 - - return 0 -} - -start_service() { - config_load "alfred" - config_foreach alfred_start alfred - - [ "$enable" = "0" ] && return 0 - - procd_open_instance "alfred" - procd_set_param command /usr/sbin/alfred - procd_append_param command ${alfred_args} - procd_close_instance - - [ "$vis_enable" = "1" ] && { - procd_open_instance "batadv-vis" - procd_set_param command /usr/sbin/batadv-vis - procd_append_param command ${vis_args} - procd_close_instance - } - - [ "$run_facters" = "1" ] && { - ( for file in $facters_dir/* ; do [ -x $file ] && $file ; done ) - if ! ( grep -q "for file in $facters_dir/\* ; do " /etc/crontabs/root 2>/dev/null ) ; then - echo "*/5 * * * * ( for file in $facters_dir/* ; do [ -x \$file ] && \$file ; done )" >> /etc/crontabs/root - /etc/init.d/cron enable - /etc/init.d/cron restart - fi - } -} - -service_triggers() { - procd_add_reload_trigger "alfred" -} - -stop_service() { - [ -e /etc/crontabs/root ] && { - sed "\|for file in $facters_dir/\* ; do |d" -i /etc/crontabs/root - /etc/init.d/cron restart - } -} diff --git a/alfred/files/bat-hosts.lua b/alfred/files/bat-hosts.lua deleted file mode 100644 index c9b561939..000000000 --- a/alfred/files/bat-hosts.lua +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/lua - -local type_id = 64 -- bat-hosts - -function get_hostname() - local hostfile = io.open("/proc/sys/kernel/hostname", "r") - if not hostfile then return nil end - local ret_string = hostfile:read() - hostfile:close() - return ret_string -end - -function get_interfaces_names() - local ret = {} - - for name in io.popen("ls -1 /sys/class/net/"):lines() do - table.insert(ret, name) - end - - return ret -end - -function get_interface_address(name) - -- /sys/class/net also contains plain files, e.g. bonding_masters - -- once the bonding module is loaded, which have no address below them - local addressfile = io.open("/sys/class/net/"..name.."/address", "r") - if not addressfile then return nil end - local ret_string = addressfile:read() - addressfile:close() - return ret_string -end - - -local function generate_bat_hosts() --- get hostname and interface macs/names --- then return a table containing valid bat-hosts lines - local n, i - local ifaces, ret = {}, {} - - local hostname = get_hostname() - - for n, i in ipairs(get_interfaces_names()) do - local address = get_interface_address(i) - if address and not ifaces[address] then ifaces[address] = i end - end - - for mac, iname in pairs(ifaces) do - if mac:match("^%x%x:%x%x:%x%x:%x%x:%x%x:%x%x$") and not mac:match("00:00:00:00:00:00") then - table.insert(ret, mac.." "..hostname.."_"..iname.."\n") - end - end - - return ret -end - -local function publish_bat_hosts() --- pass a raw chunk of data to alfred - local fd = io.popen("alfred -s " .. type_id, "w") - if fd then - local ret = generate_bat_hosts() - if ret then - fd:write(table.concat(ret)) - end - fd:close() - end -end - -local function write_bat_hosts(rows) - local content = { "### /tmp/bat-hosts generated by alfred-bat-hosts\n", - "### /!\\ This file is overwritten every 5 minutes /!\\\n", - "### (To keep manual changes, replace /etc/bat-hosts symlink with a static file)\n" } - - -- merge the chunks from all nodes, de-escaping newlines - for _, row in ipairs(rows) do - local node, value = unpack(row) - table.insert(content, "# Node ".. node .. "\n") - table.insert(content, value:gsub("\x0a", "\n") .. "\n") - end - - -- write parsed content down to disk - local fd = io.open("/tmp/bat-hosts", "w") - if fd then - fd:write(table.concat(content)) - fd:close() - end - - -- try to make a symlink in /etc pointing to /tmp, - -- if it exists, ln will do nothing. - os.execute("ln -ns /tmp/bat-hosts /etc/bat-hosts 2>/dev/null") -end - -local function receive_bat_hosts() --- read raw chunks from alfred, convert them to a nested table and call write_bat_hosts --- "alfred -r" can fail in slave nodes (returns empty stdout), so: --- check output is not null before writing /tmp/bat-hosts, and retry 3 times before giving up. - for n = 1, 3 do - local fd = io.popen("alfred -r " .. type_id) - --[[ this command returns something like - { "54:e6:fc:b9:cb:37", "00:11:22:33:44:55 ham_wlan0\x0a00:22:33:22:33:22 ham_eth0\x0a" }, - { "90:f6:52:bb:ec:57", "00:22:33:22:33:23 spam\x0a" }, - ]]-- - - if fd then - local output = fd:read("*a") - fd:close() - if output and output ~= "" then - assert(loadstring("rows = {" .. output .. "}"))() - write_bat_hosts(rows) - break - end - end - end -end - -publish_bat_hosts() -receive_bat_hosts() diff --git a/babeld/Makefile b/babeld/Makefile deleted file mode 100644 index 48604e974..000000000 --- a/babeld/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later -# -# Copyright (C) 2007-2021 OpenWrt.org -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=babeld -PKG_VERSION:=1.13.1 -PKG_RELEASE:=2 - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://www.irif.fr/~jch/software/files/ -PKG_HASH:=15f24d26da0ccfc073abcdef0309f281e4684f2aa71126f826572c4c845e8dd9 - -PKG_MAINTAINER:=Gabriel Kerneis , \ - Baptiste Jonglez , \ - Nick Hainke -PKG_LICENSE:=MIT -PKG_LICENSE_FILES:=LICENCE - -include $(INCLUDE_DIR)/package.mk - -define Package/babeld - SECTION:=net - CATEGORY:=Network - SUBMENU:=Routing and Redirection - TITLE:=A loop-avoiding distance-vector routing protocol - URL:=https://www.irif.fr/~jch/software/babel/ - DEPENDS:=@IPV6 +libubus +libubox -endef - -define Package/babeld/description - Babel is a loop-avoiding distance-vector routing protocol for IPv6 and IPv4 - with fast convergence properties. It is based on the ideas in DSDV, AODV and - Cisco's EIGRP, but is designed to work well not only in wired networks but - also in wireless mesh networks, and has been extended with support for - overlay networks. Babel is an IETF standard protocol (RFC 8966). -endef - -define Package/babeld/conffiles -/etc/babeld.conf -/etc/config/babeld -endef - -MAKE_FLAGS+= \ - CFLAGS="$(TARGET_CFLAGS)" \ - LDLIBS="" \ - LDLIBS+="-lubus -lubox" - -define Package/babeld/install - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/babeld $(1)/usr/sbin/ - $(INSTALL_DIR) $(1)/etc - $(INSTALL_CONF) ./files/babeld.conf $(1)/etc/ - $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_CONF) ./files/babeld.config $(1)/etc/config/babeld - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/babeld.init $(1)/etc/init.d/babeld -endef - -$(eval $(call BuildPackage,babeld)) diff --git a/babeld/files/babeld.conf b/babeld/files/babeld.conf deleted file mode 100644 index 746139d31..000000000 --- a/babeld/files/babeld.conf +++ /dev/null @@ -1,38 +0,0 @@ -# babel config file -# -# This config file simply documents sample entries. -# "redistribute" means: redistribute routes from other routing protocols -# into babel. "local" means addresses assigned to local interfaces. -# -# You do not need to edit this file: you can use /etc/config/babeld -# instead (sections "interface" and "filter"). Both files can be used -# simultaneously (the rules of this file are executed first). - -# the default rules are: -# -## redistribute local -## redistribute deny -# -# this says, redistribute local addresses but no other routes - - -# redistribute IPv4 default route into babel -## redistribute local ip 0.0.0.0/0 le 0 metric 128 - -# same but for IPv6 -## redistribute local ip ::/0 le 0 metric 128 - - -# don't redistribute all local addresses, only selected ones -# after the first line, the "deny" rules kicks in. After the "deny" -# no redistribute local rules are going to match -## redistribute local ip 192.160.4.0/24 -## redistribute local deny - - -# Babel refuses to redistribute routes with a protocol number of "boot"; -# this is standard practice, and means that you cannot easily -# redistribute the default route installed by dhcp. It is however -# possible to redistribute such route by explicitly specifying "proto 3" -# on the redistribute line. -## redistribute ip 0.0.0.0/0 le 0 proto 3 metric 128 diff --git a/babeld/files/babeld.config b/babeld/files/babeld.config deleted file mode 100644 index 1e9367e7c..000000000 --- a/babeld/files/babeld.config +++ /dev/null @@ -1,103 +0,0 @@ -package babeld - -# Detailed documentation: https://openwrt.org/docs/guide-user/services/babeld - -# Babeld reads options from the following files (the last one takes precedence -# if an option is defined in several places): -# - the file defined by the option conf_file (default: /etc/babeld.conf), -# - *.conf files in the directory defined by conf_dir (default: /tmp/babel.d/), -# - this UCI configuration file. - -# See "man babeld" for all available options ("Global options"). -# Important: remember to use '_' instead of '-' in option names. -config general - # option 'random_id' 'true' - # option 'debug' '1' - # option 'local_port' '33123' - # option 'log_file' '/var/log/babeld.log' - ## Enable ipv6-subtrees by default since OpenWrt should ship with a - ## recent enough kernel for it to work. - option 'ipv6_subtrees' 'true' - # list 'import_table' '42' - # list 'import_table' '100' - ## Alternative configuration file and directory. - ## See comment at the top of this file for more details. - # option 'conf_file' '/etc/babeld.conf' - # option 'conf_dir' '/tmp/babel.d/' - # option 'ubus_bindings' 'false' - -config interface - ## Remove this line to enable babeld on this interface - option 'ignore' 'true' - ## You can use aliases (like lan, wlan) or real names (like eth0.0). - ## If you use an alias, it must be already defined when babeld starts. - ## Otherwise, the name is taken literally and the interface can be - ## brought up later (useful for tunnels for instance). - option 'ifname' 'wlan' - ## You can set options, see babeld man page ("Interface configuration") - # option 'rxcost' '256' - # option 'hello_interval' '1' - -config interface - option 'ignore' 'true' - ## Physical interface name - option 'ifname' 'tun-example' - ## Specify the type of interface: tunnels use the RTT-based metric. - option 'type' 'tunnel' - ## Other options that can be overriden. - # option 'max_rtt_penalty' '96' - -# A config interface without "option ifname" will set default options -# for all interfaces. Interface-specific configuration always overrides -# default configuration. -config interface - # option 'enable_timestamps' 'true' - # option 'update_interval' '30' - - -# A filter consists of a type ('in', 'out', 'redistribute' or 'install'), -# a set of selectors ('ip', 'eq', etc.) and a set of actions to perform -# ('allow', 'deny', 'metric xxx', 'src-prefix xxx', 'table xxx', 'pref-src xxx'). -# See babeld man page ("Filtering rules") for more details. - -# Below is a sample filter that redistributes the default route if its -# protocol number is "boot", e.g. when it is installed by dhcp (see -# /etc/iproute2/rt_protos). This filter is disabled thanks to the 'ignore' -# setting. -config filter - option 'ignore' 'true' - # Type of filter - option 'type' 'redistribute' - # Selectors: ip, eq, le, ge, src_ip, src_eq, src_le, src_ge, neigh, id, - # proto, local, if. - option 'ip' '0.0.0.0/0' - option 'eq' '0' - option 'proto' '3' - # Action, which can be any of: allow, deny, metric , src-prefix , - # table , pref-src . - # The action defaults to "allow" if not specified. Here, we specify a higher - # redistribution metric than the default (0). - option 'action' 'metric 128' - -# Another example filter: don't redistribute local addresses in a certain IP prefix. -# By default, babeld redistributes *all* local addresses. -config filter - option 'ignore' 'true' - option 'type' 'redistribute' - # Only apply to routes/addresses within this prefix. - option 'ip' '198.51.100.0/24' - # Notice that the 'local' selector is a boolean. - option 'local' 'true' - # Don't redistribute. - option 'action' 'deny' - -# Example install filter, to change or filter routes before they are inserted -# into the kernel. -config filter - option 'ignore' 'true' - option 'type' 'install' - # Optional: only apply to routes within 2001:db8:cafe::/48 - option 'ip' '2001:db8:cafe::/48' - # We specify the kernel routing table and the preferred source address to use for these routes. - # "Allow" is implicit. - option 'action' 'table 200 pref-src 2001:db8:ba:be1::42' diff --git a/babeld/files/babeld.init b/babeld/files/babeld.init deleted file mode 100755 index 378a8abcd..000000000 --- a/babeld/files/babeld.init +++ /dev/null @@ -1,206 +0,0 @@ -#!/bin/sh /etc/rc.common - -. $IPKG_INSTROOT/lib/functions/network.sh - -USE_PROCD=1 -START=70 - -CONFIGFILE='/var/etc/babeld.conf' -OTHERCONFIGFILE="/etc/babeld.conf" -OTHERCONFIGDIR="/tmp/babeld.d/" -EXTRA_COMMANDS="status" -EXTRA_HELP=" status Dump Babel's table to the log file." - -# Append a line to the configuration file -cfg_append() { - local value="$1" - echo "$value" >> "$CONFIGFILE" -} - -cfg_append_option() { - local section="$1" - local option="$2" - local value - config_get value "$section" "$option" - # babeld convention for options is '-', not '_' - [ -n "$value" ] && cfg_append "${option//_/-} $value" -} - -# Append to the "$buffer" variable -append_ifname() { - local section="$1" - local option="$2" - local switch="$3" - local _name - config_get _name "$section" "$option" - [ -z "$_name" ] && return 0 - local ifname=$(uci_get_state network "$_name" ifname "$_name") - append buffer "$switch $ifname" -} - -append_bool() { - local section="$1" - local option="$2" - local value="$3" - local _loctmp - config_get_bool _loctmp "$section" "$option" 0 - [ "$_loctmp" -gt 0 ] && append buffer "$value" -} - -append_parm() { - local section="$1" - local option="$2" - local switch="$3" - local _loctmp - config_get _loctmp "$section" "$option" - [ -z "$_loctmp" ] && return 0 - append buffer "$switch $_loctmp" -} - -babel_filter() { - local cfg="$1" - local _loctmp - - local _ignored - config_get_bool _ignored "$cfg" 'ignore' 0 - [ "$_ignored" -eq 1 ] && return 0 - - unset buffer - append_parm "$cfg" 'type' '' - - append_bool "$cfg" 'local' 'local' - - append_parm "$cfg" 'ip' 'ip' - append_parm "$cfg" 'eq' 'eq' - append_parm "$cfg" 'le' 'le' - append_parm "$cfg" 'ge' 'ge' - append_parm "$cfg" 'src_ip' 'src-ip' - append_parm "$cfg" 'src_eq' 'src-eq' - append_parm "$cfg" 'src_le' 'src-le' - append_parm "$cfg" 'src_ge' 'src-ge' - append_parm "$cfg" 'neigh' 'neigh' - append_parm "$cfg" 'id' 'id' - append_parm "$cfg" 'proto' 'proto' - - append_ifname "$cfg" 'if' 'if' - - append_parm "$cfg" 'action' '' - - cfg_append "$buffer" -} - -# Only one of babeld's options is allowed multiple times, "import-table". -# We just append it multiple times. -list_cb() { - option_cb "$@" -} - -babel_config_cb() { - local type="$1" - local section="$2" - case "$type" in - "general") - option_cb() { - local option="$1" - local value="$2" - # Ignore options that are not supposed to be given to babeld - [ "$option" = "conf_file" ] && return - [ "$option" = "conf_dir" ] && return - # Skip lists. They will be taken care of by list_cb - test "${option#*_ITEM}" != "$option" && return - test "${option#*_LENGTH}" != "$option" && return - cfg_append "${option//_/-} $value" - } - ;; - "interface") - local _ifname - config_get _ifname "$section" 'ifname' - # Try to resolve the logical interface name - unset interface - network_get_device interface "$_ifname" || interface="$_ifname" - option_cb() { - local option="$1" - local value="$2" - local _interface - # "option ifname" is a special option, don't actually - # generate configuration for it. - [ "$option" = "ifname" ] && return - [ -n "$interface" ] && _interface="interface $interface" || _interface="default" - cfg_append "$_interface ${option//_/-} $value" - } - # Handle ignore options. - local _ignored - # This works because we loaded the whole configuration - # beforehand (see config_load below). - config_get_bool _ignored "$section" 'ignore' 0 - if [ "$_ignored" -eq 1 ] - then - option_cb() { return; } - else - # Also include an empty "interface $interface" statement, - # so that babeld operates on this interface. - [ -n "$interface" ] && cfg_append "interface $interface" - fi - ;; - *) - # Don't use reset_cb, this would also reset config_cb - option_cb() { return; } - ;; - esac -} - -# Support for conf_file and conf_dir -babel_configpaths() { - local cfg="$1" - local conf_file - config_get conf_file "$cfg" "conf_file" - [ -n "$conf_file" ] && OTHERCONFIGFILE="$conf_file" - local conf_dir - config_get conf_dir "$cfg" "conf_dir" - [ -n "$conf_dir" ] && OTHERCONFIGDIR="$conf_dir" -} - -start_service() { - mkdir -p /var/lib - mkdir -p /var/etc - - # First load the whole config file, without callbacks, so that we are - # aware of all "ignore" options in the second pass. This also allows - # to load the configuration paths (conf_file and conf_dir). - config_load babeld - - # Configure alternative configuration file and directory - config_foreach babel_configpaths "general" - - # Start by emptying the generated config file - >"$CONFIGFILE" - # Import dynamic config files - mkdir -p "$OTHERCONFIGDIR" - for f in "$OTHERCONFIGDIR"/*.conf; do - [ -f "$f" ] && cat "$f" >> "$CONFIGFILE" - done - - # Parse general and interface sections thanks to the "config_cb()" - # callback. This allows to loop over all options without having to - # know their name in advance. - config_cb() { babel_config_cb "$@"; } - config_load babeld - # Parse filters separately, since we know which options we expect - config_foreach babel_filter filter - procd_open_instance - # Using multiple config files is supported since babeld 1.5.1 - procd_set_param command /usr/sbin/babeld -I "" -c "$OTHERCONFIGFILE" -c "$CONFIGFILE" - procd_set_param stdout 1 - procd_set_param stderr 1 - procd_set_param file "$OTHERCONFIGFILE" "$OTHERCONFIGDIR"/*.conf "$CONFIGFILE" - procd_set_param respawn - procd_close_instance -} - -service_triggers() { - procd_add_reload_trigger babeld -} - -status() { - kill -USR1 $(pgrep -P 1 babeld) -} diff --git a/babeld/patches/600-add-ubus.patch b/babeld/patches/600-add-ubus.patch deleted file mode 100644 index 2f70a57a7..000000000 --- a/babeld/patches/600-add-ubus.patch +++ /dev/null @@ -1,132 +0,0 @@ ---- a/babeld.c -+++ b/babeld.c -@@ -54,6 +54,8 @@ THE SOFTWARE. - #include "local.h" - #include "version.h" - -+#include "ubus.h" -+ - struct timeval now; - - unsigned char myid[8]; -@@ -505,6 +507,9 @@ main(int argc, char **argv) - } - } - -+ if(ubus_bindings) -+ babeld_add_ubus(); -+ - init_signals(); - rc = resize_receive_buffer(1500); - if(rc < 0) -@@ -597,6 +602,8 @@ main(int argc, char **argv) - FD_SET(local_sockets[i].fd, &readfds); - maxfd = MAX(maxfd, local_sockets[i].fd); - } -+ if(ubus_bindings) -+ maxfd = babeld_ubus_add_read_sock(&readfds, maxfd); - rc = select(maxfd + 1, &readfds, NULL, NULL, &tv); - if(rc < 0) { - if(errno != EINTR) { -@@ -665,6 +672,9 @@ main(int argc, char **argv) - i++; - } - -+ if(ubus_bindings) -+ babeld_ubus_receive(&readfds); -+ - if(reopening) { - kernel_dump_time = now.tv_sec; - check_neighbours_timeout = now; ---- a/generate-version.sh -+++ b/generate-version.sh -@@ -10,4 +10,4 @@ else - version="unknown" - fi - --echo "#define BABELD_VERSION \"$version\"" -+echo "#define BABELD_VERSION \"$version-ubus-mod\"" ---- a/configuration.c -+++ b/configuration.c -@@ -42,6 +42,8 @@ THE SOFTWARE. - #include "hmac.h" - #include "configuration.h" - -+#include "ubus.h" -+ - static struct filter *input_filters = NULL; - static struct filter *output_filters = NULL; - static struct filter *redistribute_filters = NULL; -@@ -1024,7 +1026,8 @@ parse_option(int c, gnc_t gnc, void *clo - strcmp(token, "daemonise") == 0 || - strcmp(token, "skip-kernel-setup") == 0 || - strcmp(token, "ipv6-subtrees") == 0 || -- strcmp(token, "reflect-kernel-metric") == 0) { -+ strcmp(token, "reflect-kernel-metric") == 0 || -+ strcmp(token, "ubus-bindings") == 0) { - int b; - c = getbool(c, &b, gnc, closure); - if(c < -1) -@@ -1042,6 +1045,8 @@ parse_option(int c, gnc_t gnc, void *clo - has_ipv6_subtrees = b; - else if(strcmp(token, "reflect-kernel-metric") == 0) - reflect_kernel_metric = b; -+ else if(strcmp(token, "ubus-bindings") == 0) -+ ubus_bindings = b; - else - abort(); - } else if(strcmp(token, "protocol-group") == 0) { ---- a/local.c -+++ b/local.c -@@ -42,6 +42,8 @@ THE SOFTWARE. - #include "local.h" - #include "version.h" - -+#include "ubus.h" -+ - int local_server_socket = -1; - struct local_socket local_sockets[MAX_LOCAL_SOCKETS]; - int num_local_sockets = 0; -@@ -191,6 +193,8 @@ local_notify_neighbour(struct neighbour - if(local_sockets[i].monitor) - local_notify_neighbour_1(&local_sockets[i], neigh, kind); - } -+ if(ubus_bindings) -+ ubus_notify_neighbour(neigh, kind); - } - - static void -@@ -228,6 +232,8 @@ local_notify_xroute(struct xroute *xrout - if(local_sockets[i].monitor) - local_notify_xroute_1(&local_sockets[i], xroute, kind); - } -+ if(ubus_bindings) -+ ubus_notify_xroute(xroute, kind); - } - - static void -@@ -273,6 +279,8 @@ local_notify_route(struct babel_route *r - if(local_sockets[i].monitor) - local_notify_route_1(&local_sockets[i], route, kind); - } -+ if(ubus_bindings) -+ ubus_notify_route(route, kind); - } - - static void ---- a/Makefile -+++ b/Makefile -@@ -11,11 +11,11 @@ LDLIBS = -lrt - - SRCS = babeld.c net.c kernel.c util.c interface.c source.c neighbour.c \ - route.c xroute.c message.c resend.c configuration.c local.c \ -- hmac.c rfc6234/sha224-256.c BLAKE2/ref/blake2s-ref.c -+ hmac.c ubus.c rfc6234/sha224-256.c BLAKE2/ref/blake2s-ref.c - - OBJS = babeld.o net.o kernel.o util.o interface.o source.o neighbour.o \ - route.o xroute.o message.o resend.o configuration.o local.o \ -- hmac.o rfc6234/sha224-256.o BLAKE2/ref/blake2s-ref.o -+ hmac.o ubus.o rfc6234/sha224-256.o BLAKE2/ref/blake2s-ref.o - - babeld: $(OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) -o babeld $(OBJS) $(LDLIBS) diff --git a/babeld/src/ubus.c b/babeld/src/ubus.c deleted file mode 100644 index a4bdf7a14..000000000 --- a/babeld/src/ubus.c +++ /dev/null @@ -1,539 +0,0 @@ -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "babeld.h" -#include "configuration.h" -#include "interface.h" -#include "kernel.h" -#include "local.h" -#include "message.h" -#include "neighbour.h" -#include "net.h" -#include "resend.h" -#include "route.h" -#include "source.h" -#include "util.h" -#include "version.h" -#include "xroute.h" - -#include "ubus.h" - -// Definition of header variable whether to enable ubus bindings. -int ubus_bindings = 0; - -// Shared state maintained throughout calls to handle ubus messages. -static struct ubus_context *shared_ctx; - -// List of exported routes (to be used with ubox's list helpers). -struct xroute_list_entry { - struct list_head list; - struct xroute *xroute; -}; - -// List of received routes (to be used with ubox's list helpers). -struct route_list_entry { - struct list_head list; - struct babel_route *route; -}; - -// List of neighbours (to be used with ubox's list helpers). -struct neighbour_list_entry { - struct list_head list; - struct neighbour *neighbour; -}; - -// Definition of interface function enums (to be used with ubox's blobmsg -// helpers). -enum { INTERFACE_IFNAME, __INTERFACE_MAX }; - -// Definition of interface parsing (to be used with ubox's blobmsg helpers). -static const struct blobmsg_policy interface_policy[__INTERFACE_MAX] = { - [INTERFACE_IFNAME] = {"ifname", BLOBMSG_TYPE_STRING}, -}; - -// Definition of filter function enums (to be used with ubox's blobmsg -// helpers). -enum { FILTER_IFNAME, FILTER_TYPE, FILTER_METRIC, __FILTER_MAX }; - -// Definition of filter parsing (to be used with ubox's blobmsg helpers). -static const struct blobmsg_policy filter_policy[__FILTER_MAX] = { - [FILTER_IFNAME] = {"ifname", BLOBMSG_TYPE_STRING}, - [FILTER_TYPE] = {"type", BLOBMSG_TYPE_INT32}, - [FILTER_METRIC] = {"metric", BLOBMSG_TYPE_INT32}, -}; - -// Adds a filter (ubus equivalent to "filter"-function). -static int babeld_ubus_add_filter(struct ubus_context *ctx_local, - struct ubus_object *obj, - struct ubus_request_data *req, - const char *method, struct blob_attr *msg) { - struct blob_attr *tb[__FILTER_MAX]; - struct blob_buf b = {0}; - struct filter *filter = NULL; - char *ifname; - int metric, type; - - blobmsg_parse(filter_policy, __FILTER_MAX, tb, blob_data(msg), blob_len(msg)); - - if (!tb[FILTER_IFNAME]) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (!tb[FILTER_TYPE]) - return UBUS_STATUS_INVALID_ARGUMENT; - - type = blobmsg_get_u32(tb[FILTER_TYPE]); - - if (tb[FILTER_METRIC]) - metric = blobmsg_get_u32(tb[FILTER_METRIC]); - - filter = calloc(1, sizeof(struct filter)); - if (filter == NULL) - return UBUS_STATUS_UNKNOWN_ERROR; - - filter->af = AF_INET6; - filter->proto = 0; - filter->plen_le = 128; - filter->src_plen_le = 128; - filter->action.add_metric = metric; - - ifname = blobmsg_get_string(tb[FILTER_IFNAME]); - filter->ifname = strdup(ifname); - filter->ifindex = if_nametoindex(filter->ifname); - - add_filter(filter, type); - - return UBUS_STATUS_OK; -} - -// Adds an inteface (ubus equivalent to "interface"-function). -static int babeld_ubus_add_interface(struct ubus_context *ctx_local, - struct ubus_object *obj, - struct ubus_request_data *req, - const char *method, - struct blob_attr *msg) { - struct blob_attr *tb[__INTERFACE_MAX]; - struct blob_buf b = {0}; - struct interface *ifp = NULL; - char *ifname; - - blobmsg_parse(interface_policy, __INTERFACE_MAX, tb, blob_data(msg), - blob_len(msg)); - - if (!tb[INTERFACE_IFNAME]) - return UBUS_STATUS_INVALID_ARGUMENT; - - ifname = blobmsg_get_string(tb[INTERFACE_IFNAME]); - - ifp = add_interface(ifname, NULL); - if (ifp == NULL) - return UBUS_STATUS_UNKNOWN_ERROR; - - return UBUS_STATUS_OK; -} - -// Sends a babel info message on ubus socket. -static int babeld_ubus_babeld_info(struct ubus_context *ctx_local, - struct ubus_object *obj, - struct ubus_request_data *req, - const char *method, struct blob_attr *msg) { - struct blob_buf b = {0}; - void *prefix; - char host[64]; - int ret; - - blob_buf_init(&b, 0); - blobmsg_add_string(&b, "babeld_version", BABELD_VERSION); - blobmsg_add_string(&b, "my_id", format_eui64(myid)); - if (!gethostname(host, sizeof(host))) - blobmsg_add_string(&b, "host", host); - - ret = ubus_send_reply(ctx_local, req, b.head); - if (ret) - fprintf(stderr, "Failed to send reply: %s\n", ubus_strerror(ret)); - - blob_buf_free(&b); - - return ret; -} - -// Appends an exported route message entry to the buffer. -static void babeld_add_xroute_buf(struct xroute *xroute, struct blob_buf *b) { - void *prefix; - - prefix = blobmsg_open_table(b, NULL); - blobmsg_add_string(b, "address", - format_prefix(xroute->prefix, xroute->plen)); - blobmsg_add_string(b, "src_prefix", - format_prefix(xroute->src_prefix, xroute->src_plen)); - blobmsg_add_u32(b, "metric", xroute->metric); - blobmsg_close_table(b, prefix); -} - -// Sends an exported routes message on ubus socket, splitting apart IPv4 and -// IPv6 routes. -static int babeld_ubus_get_xroutes(struct ubus_context *ctx_local, - struct ubus_object *obj, - struct ubus_request_data *req, - const char *method, struct blob_attr *msg) { - struct blob_buf b = {0}; - struct xroute_stream *xroutes; - struct xroute_list_entry *cur, *tmp; - void *ipv4, *ipv6; - int ret; - LIST_HEAD(xroute_ipv4_list); - LIST_HEAD(xroute_ipv6_list); - - blob_buf_init(&b, 0); - - xroutes = xroute_stream(); - if (xroutes) { - while (1) { - struct xroute *xroute = xroute_stream_next(xroutes); - if (xroute == NULL) - break; - - struct xroute_list_entry *xr = - calloc(1, sizeof(struct xroute_list_entry)); - xr->xroute = xroute; - - if (v4mapped(xroute->prefix)) { - list_add(&xr->list, &xroute_ipv4_list); - } else { - list_add(&xr->list, &xroute_ipv6_list); - } - } - xroute_stream_done(xroutes); - } - - ipv4 = blobmsg_open_array(&b, "IPv4"); - list_for_each_entry_safe(cur, tmp, &xroute_ipv4_list, list) { - babeld_add_xroute_buf(cur->xroute, &b); - list_del(&cur->list); - free(cur); - } - blobmsg_close_array(&b, ipv4); - - ipv6 = blobmsg_open_array(&b, "IPv6"); - list_for_each_entry_safe(cur, tmp, &xroute_ipv6_list, list) { - babeld_add_xroute_buf(cur->xroute, &b); - list_del(&cur->list); - free(cur); - } - blobmsg_close_array(&b, ipv6); - - ret = ubus_send_reply(ctx_local, req, b.head); - if (ret) - fprintf(stderr, "Failed to send reply: %s\n", ubus_strerror(ret)); - - blob_buf_free(&b); - - return ret; -} - -// Appends an route message entry to the buffer. -static void babeld_add_route_buf(struct babel_route *route, - struct blob_buf *b) { - void *prefix; - - prefix = blobmsg_open_table( - b, NULL); - blobmsg_add_string( - b, "address", - format_prefix(route->src->prefix, route->src->plen)); - blobmsg_add_string( - b, "src_prefix", - format_prefix(route->src->src_prefix, route->src->src_plen)); - blobmsg_add_u32(b, "route_metric", route_metric(route)); - blobmsg_add_u32(b, "route_smoothed_metric", route_smoothed_metric(route)); - blobmsg_add_u32(b, "refmetric", route->refmetric); - blobmsg_add_string(b, "id", format_eui64(route->src->id)); - blobmsg_add_u32(b, "seqno", (uint32_t)route->seqno); - blobmsg_add_u32(b, "age", (int)(now.tv_sec - route->time)); - blobmsg_add_string(b, "via", format_address(route->neigh->address)); - if (memcmp(route->nexthop, route->neigh->address, 16) != 0) - blobmsg_add_string(b, "nexthop", format_address(route->nexthop)); - - blobmsg_add_u8(b, "installed", route->installed); - blobmsg_add_u8(b, "feasible", route_feasible(route)); - - blobmsg_close_table(b, prefix); -} - -// Sends received routes message on ubus socket, splitting apart IPv4 and IPv6 -// routes. -static int babeld_ubus_get_routes(struct ubus_context *ctx_local, - struct ubus_object *obj, - struct ubus_request_data *req, - const char *method, struct blob_attr *msg) { - struct blob_buf b = {0}; - struct route_stream *routes; - struct route_list_entry *cur, *tmp; - void *prefix, *ipv4, *ipv6; - int ret; - LIST_HEAD(route_ipv4_list); - LIST_HEAD(route_ipv6_list); - - blob_buf_init(&b, 0); - - routes = route_stream(0); - if (routes) { - while (1) { - struct babel_route *route = route_stream_next(routes); - if (route == NULL) - break; - struct route_list_entry *r = calloc(1, sizeof(struct route_list_entry)); - r->route = route; - - if (v4mapped(route->src->prefix)) { - list_add(&r->list, &route_ipv4_list); - } else { - list_add(&r->list, &route_ipv6_list); - } - } - route_stream_done(routes); - } - - ipv4 = blobmsg_open_array(&b, "IPv4"); - list_for_each_entry_safe(cur, tmp, &route_ipv4_list, list) { - babeld_add_route_buf(cur->route, &b); - list_del(&cur->list); - free(cur); - } - blobmsg_close_array(&b, ipv4); - - ipv6 = blobmsg_open_array(&b, "IPv6"); - list_for_each_entry_safe(cur, tmp, &route_ipv6_list, list) { - babeld_add_route_buf(cur->route, &b); - list_del(&cur->list); - free(cur); - } - blobmsg_close_array(&b, ipv6); - - ret = ubus_send_reply(ctx_local, req, b.head); - if (ret) - fprintf(stderr, "Failed to send reply: %s\n", ubus_strerror(ret)); - - blob_buf_free(&b); - - return ret; -} - -// Appends an neighbour entry to the buffer. -static void babeld_add_neighbour_buf(struct neighbour *neigh, - struct blob_buf *b) { - void *neighbour; - - neighbour = blobmsg_open_table(b, NULL); - blobmsg_add_string(b, "address", format_address(neigh->address)); - blobmsg_add_string(b, "dev", neigh->ifp->name); - blobmsg_add_u32(b, "hello_reach", neigh->hello.reach); - blobmsg_add_u32(b, "uhello_reach", neigh->uhello.reach); - blobmsg_add_u32(b, "rxcost", neighbour_rxcost(neigh)); - blobmsg_add_u32(b, "txcost", neigh->txcost); - blobmsg_add_string(b, "rtt", format_thousands(neigh->rtt)); - blobmsg_add_u8(b, "if_up", if_up(neigh->ifp)); - blobmsg_close_table(b, neighbour); -} - -// Sends neighbours message on ubus socket, splitting apart IPv4 and IPv6 -// neighbours. -static int babeld_ubus_get_neighbours(struct ubus_context *ctx_local, - struct ubus_object *obj, - struct ubus_request_data *req, - const char *method, - struct blob_attr *msg) { - struct blob_buf b = {0}; - struct neighbour *neigh; - struct neighbour_list_entry *cur, *tmp; - void *ipv4, *ipv6; - int ret; - LIST_HEAD(neighbour_ipv4_list); - LIST_HEAD(neighbour_ipv6_list); - - blob_buf_init(&b, 0); - - FOR_ALL_NEIGHBOURS(neigh) { - struct neighbour_list_entry *n = - calloc(1, sizeof(struct neighbour_list_entry)); - n->neighbour = neigh; - if (v4mapped(neigh->address)) { - list_add(&n->list, &neighbour_ipv4_list); - } else { - list_add(&n->list, &neighbour_ipv6_list); - } - } - - ipv4 = blobmsg_open_array(&b, "IPv4"); - list_for_each_entry_safe(cur, tmp, &neighbour_ipv4_list, list) { - babeld_add_neighbour_buf(cur->neighbour, &b); - list_del(&cur->list); - free(cur); - } - blobmsg_close_array(&b, ipv4); - - ipv6 = blobmsg_open_array(&b, "IPv6"); - list_for_each_entry_safe(cur, tmp, &neighbour_ipv6_list, list) { - babeld_add_neighbour_buf(cur->neighbour, &b); - list_del(&cur->list); - free(cur); - } - blobmsg_close_array(&b, ipv6); - - ret = ubus_send_reply(ctx_local, req, b.head); - if (ret) - fprintf(stderr, "Failed to send reply: %s\n", ubus_strerror(ret)); - - blob_buf_free(&b); - - return ret; -} - -// List of functions we expose via the ubus bus. -static const struct ubus_method babeld_methods[] = { - UBUS_METHOD("add_interface", babeld_ubus_add_interface, interface_policy), - UBUS_METHOD("add_filter", babeld_ubus_add_filter, filter_policy), - UBUS_METHOD_NOARG("get_info", babeld_ubus_babeld_info), - UBUS_METHOD_NOARG("get_xroutes", babeld_ubus_get_xroutes), - UBUS_METHOD_NOARG("get_routes", babeld_ubus_get_routes), - UBUS_METHOD_NOARG("get_neighbours", babeld_ubus_get_neighbours), -}; - -// Definition of the ubus object type. -static struct ubus_object_type babeld_object_type = - UBUS_OBJECT_TYPE("babeld", babeld_methods); - -// Object we announce via the ubus bus. -static struct ubus_object babeld_object = { - .name = "babeld", - .type = &babeld_object_type, - .methods = babeld_methods, - .n_methods = ARRAY_SIZE(babeld_methods), -}; - -// Registers handlers for babel methods in the global ubus context. -static bool ubus_init_object() { - int ret; - - ret = ubus_add_object(shared_ctx, &babeld_object); - if (ret) { - fprintf(stderr, "Failed to add object: %s\n", ubus_strerror(ret)); - return false; - } - - return true; -} - -// Initializes the global ubus context, connecting to the bus to be able to -// receive and send messages. -static bool babeld_ubus_init(void) { - if (shared_ctx) - return true; - - shared_ctx = ubus_connect(NULL); - if (!shared_ctx) - return false; - - return true; -} - -void ubus_notify_route(struct babel_route *route, int kind) { - struct blob_buf b = {0}; - char method[50]; // possible methods are route.change, route.add, route.flush - - if (!babeld_object.has_subscribers) - return; - - if (!route) - return; - - if (!shared_ctx) - return; - - blob_buf_init(&b, 0); - babeld_add_route_buf(route, &b); - snprintf(method, sizeof(method), "route.%s", local_kind(kind)); - ubus_notify(shared_ctx, &babeld_object, method, b.head, -1); - blob_buf_free(&b); -} - -void ubus_notify_xroute(struct xroute *xroute, int kind) { - struct blob_buf b = {0}; - char method[50]; // possible methods are xroute.change, xroute.add, - // xroute.flush - - if (!babeld_object.has_subscribers) - return; - - if (!xroute) - return; - - if (!shared_ctx) - return; - - blob_buf_init(&b, 0); - babeld_add_xroute_buf(xroute, &b); - snprintf(method, sizeof(method), "xroute.%s", local_kind(kind)); - ubus_notify(shared_ctx, &babeld_object, method, b.head, -1); - blob_buf_free(&b); -} - -void ubus_notify_neighbour(struct neighbour *neigh, int kind) { - struct blob_buf b = {0}; - char method[50]; // possible methods are neigh.change, neigh.add, neigh.flush - - if (!babeld_object.has_subscribers) - return; - - if (!neigh) - return; - - if (!shared_ctx) - return; - - blob_buf_init(&b, 0); - babeld_add_neighbour_buf(neigh, &b); - snprintf(method, sizeof(method), "neigh.%s", local_kind(kind)); - ubus_notify(shared_ctx, &babeld_object, method, b.head, -1); - blob_buf_free(&b); -} - -void babeld_ubus_receive(fd_set *readfds) { - if (!shared_ctx) - return; - if (FD_ISSET(shared_ctx->sock.fd, readfds)) - ubus_handle_event(shared_ctx); -} - -int babeld_ubus_add_read_sock(fd_set *readfds, int maxfd) { - if (!shared_ctx) - return maxfd; - - FD_SET(shared_ctx->sock.fd, readfds); - return MAX(maxfd, shared_ctx->sock.fd); -} - -bool babeld_add_ubus() { - if (!babeld_ubus_init()) { - fprintf(stderr, "Failed to initialize ubus!\n"); - return false; - } - - if (!ubus_init_object()) { - fprintf(stderr, "Failed to add objects to ubus!\n"); - return false; - } - - return true; -} diff --git a/babeld/src/ubus.h b/babeld/src/ubus.h deleted file mode 100644 index 08aeb52a6..000000000 --- a/babeld/src/ubus.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - IPC integration of babeld with OpenWrt. - - The ubus interface offers following functions: - - add_filter '{"ifname":"eth0", "type":0, "metric":5000}' - type: - 0: FILTER_TYPE_INPUT - 1: FILTER_TYPE_OUTPUT - 2: FILTER_TYPE_REDISTRIBUTE - 3: FILTER_TYPE_INSTALL - - add_interface '{"ifname":"eth0"}' - - get_info - - get_neighbours - - get_xroutes - - get_routes - - All output is divided into IPv4 and IPv6. - - Ubus notifications are sent if we receive updates for - - xroutes - - routes - - neighbours - - The format is: - - {route,xroute,neighbour}.add: Object was added - - {route,xroute,neighbour}.change: Object was changed - - {route,xroute,neighbour}.flush: Object was flushed - -*/ - -#include -#include - -struct babel_route; -struct neighbour; -struct xroute; - -// Whether to enable ubus bindings (boolean option). -extern int ubus_bindings; - -/** - * Initialize ubus interface. - * - * Connect to the ubus daemon and expose the ubus functions. - * - * @return if initializing ubus was successful - */ -bool babeld_add_ubus(); - -/** - * Add ubus socket to given filedescriptor set. - * - * We need to check repeatedly if the ubus socket has something to read. - * The functions allows to add the ubus socket to the normal while(1)-loop of - * babeld. - * - * @param readfs: the filedescriptor set - * @param maxfd: the current maximum file descriptor - * @return the maximum file descriptor - */ -int babeld_ubus_add_read_sock(fd_set *readfds, int maxfd); - -/** - * Check and process ubus socket. - * - * If the ubus-socket signals that data is available, the ubus_handle_event is - * called. - */ -void babeld_ubus_receive(fd_set *readfds); - -/*** - * Notify the ubus bus that a new xroute is received. - * - * If a new xroute is received or changed, we will notify subscribers. - * - * @param xroute: xroute that experienced some change - * @param kind: kind that describes if we have a flush, add or change - */ -void ubus_notify_xroute(struct xroute *xroute, int kind); - -/*** - * Notify the ubus bus that a new route is received. - * - * If a new route is received or changed, we will notify subscribers. - * - * @param route: route that experienced some change - * @param kind: kind that describes if we have a flush, add or change - */ -void ubus_notify_route(struct babel_route *route, int kind); - -/*** - * Notify the ubus bus that a new neighbour is received. - * - * If a new neighbour is received or changed, we will notify subscribers. - * - * @param neigh: neighbour that experienced some change - * @param kind: kind that describes if we have a flush, add or change - */ -void ubus_notify_neighbour(struct neighbour *neigh, int kind); diff --git a/batctl/Makefile b/batctl/Makefile deleted file mode 100644 index 681a3506c..000000000 --- a/batctl/Makefile +++ /dev/null @@ -1,246 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only - -include $(TOPDIR)/rules.mk - -PKG_NAME:=batctl -PKG_VERSION:=2026.2 -PKG_RELEASE:=1 - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) -PKG_HASH:=c1d580afb066d3165c239b67430b94c69932619c06a90b1295e828cb5081b122 -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) - -PKG_MAINTAINER:=Simon Wunderlich -PKG_LICENSE:=GPL-2.0-only ISC MIT -PKG_LICENSE_FILES:=LICENSES/preferred/GPL-2.0 LICENSES/preferred/MIT LICENSES/deprecated/ISC - -PKG_BUILD_PARALLEL:=1 -PKG_BUILD_FLAGS:=gc-sections lto - -include $(INCLUDE_DIR)/package.mk - -define Package/batctl/Default - SECTION:=net - CATEGORY:=Network - URL:=https://www.open-mesh.org/ - DEPENDS:=+libnl-tiny +libc +librt - PROVIDES:=batctl -endef - -define Package/batctl/description - batctl is a more intuitive managment utility for B.A.T.M.A.N.-Advanced. - It is an easier method for configuring batman-adv and provides some - additional tools for debugging as well. This package builds - version $(PKG_VERSION) of the user space utility. -endef - -define Package/batctl-tiny -$(call Package/batctl/Default) - TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Minimal) - VARIANT:=tiny - ALTERNATIVES:=100:/usr/sbin/batctl:/usr/libexec/batctl-tiny -endef - -define Package/batctl-tiny/description -$(Package/batctl/description) - Only configuration relevant subcommands are enabled. -endef - -define Package/batctl-default -$(call Package/batctl/Default) - TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Default) - VARIANT:=default - ALTERNATIVES:=200:/usr/sbin/batctl:/usr/libexec/batctl-default -endef - -define Package/batctl-default/description -$(Package/batctl/description) - Standard subcommands for configuration and online debugging are enabled. -endef - -define Package/batctl-full -$(call Package/batctl/Default) - TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Full) - VARIANT:=full - ALTERNATIVES:=300:/usr/sbin/batctl:/usr/libexec/batctl-full -endef - -define Package/batctl-full/description -$(Package/batctl/description) - Subcommands for configuration, online and offline debugging are enabled. -endef - -MAKE_VARS += \ - LIBNL_NAME="libnl-tiny" \ - LIBNL_GENL_NAME="libnl-tiny" - -MAKE_FLAGS += \ - REVISION="$(PKG_VERSION)-openwrt-$(PKG_RELEASE)" - -config-n := \ - aggregation \ - ap_isolation \ - backbonetable \ - bisect_iv \ - bonding \ - bla_backbone_json \ - bla_claim_json \ - bridge_loop_avoidance \ - claimtable \ - dat_cache \ - dat_cache_json \ - distributed_arp_table \ - elp_interval \ - event \ - fragmentation \ - gateways \ - gateways_json \ - gw_mode \ - hardif_json \ - hardifs_json \ - hop_penalty \ - interface \ - isolation_mark \ - loglevel \ - mcast_flags \ - mcast_flags_json \ - mesh_json \ - multicast_fanout \ - multicast_forceflood \ - multicast_mode \ - neighbors \ - neighbors_json \ - orig_interval \ - originators \ - originators_json \ - ping \ - routing_algo \ - statistics \ - tcpdump \ - throughput_override \ - throughputmeter \ - traceroute \ - transglobal \ - translate \ - translocal \ - transtable_global_json \ - transtable_local_json \ - vlan_json \ - -config-settings := \ - aggregation \ - ap_isolation \ - bonding \ - bridge_loop_avoidance \ - distributed_arp_table \ - elp_interval \ - fragmentation \ - gw_mode \ - hop_penalty \ - interface \ - isolation_mark \ - loglevel \ - multicast_fanout \ - multicast_forceflood \ - multicast_mode \ - orig_interval \ - routing_algo \ - throughput_override \ - -config-tables := \ - backbonetable \ - claimtable \ - dat_cache \ - gateways \ - mcast_flags \ - neighbors \ - originators \ - statistics \ - transglobal \ - translocal \ - -config-json := \ - bla_backbone_json \ - bla_claim_json \ - dat_cache_json \ - gateways_json \ - hardif_json \ - hardifs_json \ - mcast_flags_json \ - mesh_json \ - neighbors_json \ - originators_json \ - transtable_global_json \ - transtable_local_json \ - vlan_json \ - -config-tools := \ - event \ - ping \ - tcpdump \ - throughputmeter \ - traceroute \ - translate \ - -config-extratools := \ - bisect_iv \ - -ifeq ($(BUILD_VARIANT),tiny) - -config-y := \ - $(config-settings) \ - -endif - -ifeq ($(BUILD_VARIANT),default) - -config-y := \ - $(config-settings) \ - $(config-tables) \ - $(config-json) \ - $(config-tools) \ - -endif - -ifeq ($(BUILD_VARIANT),full) - -config-y := \ - $(config-settings) \ - $(config-tables) \ - $(config-json) \ - $(config-tools) \ - $(config-extratools) \ - -endif - -define ConfigVars -$(subst $(space),,$(foreach opt,$(config-$(1)),CONFIG_$(opt)=$(1) -)) -endef - -define batctl_config -$(call ConfigVars,n)$(call ConfigVars,y) -endef -$(eval $(call shexport,batctl_config)) - -MAKE_FLAGS += $$$$$(call shvar,batctl_config) - -define Package/batctl-tiny/install - $(INSTALL_DIR) $(1)/usr/libexec - $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-tiny -endef - -define Package/batctl-default/install - $(INSTALL_DIR) $(1)/usr/libexec - $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-default -endef - -define Package/batctl-full/install - $(INSTALL_DIR) $(1)/usr/libexec - $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-full -endef - -$(eval $(call BuildPackage,batctl-default)) -$(eval $(call BuildPackage,batctl-tiny)) -$(eval $(call BuildPackage,batctl-full)) diff --git a/batman-adv/Config.in b/batman-adv/Config.in deleted file mode 100644 index 9da3b8ab4..000000000 --- a/batman-adv/Config.in +++ /dev/null @@ -1,75 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# Copyright (C) 2007-2019 B.A.T.M.A.N. contributors: -# -# Marek Lindner, Simon Wunderlich - -# -# B.A.T.M.A.N meshing protocol -# - -config BATMAN_ADV_BATMAN_V - bool "B.A.T.M.A.N. V protocol" - depends on PACKAGE_kmod-batman-adv - default y - help - This option enables the B.A.T.M.A.N. V protocol, the successor - of the currently used B.A.T.M.A.N. IV protocol. The main - changes include splitting of the OGM protocol into a neighbor - discovery protocol (Echo Location Protocol, ELP) and a new OGM - Protocol OGMv2 for flooding protocol information through the - network, as well as a throughput based metric. - B.A.T.M.A.N. V is currently considered experimental and not - compatible to B.A.T.M.A.N. IV networks. - -config BATMAN_ADV_BLA - bool "Bridge Loop Avoidance" - depends on PACKAGE_kmod-batman-adv - select PACKAGE_kmod-lib-crc16 - default y - help - This option enables BLA (Bridge Loop Avoidance), a mechanism - to avoid Ethernet frames looping when mesh nodes are connected - to both the same LAN and the same mesh. If you will never use - more than one mesh node in the same LAN, you can safely remove - this feature and save some space. - -config BATMAN_ADV_DAT - bool "Distributed ARP Table" - depends on PACKAGE_kmod-batman-adv - default y - help - This option enables DAT (Distributed ARP Table), a DHT based - mechanism that increases ARP reliability on sparse wireless - mesh networks. If you think that your network does not need - this option you can safely remove it and save some space. - -config BATMAN_ADV_MCAST - bool "Multicast optimisation" - depends on PACKAGE_kmod-batman-adv - default y - help - This option enables the multicast optimisation which aims to - reduce the air overhead while improving the reliability of - multicast messages. - -config BATMAN_ADV_DEBUG - bool "B.A.T.M.A.N. debugging" - depends on PACKAGE_kmod-batman-adv - help - This is an option for use by developers; most people should - say N here. This enables compilation of support for - outputting debugging information to the debugfs log or tracing - buffer. The output is controlled via the batadv netdev specific - log_level setting. - -config BATMAN_ADV_TRACING - bool "B.A.T.M.A.N. tracing support" - depends on PACKAGE_kmod-batman-adv - select KERNEL_FTRACE - select KERNEL_ENABLE_DEFAULT_TRACERS - help - This is an option for use by developers; most people should - say N here. Select this option to gather traces like the debug - messages using the generic tracing infrastructure of the kernel. - BATMAN_ADV_DEBUG must also be selected to get trace events for - batadv_dbg. diff --git a/batman-adv/Makefile b/batman-adv/Makefile deleted file mode 100644 index 0a0168c8f..000000000 --- a/batman-adv/Makefile +++ /dev/null @@ -1,96 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only - -include $(TOPDIR)/rules.mk - -PKG_NAME:=batman-adv -PKG_VERSION:=2026.2 -PKG_RELEASE:=1 - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) -PKG_HASH:=4e17fced2c80945e22609be87534481733ff1b5d17050de4e4f323c171418135 -PKG_EXTMOD_SUBDIRS:=net/batman-adv - -PKG_MAINTAINER:=Simon Wunderlich -PKG_LICENSE:=GPL-2.0-only MIT -PKG_LICENSE_FILES:=LICENSES/preferred/GPL-2.0 LICENSES/preferred/MIT - -PKG_BUILD_PARALLEL:=1 - -STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h - -PKG_CONFIG_DEPENDS += \ - CONFIG_BATMAN_ADV_BATMAN_V \ - CONFIG_BATMAN_ADV_BLA \ - CONFIG_BATMAN_ADV_DAT \ - CONFIG_BATMAN_ADV_MCAST \ - CONFIG_BATMAN_ADV_DEBUG \ - CONFIG_BATMAN_ADV_TRACING - -include $(INCLUDE_DIR)/kernel.mk -include $(INCLUDE_DIR)/package.mk - -define KernelPackage/batman-adv - SUBMENU:=Network Support - TITLE:=B.A.T.M.A.N. Adv - URL:=https://www.open-mesh.org/ - DEPENDS:=+BATMAN_ADV_BLA:kmod-lib-crc16 +LINUX_6_12:kmod-lib-crc32c +kmod-cfg80211 +batctl - FILES:=$(PKG_BUILD_DIR)/net/batman-adv/batman-adv.$(LINUX_KMOD_SUFFIX) - AUTOLOAD:=$(call AutoProbe,batman-adv) -endef - -define KernelPackage/batman-adv/description - B.A.T.M.A.N. (better approach to mobile ad-hoc networking) is - a routing protocol for multi-hop ad-hoc mesh networks. The - networks may be wired or wireless. See - https://www.open-mesh.org/ for more information and user space - tools. This package builds version $(PKG_VERSION) of the kernel - module. -endef - -define KernelPackage/batman-adv/config - source "$(SOURCE)/Config.in" -endef - -define Package/kmod-batman-adv/conffiles -/etc/config/batman-adv -endef - -PKG_MAKE_FLAGS:= \ - CONFIG_BATMAN_ADV=m \ - CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_BATMAN_ADV_DEBUG),y,n) \ - CONFIG_BATMAN_ADV_BLA=$(if $(CONFIG_BATMAN_ADV_BLA),y,n) \ - CONFIG_BATMAN_ADV_DAT=$(if $(CONFIG_BATMAN_ADV_DAT),y,n) \ - CONFIG_BATMAN_ADV_MCAST=$(if $(CONFIG_BATMAN_ADV_MCAST),y,n) \ - CONFIG_BATMAN_ADV_BATMAN_V=$(if $(CONFIG_BATMAN_ADV_BATMAN_V),y,n) \ - CONFIG_BATMAN_ADV_TRACING=$(if $(CONFIG_BATMAN_ADV_TRACING),y,n) \ - -NOSTDINC_FLAGS := \ - $(KERNEL_NOSTDINC_FLAGS) \ - -I$(PKG_BUILD_DIR)/include/ \ - -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \ - -I$(STAGING_DIR)/usr/include/mac80211-backport \ - -I$(STAGING_DIR)/usr/include/mac80211/uapi \ - -I$(STAGING_DIR)/usr/include/mac80211 \ - -include backport/autoconf.h \ - -include backport/backport.h \ - -include $(PKG_BUILD_DIR)/compat-hacks.h \ - -DBATADV_SOURCE_VERSION=\\\"$(PKG_VERSION)-openwrt-$(PKG_RELEASE)\\\" - -NOSTDINC_FLAGS += \ - $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(PKG_MAKE_FLAGS)))) \ - $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(PKG_MAKE_FLAGS)))) \ - -define Build/Compile - +$(KERNEL_MAKE) $(PKG_JOBS) \ - $(PKG_MAKE_FLAGS) \ - M="$(PKG_BUILD_DIR)/net/batman-adv" \ - NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \ - modules -endef - -define KernelPackage/batman-adv/install - $(CP) ./files/. $(1)/ -endef - -$(eval $(call KernelPackage,batman-adv)) diff --git a/batman-adv/files/etc/uci-defaults/99-migrate-batadv_hardif b/batman-adv/files/etc/uci-defaults/99-migrate-batadv_hardif deleted file mode 100755 index c74b7f9c6..000000000 --- a/batman-adv/files/etc/uci-defaults/99-migrate-batadv_hardif +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/sh - -# This UCI-Defaults script will split the batadv proto network interfaces -# in batadv_hardif and batadv proto. The configuration options from -# /etc/config/batman-adv will be moved to the latter. - -. /lib/functions.sh - -proto_batadv_to_batadv_hardif() { - local section="$1" - local proto - local mesh - local routing_algo - - config_get proto "${section}" proto - config_get mesh "${section}" mesh - config_get routing_algo "${section}" routing_algo - - if [ -z "$mesh" -o "${proto}" != "batadv" ]; then - continue - fi - - uci set network."${section}".proto="batadv_hardif" - uci rename network."${section}".mesh="master" - uci delete network."${section}".routing_algo - - # create new section or adjust existing one - uci set network."${mesh}"=interface - uci set network."${mesh}".proto=batadv - [ -n "${routing_algo}" ] && uci set network."${mesh}".routing_algo="${routing_algo}" -} - -mv_batadv_config_section() { - local section="$1" - local aggregated_ogms - local ap_isolation - local bonding - local bridge_loop_avoidance - local distributed_arp_table - local fragmentation - local gw_bandwidth - local gw_mode - local gw_sel_class - local hop_penalty - local isolation_mark - local log_level - local multicast_mode - local orig_interval - - config_get aggregated_ogms "${section}" aggregated_ogms - config_get ap_isolation "${section}" ap_isolation - config_get bonding "${section}" bonding - config_get bridge_loop_avoidance "${section}" bridge_loop_avoidance - config_get distributed_arp_table "${section}" distributed_arp_table - config_get fragmentation "${section}" fragmentation - config_get gw_bandwidth "${section}" gw_bandwidth - config_get gw_mode "${section}" gw_mode - config_get gw_sel_class "${section}" gw_sel_class - config_get hop_penalty "${section}" hop_penalty - config_get isolation_mark "${section}" isolation_mark - config_get log_level "${section}" log_level - config_get multicast_mode "${section}" multicast_mode - config_get orig_interval "${section}" orig_interval - - # update section in case it exists - [ -n "${aggregated_ogms}" ] && uci set network."${section}".aggregated_ogms="${aggregated_ogms}" - [ -n "${ap_isolation}" ] && uci set network."${section}".ap_isolation="${ap_isolation}" - [ -n "${bonding}" ] && uci set network."${section}".bonding="${bonding}" - [ -n "${bridge_loop_avoidance}" ] && uci set network."${section}".bridge_loop_avoidance="${bridge_loop_avoidance}" - [ -n "${distributed_arp_table}" ] && uci set network."${section}".distributed_arp_table="${distributed_arp_table}" - [ -n "${fragmentation}" ] && uci set network."${section}".fragmentation="${fragmentation}" - [ -n "${gw_bandwidth}" ] && uci set network."${section}".gw_bandwidth="${gw_bandwidth}" - [ -n "${gw_mode}" ] && uci set network."${section}".gw_mode="${gw_mode}" - [ -n "${gw_sel_class}" ] && uci set network."${section}".gw_sel_class="${gw_sel_class}" - [ -n "${hop_penalty}" ] && uci set network."${section}".hop_penalty="${hop_penalty}" - [ -n "${isolation_mark}" ] && uci set network."${section}".isolation_mark="${isolation_mark}" - [ -n "${log_level}" ] && uci set network."${section}".log_level="${log_level}" - [ -n "${multicast_mode}" ] && uci set network."${section}".multicast_mode="${multicast_mode}" - [ -n "${orig_interval}" ] && uci set network."${section}".orig_interval="${orig_interval}" -} - -if [ -f /etc/config/batman-adv ]; then - config_load network - config_foreach proto_batadv_to_batadv_hardif 'interface' - uci commit network - - config_load batman-adv - config_foreach mv_batadv_config_section 'mesh' - uci commit network - - rm -f /etc/config/batman-adv -fi - -exit 0 diff --git a/batman-adv/files/lib/netifd/proto/batadv.sh b/batman-adv/files/lib/netifd/proto/batadv.sh deleted file mode 100755 index 4ef490d3d..000000000 --- a/batman-adv/files/lib/netifd/proto/batadv.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/sh - -[ -n "$INCLUDE_ONLY" ] || { - . /lib/functions.sh - . ../netifd-proto.sh - init_proto "$@" -} - -proto_batadv_init_config() { - no_device=1 - available=1 - - proto_config_add_boolean 'aggregated_ogms:bool' - proto_config_add_boolean 'ap_isolation:bool' - proto_config_add_boolean 'bonding:bool' - proto_config_add_boolean 'bridge_loop_avoidance:bool' - proto_config_add_boolean 'distributed_arp_table:bool' - proto_config_add_boolean 'fragmentation:bool' - proto_config_add_string 'gw_bandwidth' - proto_config_add_string 'gw_mode' - proto_config_add_int 'gw_sel_class' - proto_config_add_int 'hop_penalty' - proto_config_add_string 'isolation_mark' - proto_config_add_string 'log_level' - proto_config_add_int 'multicast_fanout' - proto_config_add_boolean 'multicast_mode:bool' - proto_config_add_int 'orig_interval' - proto_config_add_string 'routing_algo' -} - -proto_batadv_setup() { - local config="$1" - local iface="$config" - - local aggregated_ogms - local ap_isolation - local bonding - local bridge_loop_avoidance - local distributed_arp_table - local fragmentation - local gw_bandwidth - local gw_mode - local gw_sel_class - local hop_penalty - local isolation_mark - local log_level - local multicast_fanout - local multicast_mode - local orig_interval - local routing_algo - - json_get_vars aggregated_ogms - json_get_vars ap_isolation - json_get_vars bonding - json_get_vars bridge_loop_avoidance - json_get_vars distributed_arp_table - json_get_vars fragmentation - json_get_vars gw_bandwidth - json_get_vars gw_mode - json_get_vars gw_sel_class - json_get_vars hop_penalty - json_get_vars isolation_mark - json_get_vars log_level - json_get_vars multicast_fanout - json_get_vars multicast_mode - json_get_vars orig_interval - json_get_vars routing_algo - - set_default routing_algo 'BATMAN_IV' - - batctl routing_algo "$routing_algo" - batctl meshif "$iface" interface create - - [ -n "$aggregated_ogms" ] && batctl meshif "$iface" aggregation "$aggregated_ogms" - [ -n "$ap_isolation" ] && batctl meshif "$iface" ap_isolation "$ap_isolation" - [ -n "$bonding" ] && batctl meshif "$iface" bonding "$bonding" - [ -n "$bridge_loop_avoidance" ] && batctl meshif "$iface" bridge_loop_avoidance "$bridge_loop_avoidance" 2>&- - [ -n "$distributed_arp_table" ] && batctl meshif "$iface" distributed_arp_table "$distributed_arp_table" 2>&- - [ -n "$fragmentation" ] && batctl meshif "$iface" fragmentation "$fragmentation" - - case "$gw_mode" in - server) - if [ -n "$gw_bandwidth" ]; then - batctl meshif "$iface" gw_mode "server" "$gw_bandwidth" - else - batctl meshif "$iface" gw_mode "server" - fi - ;; - client) - if [ -n "$gw_sel_class" ]; then - batctl meshif "$iface" gw_mode "client" "$gw_sel_class" - else - batctl meshif "$iface" gw_mode "client" - fi - ;; - *) - batctl meshif "$iface" gw_mode "off" - ;; - esac - - [ -n "$hop_penalty" ] && batctl meshif "$iface" hop_penalty "$hop_penalty" - [ -n "$isolation_mark" ] && batctl meshif "$iface" isolation_mark "$isolation_mark" - [ -n "$multicast_fanout" ] && batctl meshif "$iface" multicast_fanout "$multicast_fanout" - [ -n "$multicast_mode" ] && batctl meshif "$iface" multicast_mode "$multicast_mode" 2>&- - [ -n "$log_level" ] && batctl meshif "$iface" loglevel "$log_level" 2>&- - [ -n "$orig_interval" ] && batctl meshif "$iface" orig_interval "$orig_interval" - - proto_init_update "$iface" 1 - proto_send_update "$config" -} - -proto_batadv_teardown() { - local config="$1" - local iface="$config" - - batctl meshif "$iface" interface destroy -} - -add_protocol batadv diff --git a/batman-adv/files/lib/netifd/proto/batadv_hardif.sh b/batman-adv/files/lib/netifd/proto/batadv_hardif.sh deleted file mode 100755 index b2f87dd6c..000000000 --- a/batman-adv/files/lib/netifd/proto/batadv_hardif.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh - -[ -n "$INCLUDE_ONLY" ] || { - . /lib/functions.sh - . ../netifd-proto.sh - init_proto "$@" -} - -proto_batadv_hardif_init_config() { - proto_config_add_int 'elp_interval' - proto_config_add_int 'hop_penalty' - proto_config_add_string "master" - proto_config_add_string 'throughput_override' -} - -proto_batadv_hardif_setup() { - local config="$1" - local iface="$2" - - local elp_interval - local hop_penalty - local master - local throughput_override - - json_get_vars elp_interval - json_get_vars hop_penalty - json_get_vars master - json_get_vars throughput_override - - ( proto_add_host_dependency "$config" '' "$master" ) - - batctl meshif "$master" interface -M add "$iface" - - [ -n "$elp_interval" ] && batctl hardif "$iface" elp_interval "$elp_interval" - [ -n "$hop_penalty" ] && batctl hardif "$iface" hop_penalty "$hop_penalty" - [ -n "$throughput_override" ] && batctl hardif "$iface" throughput_override "$throughput_override" - - proto_init_update "$iface" 1 - proto_send_update "$config" -} - -proto_batadv_hardif_teardown() { - local config="$1" - local iface="$2" - - local master - - json_get_vars master - - batctl meshif "$master" interface -M del "$iface" || true -} - -add_protocol batadv_hardif diff --git a/batman-adv/files/lib/netifd/proto/batadv_vlan.sh b/batman-adv/files/lib/netifd/proto/batadv_vlan.sh deleted file mode 100755 index 4a8bce743..000000000 --- a/batman-adv/files/lib/netifd/proto/batadv_vlan.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -[ -n "$INCLUDE_ONLY" ] || { - . /lib/functions.sh - . ../netifd-proto.sh - init_proto "$@" -} - -proto_batadv_vlan_init_config() { - proto_config_add_boolean 'ap_isolation:bool' -} - -proto_batadv_vlan_setup() { - local config="$1" - local iface="$2" - - # batadv_vlan options - local ap_isolation - - json_get_vars ap_isolation - - batctl vlan "$iface" ap_isolation "${ap_isolation:-0}" - proto_init_update "$iface" 1 - proto_send_update "$config" -} - -proto_batadv_vlan_teardown() { - local cfg="$1" -} - -add_protocol batadv_vlan diff --git a/batman-adv/patches/0001-fix-batadv_is_cfg80211_netdev.patch b/batman-adv/patches/0001-fix-batadv_is_cfg80211_netdev.patch deleted file mode 100644 index 7335e92d2..000000000 --- a/batman-adv/patches/0001-fix-batadv_is_cfg80211_netdev.patch +++ /dev/null @@ -1,19 +0,0 @@ -From: Alexandru Gagniuc -Date: Thu, 6 Apr 2023 18:05:50 -0500 -Subject: fix batadv_is_cfg80211_netdev - -Replace CONFIG_CFG80211 with CPTCFG_CFG80211, which is the correct -macro to use when building under backports. - ---- a/net/batman-adv/hard-interface.c -+++ b/net/batman-adv/hard-interface.c -@@ -320,8 +320,7 @@ static bool batadv_is_cfg80211_netdev(st - { - if (!net_device) - return false; -- --#if IS_ENABLED(CONFIG_CFG80211) -+#if IS_ENABLED(CPTCFG_CFG80211) - /* cfg80211 drivers have to set ieee80211_ptr */ - if (net_device->ieee80211_ptr) - return true; diff --git a/batman-adv/src/compat-hacks.h b/batman-adv/src/compat-hacks.h deleted file mode 100644 index 0cfaf6371..000000000 --- a/batman-adv/src/compat-hacks.h +++ /dev/null @@ -1,136 +0,0 @@ -/* Please avoid adding hacks here - instead add it to mac80211/backports.git */ - -#undef CONFIG_MODULE_STRIPPED - -#include /* LINUX_VERSION_CODE */ -#include - -#if LINUX_VERSION_IS_LESS(6, 15, 0) -#include -#endif /* LINUX_VERSION_IS_LESS(6, 15, 0) */ - -#if LINUX_VERSION_IS_LESS(6, 16, 0) - -#define timer_container_of(var, callback_timer, timer_fieldname) \ - from_timer(var, callback_timer, timer_fieldname) - -#endif /* LINUX_VERSION_IS_LESS(6, 16, 0) */ - -#if LINUX_VERSION_IS_LESS(6, 16, 0) || !defined(CONFIG_NET_CRC32C) - -#include -#include - -static inline u32 batadv_skb_crc32c(struct sk_buff *skb, int offset, - int len, u32 crc) -{ - unsigned int to = offset + len; - unsigned int consumed = 0; - struct skb_seq_state st; - unsigned int l; - const u8 *data; - - if (len <= 0) - return crc; - - skb_prepare_seq_read(skb, offset, to, &st); - while ((l = skb_seq_read(consumed, &data, &st)) != 0) { - crc = crc32c(crc, data, l); - consumed += l; - } - - return crc; -} - -#define skb_crc32c batadv_skb_crc32c - -#endif /* LINUX_VERSION_IS_LESS(6, 16, 0) || !defined(CONFIG_NET_CRC32C) */ - -#if LINUX_VERSION_IS_LESS(7, 0, 0) && \ - !(LINUX_VERSION_IS_GEQ(6, 18, 33) && LINUX_VERSION_IS_LESS(6, 19, 0)) - -#define kzalloc_obj(P, GFP) \ - kzalloc(sizeof(P), GFP) - -#define kmalloc_obj(P, GFP) \ - kmalloc(sizeof(P), GFP) - -#define kmalloc_objs(P, COUNT, GFP) \ - kmalloc_array((COUNT), sizeof(P), GFP) - -#endif /* < KERNEL_VERSION(7, 0, 0) */ - -/* */ - -#include -#include_next - -#include - -#ifdef DECLARE_EWMA -#undef DECLARE_EWMA -#endif /* DECLARE_EWMA */ - -/* - * Exponentially weighted moving average (EWMA) - * - * This implements a fixed-precision EWMA algorithm, with both the - * precision and fall-off coefficient determined at compile-time - * and built into the generated helper funtions. - * - * The first argument to the macro is the name that will be used - * for the struct and helper functions. - * - * The second argument, the precision, expresses how many bits are - * used for the fractional part of the fixed-precision values. - * - * The third argument, the weight reciprocal, determines how the - * new values will be weighed vs. the old state, new values will - * get weight 1/weight_rcp and old values 1-1/weight_rcp. Note - * that this parameter must be a power of two for efficiency. - */ - -#define DECLARE_EWMA(name, _precision, _weight_rcp) \ - struct ewma_##name { \ - unsigned long internal; \ - }; \ - static inline void ewma_##name##_init(struct ewma_##name *e) \ - { \ - BUILD_BUG_ON(!__builtin_constant_p(_precision)); \ - BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \ - /* \ - * Even if you want to feed it just 0/1 you should have \ - * some bits for the non-fractional part... \ - */ \ - BUILD_BUG_ON((_precision) > 30); \ - BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \ - e->internal = 0; \ - } \ - static inline unsigned long \ - ewma_##name##_read(struct ewma_##name *e) \ - { \ - BUILD_BUG_ON(!__builtin_constant_p(_precision)); \ - BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \ - BUILD_BUG_ON((_precision) > 30); \ - BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \ - return e->internal >> (_precision); \ - } \ - static inline void ewma_##name##_add(struct ewma_##name *e, \ - unsigned long val) \ - { \ - unsigned long internal = READ_ONCE(e->internal); \ - unsigned long weight_rcp = ilog2(_weight_rcp); \ - unsigned long precision = _precision; \ - \ - BUILD_BUG_ON(!__builtin_constant_p(_precision)); \ - BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \ - BUILD_BUG_ON((_precision) > 30); \ - BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \ - \ - WRITE_ONCE(e->internal, internal ? \ - (((internal << weight_rcp) - internal) + \ - (val << precision)) >> weight_rcp : \ - (val << precision)); \ - } - -/* */ diff --git a/bird2/Makefile b/bird2/Makefile deleted file mode 100644 index a67ac592d..000000000 --- a/bird2/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (C) 2009-2017 OpenWrt.org -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=bird2 -PKG_VERSION:=2.19.2 -PKG_RELEASE:=2 - -PKG_SOURCE:=bird-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://bird.nic.cz/download/ -PKG_HASH:=aff89abba3b92b7637bd57e0168b8d7ae887747f160ada4973378ad72f5f3660 - -PKG_MAINTAINER:=Toke Høiland-Jørgensen -PKG_LICENSE:=GPL-2.0-or-later -PKG_CPE_ID:=cpe:/a:nic:bird - -PKG_BUILD_DEPENDS:=ncurses readline -PKG_BUILD_DIR:=$(BUILD_DIR)/bird-$(PKG_VERSION) - -include $(INCLUDE_DIR)/package.mk - -define Package/bird2 - TITLE:=The BIRD Internet Routing Daemon (v2) - URL:=https://bird.nic.cz/ - SECTION:=net - CATEGORY:=Network - SUBMENU:=Routing and Redirection - DEPENDS:=+libpthread - CONFLICTS:=bird1-ipv4 bird1-ipv6 bird4 bird6 -endef - -define Package/bird2c - TITLE:=The BIRD command-line client (v2) - URL:=https://bird.nic.cz/ - SECTION:=net - CATEGORY:=Network - SUBMENU:=Routing and Redirection - DEPENDS:=+bird2 +libreadline +libncurses - CONFLICTS:=bird1c-ipv4 bird1c-ipv6 birdc4 birdc6 -endef - -define Package/bird2cl - TITLE:=The BIRD lightweight command-line client (v2) - URL:=https://bird.nic.cz/ - SECTION:=net - CATEGORY:=Network - SUBMENU:=Routing and Redirection - DEPENDS:=+bird2 - CONFLICTS:=bird1cl-ipv4 bird1cl-ipv6 birdcl4 birdcl6 -endef - -define Package/bird2/Default/description -BIRD is an internet routing daemon which manages TCP/IP routing tables -with support of modern routing protocols, easy to use configuration -interface and powerful route filtering language. It is lightweight and -efficient and therefore appropriate for small embedded routers. -endef - -define Package/bird2/description -$(call Package/bird2/Default/description) - -BIRD supports OSPFv2, RIPv2, Babel and BGP protocols for IPv4 and -OSPFv3, RIPng, Babel and BGP protocols for IPv6. - -In BGP, BIRD supports communities, multiprotocol extensions, MD5 -authentication, 32bit AS numbers and could act as a route server or a -route reflector. BIRD also supports multiple RIBs, multiple kernel -routing tables and redistribution between the protocols with a powerful -configuration syntax. - -This is the 2.0 branch of Bird which integrates support for IPv4 and IPv6 -into a single branch, and also adds support for the Babel routing protocol. -endef - -define Package/bird2c/description -$(call Package/bird2/Default/description) - -This is a BIRD command-line client. It is used to send commands to BIRD, -commands can perform simple actions such as enabling/disabling of -protocols, telling BIRD to show various information, telling it to show -a routing table filtered by a filter, or asking BIRD to reconfigure. - -Unless you can't afford dependency on ncurses and readline, you -should install BIRD command-line client together with BIRD. -endef - -define Package/bird2cl/description -$(call Package/bird2/Default/description) - -This is a BIRD lightweight command-line client. It is used to send commands -to BIRD, commands can perform simple actions such as enabling/disabling of -protocols, telling BIRD to show various information, telling it to show -a routing table filtered by a filter, or asking BIRD to reconfigure. -endef - -CONFIGURE_ARGS += --disable-libssh - -define Package/bird2/conffiles -/etc/bird.conf -endef - -define Package/bird2/install - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/bird $(1)/usr/sbin/ - $(INSTALL_DIR) $(1)/etc - $(INSTALL_DATA) $(PKG_BUILD_DIR)/doc/bird.conf.example $(1)/etc/bird.conf - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/bird.init $(1)/etc/init.d/bird -endef - -define Package/bird2c/install - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/birdc $(1)/usr/sbin/ -endef - -define Package/bird2cl/install - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/birdcl $(1)/usr/sbin/ -endef - -$(eval $(call BuildPackage,bird2)) -$(eval $(call BuildPackage,bird2c)) -$(eval $(call BuildPackage,bird2cl)) diff --git a/bird2/files/bird.init b/bird2/files/bird.init deleted file mode 100644 index 3ac7be183..000000000 --- a/bird2/files/bird.init +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2010-2017 OpenWrt.org - -USE_PROCD=1 -START=70 -STOP=10 - -BIRD_BIN="/usr/sbin/bird" -BIRD_CONF="/etc/bird.conf" -BIRD_PID_FILE="/var/run/bird.pid" - -start_service() { - mkdir -p /var/run - procd_open_instance - procd_set_param command $BIRD_BIN -f -c $BIRD_CONF -P $BIRD_PID_FILE - procd_set_param file "$BIRD_CONF" - procd_set_param stdout 1 - procd_set_param stderr 1 - procd_set_param respawn - procd_close_instance -} - -reload_service() { - procd_send_signal bird -} diff --git a/bird2/patches/000-ospf-bus-error.patch b/bird2/patches/000-ospf-bus-error.patch deleted file mode 100644 index e1e631fed..000000000 --- a/bird2/patches/000-ospf-bus-error.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Matt Reeve -Date: Tue, 10 Aug 2021 12:41:04 +0100 -Subject: [PATCH] Fix bus error on OSPF on IPQ806X - -On a Netgear R7800, if ospf v2 or v3 is configured in bird.conf, it fails -to start with this error: - - kernel: Alignment trap: not handling instruction f44c0a1f at [<00035848>] - kernel: Unhandled fault: alignment exception (0x801) at 0x007e0624 - -The problem is due to a struct not being properly aligned on the ARMv7 -architecture. - -This patch fixes the problem by adding the "PACKED" macro to the affected -struct. Note that upstream may later fix this in another way, in which -case this patch will not be required. - -Upstream-Status: not submitted. As of 2.19.2 the structure still carries -no alignment attribute. - -Signed-off-by: Matt Reeve ---- ---- a/proto/ospf/topology.h -+++ b/proto/ospf/topology.h -@@ -41,7 +41,7 @@ struct top_hash_entry - u8 mode; /* LSA generated during RT calculation (LSA_RTCALC or LSA_STALE)*/ - u8 nhs_reuse; /* Whether nhs nodes can be reused during merging. - See a note in rt.c:add_cand() */ --}; -+} PACKED; - - - /* Prevents ospf_hash_find() to ignore the entry, for p->lsrqh and p->lsrth */ diff --git a/bird2/patches/0001-birdc-Use-var-tmp-for-history-file.patch b/bird2/patches/0001-birdc-Use-var-tmp-for-history-file.patch deleted file mode 100644 index 1492ed025..000000000 --- a/bird2/patches/0001-birdc-Use-var-tmp-for-history-file.patch +++ /dev/null @@ -1,29 +0,0 @@ -From e77b14853c1dcb3034e1af155f49e3b943203c4e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= -Date: Mon, 24 Nov 2025 12:57:52 +0100 -Subject: [PATCH] birdc: Use /var/tmp for history file -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -We don't want birdc to write its history file to flash, so hard-code the -history file to /var/tmp instead. - -Signed-off-by: Toke Høiland-Jørgensen ---- - client/birdc.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - ---- a/client/birdc.c -+++ b/client/birdc.c -@@ -146,9 +146,7 @@ input_help(int arg, int key UNUSED) - void - history_init(void) - { -- const char *homedir = getenv("HOME"); -- if (!homedir) -- homedir = "."; -+ const char *homedir = "/var/tmp"; - history_file = malloc(strlen(homedir) + sizeof(HISTORY)); - if (!history_file) - die("couldn't alloc enough memory for history file name"); diff --git a/bird2/test-version.sh b/bird2/test-version.sh deleted file mode 100644 index 70b45c997..000000000 --- a/bird2/test-version.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# shellcheck shell=busybox - -case "$PKG_NAME" in -bird2|bird2c|bird2cl) - # birdc and birdcl do not report a version; check the daemon, - # which both clients depend on anyway - bird --version 2>&1 | grep -F "$PKG_VERSION" - ;; - -*) - echo "Untested package: $PKG_NAME" >&2 - exit 1 - ;; -esac diff --git a/bird3/Makefile b/bird3/Makefile deleted file mode 100644 index 2c0c01876..000000000 --- a/bird3/Makefile +++ /dev/null @@ -1,123 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only - -include $(TOPDIR)/rules.mk - -PKG_NAME:=bird3 -PKG_VERSION:=3.3.2 -PKG_RELEASE:=2 - -PKG_SOURCE:=bird-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://bird.nic.cz/download/ -PKG_HASH:=21297d7a02edd700ae82de5a630055a9cb88a99e2e7e45551bc7d6c1e5b4de2c - -PKG_MAINTAINER:=Toke Høiland-Jørgensen , Nick Hainke -PKG_LICENSE:=GPL-2.0-or-later -PKG_CPE_ID:=cpe:/a:nic:bird - -PKG_BUILD_DEPENDS:=ncurses readline -PKG_BUILD_DIR:=$(BUILD_DIR)/bird-$(PKG_VERSION) - -include $(INCLUDE_DIR)/package.mk - -define Package/bird3 - TITLE:=The BIRD Internet Routing Daemon (v3) - URL:=https://bird.nic.cz/ - SECTION:=net - CATEGORY:=Network - SUBMENU:=Routing and Redirection - DEPENDS:=+libpthread +libatomic - CONFLICTS:=bird2 -endef - -define Package/bird3c - TITLE:=The BIRD command-line client (v3) - URL:=https://bird.nic.cz/ - SECTION:=net - CATEGORY:=Network - SUBMENU:=Routing and Redirection - DEPENDS:=+bird3 +libreadline +libncurses - CONFLICTS:=bird2 -endef - -define Package/bird3cl - TITLE:=The BIRD lightweight command-line client (v3) - URL:=https://bird.nic.cz/ - SECTION:=net - CATEGORY:=Network - SUBMENU:=Routing and Redirection - DEPENDS:=+bird3 - CONFLICTS:=bird2 -endef - -define Package/bird3/Default/description -BIRD is an internet routing daemon which manages TCP/IP routing tables -with support of modern routing protocols, easy to use configuration -interface and powerful route filtering language. It is lightweight and -efficient and therefore appropriate for small embedded routers. -endef - -define Package/bird3/description -$(call Package/bird3/Default/description) - -BIRD supports OSPFv2, RIPv2, Babel and BGP protocols for IPv4 and -OSPFv3, RIPng, Babel and BGP protocols for IPv6. - -In BGP, BIRD supports communities, multiprotocol extensions, MD5 -authentication, 32bit AS numbers and could act as a route server or a -route reflector. BIRD also supports multiple RIBs, multiple kernel -routing tables and redistribution between the protocols with a powerful -configuration syntax. - -This is the 3.0 branch of Bird which is a multithreaded rewrite. -endef - -define Package/bird3c/description -$(call Package/bird3/Default/description) - -This is a BIRD command-line client. It is used to send commands to BIRD, -commands can perform simple actions such as enabling/disabling of -protocols, telling BIRD to show various information, telling it to show -a routing table filtered by a filter, or asking BIRD to reconfigure. - -Unless you can't afford dependency on ncurses and readline, you -should install BIRD command-line client together with BIRD. -endef - -define Package/bird3cl/description -$(call Package/bird3/Default/description) - -This is a BIRD lightweight command-line client. It is used to send commands -to BIRD, commands can perform simple actions such as enabling/disabling of -protocols, telling BIRD to show various information, telling it to show -a routing table filtered by a filter, or asking BIRD to reconfigure. -endef - -CONFIGURE_ARGS += --disable-libssh -TARGET_LDFLAGS += -latomic - -define Package/bird3/conffiles -/etc/bird.conf -endef - -define Package/bird3/install - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/bird $(1)/usr/sbin/ - $(INSTALL_DIR) $(1)/etc - $(INSTALL_DATA) $(PKG_BUILD_DIR)/doc/bird.conf.example $(1)/etc/bird.conf - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/bird.init $(1)/etc/init.d/bird -endef - -define Package/bird3c/install - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/birdc $(1)/usr/sbin/ -endef - -define Package/bird3cl/install - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/birdcl $(1)/usr/sbin/ -endef - -$(eval $(call BuildPackage,bird3)) -$(eval $(call BuildPackage,bird3c)) -$(eval $(call BuildPackage,bird3cl)) diff --git a/bird3/files/bird.init b/bird3/files/bird.init deleted file mode 100644 index 3ac7be183..000000000 --- a/bird3/files/bird.init +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2010-2017 OpenWrt.org - -USE_PROCD=1 -START=70 -STOP=10 - -BIRD_BIN="/usr/sbin/bird" -BIRD_CONF="/etc/bird.conf" -BIRD_PID_FILE="/var/run/bird.pid" - -start_service() { - mkdir -p /var/run - procd_open_instance - procd_set_param command $BIRD_BIN -f -c $BIRD_CONF -P $BIRD_PID_FILE - procd_set_param file "$BIRD_CONF" - procd_set_param stdout 1 - procd_set_param stderr 1 - procd_set_param respawn - procd_close_instance -} - -reload_service() { - procd_send_signal bird -} diff --git a/bird3/patches/0001-birdc-Use-var-tmp-for-history-file.patch b/bird3/patches/0001-birdc-Use-var-tmp-for-history-file.patch deleted file mode 100644 index 1492ed025..000000000 --- a/bird3/patches/0001-birdc-Use-var-tmp-for-history-file.patch +++ /dev/null @@ -1,29 +0,0 @@ -From e77b14853c1dcb3034e1af155f49e3b943203c4e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= -Date: Mon, 24 Nov 2025 12:57:52 +0100 -Subject: [PATCH] birdc: Use /var/tmp for history file -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -We don't want birdc to write its history file to flash, so hard-code the -history file to /var/tmp instead. - -Signed-off-by: Toke Høiland-Jørgensen ---- - client/birdc.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - ---- a/client/birdc.c -+++ b/client/birdc.c -@@ -146,9 +146,7 @@ input_help(int arg, int key UNUSED) - void - history_init(void) - { -- const char *homedir = getenv("HOME"); -- if (!homedir) -- homedir = "."; -+ const char *homedir = "/var/tmp"; - history_file = malloc(strlen(homedir) + sizeof(HISTORY)); - if (!history_file) - die("couldn't alloc enough memory for history file name"); diff --git a/bird3/test-version.sh b/bird3/test-version.sh deleted file mode 100644 index 665570760..000000000 --- a/bird3/test-version.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# shellcheck shell=busybox - -case "$PKG_NAME" in -bird3|bird3c|bird3cl) - # birdc and birdcl do not report a version; check the daemon, - # which both clients depend on anyway - bird --version 2>&1 | grep -F "$PKG_VERSION" - ;; - -*) - echo "Untested package: $PKG_NAME" >&2 - exit 1 - ;; -esac diff --git a/bmx7/Makefile b/bmx7/Makefile deleted file mode 100644 index b560d520e..000000000 --- a/bmx7/Makefile +++ /dev/null @@ -1,165 +0,0 @@ -include $(TOPDIR)/rules.mk - -PKG_NAME:=bmx7 -PKG_VERSION:=2024.06.11 -PKG_RELEASE:=2 - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz - -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/bmx-routing/bmx7.git -PKG_SOURCE_VERSION:=9020896f89006bc5d3487222eefc7ddea9e8b2bd -PKG_MIRROR_HASH:=a085904a48544d71ec815fa61c329925d89aca72a051941551290d292a6150d7 - -PKG_MAINTAINER:=Axel Neumann -PKG_LICENSE:=GPL-2.0-or-later -PKG_LICENSE_FILES:=LICENSE - -PKG_BUILD_PARALLEL:=1 - -include $(INCLUDE_DIR)/package.mk - -TARGET_CFLAGS += $(FPIC) - -MAKE_ARGS += EXTRA_CFLAGS="$(TARGET_CFLAGS) \ - -I. \ - -I$(STAGING_DIR)/usr/include \ - -DCORE_LIMIT=20000 \ - -DTRAFFIC_DUMP \ - -DNO_TRACE_FUNCTION_CALLS \ - -DBMX7_LIB_IWINFO" \ - EXTRA_LDFLAGS="$(TARGET_LDFLAGS) \ - -L$(STAGING_DIR)/usr/lib -liwinfo" \ - GIT_REV="$(PKG_REV)" \ - CC="$(TARGET_CC)" \ - INSTALL_DIR="$(PKG_INSTALL_DIR)" \ - build_all - -MAKE_PATH:=src - -define Package/bmx7/Default - SECTION:=net - CATEGORY:=Network - SUBMENU:=Routing and Redirection - TITLE:=BMX7 layer 3 routing daemon - URL:=https://github.com/bmx-routing/bmx7 - DEPENDS:=+zlib +libmbedtls +libiwinfo -endef - -define Package/bmx7/description - BMX7 routing daemon supporting securely-entrusted IPv6 (and IPv4in6) routing -endef - -define Package/bmx7 - $(call Package/bmx7/Default) - MENU:=1 -endef - -define Package/bmx7-uci-config - $(call Package/bmx7/Default) - DEPENDS:=bmx7 +libuci - TITLE:=configuration plugin based on uci (recommended!) -endef - -define Package/bmx7-iwinfo - $(call Package/bmx7/Default) - DEPENDS:=bmx7 +libiwinfo - TITLE:=link characteristics plugin via libiwinfo (recommended!) -endef - -define Package/bmx7-topology - $(call Package/bmx7/Default) - DEPENDS:=bmx7 - TITLE:=topology plugin -endef - -define Package/bmx7-json - $(call Package/bmx7/Default) - DEPENDS:=bmx7 +libjson-c - TITLE:=json plugin based on json-c -endef - -define Package/bmx7-sms - $(call Package/bmx7/Default) - DEPENDS:=bmx7 - TITLE:=sms plugin -endef - -define Package/bmx7-tun - $(call Package/bmx7/Default) - DEPENDS:=bmx7 +kmod-ip6-tunnel +kmod-iptunnel6 +kmod-tun - TITLE:=ipip-based tunnel plugin (recommended!) -endef - -define Package/bmx7-table - $(call Package/bmx7/Default) - DEPENDS:=bmx7 +bmx7-tun - TITLE:=plugin to announce routes from tables via tunnels -endef - -define Package/bmx7/install - $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d - $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/bmx7 $(1)/usr/sbin/bmx7 -endef - -define Build/Compile - $(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) $(MAKE_ARGS) -endef - -define Package/bmx7-uci-config/conffiles -/etc/config/bmx7 -/etc/bmx7 -endef - -define Package/bmx7-uci-config/install - $(INSTALL_DIR) $(1)/usr/lib $(1)/etc/config $(1)/etc/init.d - $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_uci_config/bmx7_config.so \ - $(1)/usr/lib/bmx7_config.so - $(INSTALL_BIN) ./files/etc/init.d/bmx7 $(1)/etc/init.d/bmx7 - $(INSTALL_CONF) ./files/etc/config/bmx7 $(1)/etc/config/bmx7 -endef - -define Package/bmx7-iwinfo/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_iwinfo/bmx7_iwinfo.so \ - $(1)/usr/lib/bmx7_iwinfo.so -endef - -define Package/bmx7-topology/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_topology/bmx7_topology.so \ - $(1)/usr/lib/bmx7_topology.so -endef - -define Package/bmx7-json/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_json/bmx7_json.so \ - $(1)/usr/lib/bmx7_json.so -endef - -define Package/bmx7-sms/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_sms/bmx7_sms.so \ - $(1)/usr/lib/bmx7_sms.so -endef - -define Package/bmx7-tun/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_tun/bmx7_tun.so \ - $(1)/usr/lib/bmx7_tun.so -endef - -define Package/bmx7-table/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib/bmx7_table/bmx7_table.so \ - $(1)/usr/lib/bmx7_table.so -endef - -$(eval $(call BuildPackage,bmx7)) -$(eval $(call BuildPackage,bmx7-uci-config)) -$(eval $(call BuildPackage,bmx7-iwinfo)) -$(eval $(call BuildPackage,bmx7-topology)) -$(eval $(call BuildPackage,bmx7-json)) -$(eval $(call BuildPackage,bmx7-sms)) -$(eval $(call BuildPackage,bmx7-table)) -$(eval $(call BuildPackage,bmx7-tun)) diff --git a/bmx7/files/etc/config/bmx7 b/bmx7/files/etc/config/bmx7 deleted file mode 100644 index 648c9131a..000000000 --- a/bmx7/files/etc/config/bmx7 +++ /dev/null @@ -1,47 +0,0 @@ -# for more information: -# https://github.com/bmx-routing/bmx7/ -# options execute: bmx7 --help - -config 'bmx7' 'general' -# option 'runtimeDir' '/var/run/bmx7' -# option 'trustedNodesDir' '/etc/bmx7/trustedNodes' - -#config 'plugin' -# option 'plugin' 'bmx7_config.so' - -#config 'plugin' -# option 'plugin' 'bmx7_json.so' - -#config 'plugin' -# option 'plugin' 'bmx7_sms.so' - -#config 'plugin' -# option 'plugin' 'bmx7_iwinfo.so' - -config 'dev' 'mesh_1' - option 'dev' 'br-lan' - -config 'dev' 'mesh_2' - option 'dev' 'wlan0' - -#config 'plugin' -# option 'plugin' 'bmx7_tun.so' - -#config 'plugin' -# option 'plugin' 'bmx7_table.so' - -#config 'tunDev' default -# option 'tunDev' 'default' -# option 'tun6Address' '2012:0:0:6666::1/64' -# option 'tun4Address' '10.66.66.1/24' - - -#config 'tunOut' -# option 'tunOut' 'ip6' -# option 'network' '2012::/16' -# option 'exportDistance' '0' - -#config 'tunOut' -# option 'tunOut' 'ip4' -# option 'network' '10.0.0.0/9' -# option 'minPrefixLen' '27' diff --git a/bmx7/files/etc/init.d/bmx7 b/bmx7/files/etc/init.d/bmx7 deleted file mode 100755 index 2fb3a5508..000000000 --- a/bmx7/files/etc/init.d/bmx7 +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh /etc/rc.common -START=91 -USE_PROCD=1 - -BIN=/usr/sbin/bmx7 -CONF=/etc/config/bmx7 - -start_service() { - cd /root/ || return - while pgrep -f mac80211.sh ; do sleep 1; done - - procd_open_instance "bmx7" - procd_set_param command "$BIN" - procd_append_param command -f "$CONF" -d0 - procd_set_param limits core=20000 - procd_set_param stdout 1 - procd_set_param stderr 1 - procd_set_param respawn - procd_close_instance -} - -reload_service() { - "$BIN" -c configReload -} - -service_triggers() { - procd_add_reload_trigger "bmx7" -} diff --git a/bmx7/patches/020-siocgstamp.patch b/bmx7/patches/020-siocgstamp.patch deleted file mode 100644 index ca55a38d4..000000000 --- a/bmx7/patches/020-siocgstamp.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/src/schedule.c -+++ b/src/schedule.c -@@ -376,7 +376,9 @@ loop4Event: - continue; - } - -+#ifdef SIOCGSTAMP - ioctl(pb.i.iif->rx_mcast_sock, SIOCGSTAMP, &(pb.i.tv_stamp)); -+#endif - - rx_packet(&pb); - -@@ -402,7 +404,9 @@ loop4Event: - continue; - } - -+#ifdef SIOCGSTAMP - ioctl(pb.i.iif->rx_fullbrc_sock, SIOCGSTAMP, &(pb.i.tv_stamp)); -+#endif - - rx_packet(&pb); - -@@ -452,10 +456,15 @@ loop4Event: - } - } - #endif -+#ifdef SIOCGSTAMP - if (tv_stamp == NULL) - ioctl(pb.i.iif->unicast_sock, SIOCGSTAMP, &(pb.i.tv_stamp)); - else - timercpy(&(pb.i.tv_stamp), tv_stamp); -+#else -+ if (tv_stamp) -+ timercpy(&(pb.i.tv_stamp), tv_stamp); -+#endif - - rx_packet(&pb); - diff --git a/mesh11sd/Makefile b/mesh11sd/Makefile deleted file mode 100644 index f7e3543d1..000000000 --- a/mesh11sd/Makefile +++ /dev/null @@ -1,60 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (C) 2022 - 2026 BlueWave Projects and Services -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=mesh11sd -PKG_VERSION:=6.2.1 -PKG_RELEASE:=1 - -PKG_MAINTAINER:=Rob White -PKG_LICENSE:=GPL-2.0-only -PKG_LICENSE_FILES:=LICENSE - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://codeload.github.com/opennds/mesh11sd/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=8ee36f12873a4648edc0ba5ac991a93ae79c6cd48940d9b7e999bb845cf78471 - -include $(INCLUDE_DIR)/package.mk - -define Package/mesh11sd - SUBMENU:=Mesh - SECTION:=net - CATEGORY:=Network - TITLE:=Dynamic 802.11s Mesh Management Daemon - PKGARCH:=all - URL:=https://github.com/opennds/mesh11sd -endef - -define Package/mesh11sd/description - Mesh11sd autonomously manages all aspects of an 802.11s mesh network. - It acts as a service daemon. - Mesh parameters are dynamically set across all nodes. - Point to multi-point vxlan tunneling is provided by default. - Custom vlan trunking over the vxlan tunnel is fully supported. - Cabled sections of backhaul are fully supported. - Access Point usage data is collected in a central database. - A command line interface is provided for many functions. - An optional Customer/Client Premises Equipment (CPE) mode is provided - CPE mode greatly simplifies rollout of community WISP projects. -endef - -define Package/mesh11sd/install - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mesh11sd $(1)/usr/sbin - $(INSTALL_CONF) $(PKG_BUILD_DIR)/linux_openwrt/mesh11sd/files/etc/config/mesh11sd $(1)/etc/config/ - $(INSTALL_BIN) $(PKG_BUILD_DIR)/linux_openwrt/mesh11sd/files/etc/init.d/mesh11sd $(1)/etc/init.d/ -endef - -define Package/mesh11sd/conffiles -/etc/config/mesh11sd -endef - -define Build/Compile -endef - -$(eval $(call BuildPackage,mesh11sd)) diff --git a/nodogsplash/Makefile b/nodogsplash/Makefile deleted file mode 100644 index 09a81310f..000000000 --- a/nodogsplash/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=nodogsplash -PKG_VERSION:=5.0.2 -PKG_RELEASE:=1 - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://codeload.github.com/nodogsplash/nodogsplash/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=908d3674e93726fdcefb4c3b6705c745753435df9d46425781a57e3f6b417797 - -PKG_MAINTAINER:=Moritz Warning -PKG_LICENSE:=GPL-2.0-or-later -PKG_LICENSE_FILES:=COPYING - -PKG_FIXUP:=autoreconf -PKG_BUILD_PARALLEL:=1 - -include $(INCLUDE_DIR)/package.mk - -define Package/nodogsplash - SUBMENU:=Captive Portals - SECTION:=net - CATEGORY:=Network - DEPENDS:=+libpthread +libmicrohttpd-no-ssl +iptables-nft \ - +iptables-mod-nat-extra +iptables-mod-ipopt \ - +iptables-mod-conntrack-extra - TITLE:=Open public network gateway daemon - URL:=https://github.com/nodogsplash/nodogsplash -endef - -define Package/nodogsplash/description - Nodogsplash is a Captive Portal that offers a simple way to - provide restricted access to the Internet by showing a splash - page to the user before Internet access is granted. -endef - -define Package/nodogsplash/install - $(INSTALL_DIR) $(1)/usr/lib/nodogsplash - $(INSTALL_BIN) ./files/usr/lib/nodogsplash/restart.sh $(1)/usr/lib/nodogsplash/ - $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/nodogsplash $(1)/usr/bin/ - $(INSTALL_BIN) $(PKG_BUILD_DIR)/ndsctl $(1)/usr/bin/ - $(INSTALL_DIR) $(1)/etc/nodogsplash/htdocs/ - $(INSTALL_DATA) $(PKG_BUILD_DIR)/resources/splash.html $(1)/etc/nodogsplash/htdocs/ - $(INSTALL_DATA) $(PKG_BUILD_DIR)/resources/splash.css $(1)/etc/nodogsplash/htdocs/ - $(INSTALL_DATA) $(PKG_BUILD_DIR)/resources/status.html $(1)/etc/nodogsplash/htdocs/ - $(INSTALL_DIR) $(1)/etc/nodogsplash/htdocs/images - $(INSTALL_DATA) $(PKG_BUILD_DIR)/resources/splash.jpg $(1)/etc/nodogsplash/htdocs/images/ - $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_CONF) ./files/etc/config/nodogsplash $(1)/etc/config/ - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/etc/init.d/nodogsplash $(1)/etc/init.d/ - $(INSTALL_DIR) $(1)/etc/uci-defaults - $(INSTALL_BIN) ./files/etc/uci-defaults/40_nodogsplash $(1)/etc/uci-defaults/ -endef - -define Package/nodogsplash/postrm -#!/bin/sh -uci delete firewall.nodogsplash -uci commit firewall -endef - -define Package/nodogsplash/conffiles -/etc/config/nodogsplash -endef - -$(eval $(call BuildPackage,nodogsplash)) diff --git a/nodogsplash/files/etc/config/nodogsplash b/nodogsplash/files/etc/config/nodogsplash deleted file mode 100644 index c7372b782..000000000 --- a/nodogsplash/files/etc/config/nodogsplash +++ /dev/null @@ -1,152 +0,0 @@ - -# The options available here are an adaptation of the settings used in nodogsplash.conf. -# See https://github.com/nodogsplash/nodogsplash/blob/master/resources/nodogsplash.conf - -config nodogsplash - # Set to 0 to disable nodogsplash - option enabled 1 - - # Set to 0 to disable hook that makes nodogsplash restart when the firewall restarts. - # This hook is needed as a restart of Firewall overwrites nodogsplash iptables entries. - option fwhook_enabled '1' - - # WebRoot - # Default: /etc/nodogsplash/htdocs - # - # The local path where the splash page content resides. - # ie. Serve the file splash.html from this directory - #option webroot '/etc/nodogsplash/htdocs' - - # Use plain configuration file - #option config '/etc/nodogsplash/nodogsplash.conf' - - # Use this option to set the device nodogsplash will bind to. - # The value may be an interface section in /etc/config/network or a device name such as br-lan. - option gatewayinterface 'br-lan' - - # GatewayPort - # Default: 2050 - # - # Nodogsplash's own http server uses gateway address as its IP address. - # The port it listens to at that IP can be set here; default is 2050. - # - #option gatewayport '2050' - - - option gatewayname 'OpenWrt Nodogsplash' - option maxclients '250' - - # Enables debug output (0-3) - #option debuglevel '1' - - # Client timeouts in minutes - option preauthidletimeout '30' - option authidletimeout '120' - # Session Timeout is the interval after which clients are forced out (a value of 0 means never) - option sessiontimeout '1200' - - # The interval in seconds at which nodogsplash checks client timeout status - option checkinterval '600' - - # Enable BinAuth Support. - # If set, a program is called with several parameters on authentication (request) and deauthentication. - # Request for authentication: - # $ auth_client '' '' - # - # The username and password values may be empty strings and are URL encoded. - # The program is expected to output the number of seconds the client - # is to be authenticated. Zero or negative seconds will cause the authentification request - # to be rejected. The same goes for an exit code that is not 0. - # The output may contain a user specific download and upload limit in KBit/s: - # - # - # Called on authentication or deauthentication: - # $ <*auth|*deauth> - # - # "client_auth": Client authenticated via this script. - # "client_deauth": Client deauthenticated by the client via splash page. - # "idle_deauth": Client was deauthenticated because of inactivity. - # "timeout_deauth": Client was deauthenticated because the session timed out. - # "ndsctl_auth": Client was authenticated manually by the ndsctl tool. - # "ndsctl_deauth": Client was deauthenticated by the ndsctl tool. - # "shutdown_deauth": Client was deauthenticated by Nodogsplash terminating. - # - # Values session_start and session_start are in seconds since 1970 or 0 for unknown/unlimited. - # - #option binauth '/bin/myauth.sh' - # Enable PreAuth Support. - # - # A simple login script is provided in the package. - # This generates a login page asking for usename and email address. - # User logins are recorded in the log file /tmp/ndslog.log - # Details of how the script works are contained in comments in the script itself. - # - # The Preauth program will output html code that will be served to the client by NDS - # Using html GET the Preauth program may call: - # /nodogsplash_preauth/ to ask the client for more information - # or - # /nodogsplash_auth/ to authenticate the client - # - # The Preauth program should append at least the client ip to the query string - # (using html input type hidden) for all calls to /nodogsplash_preauth/ - # It must also obtain the client token using ndsctl (or the original query string if fas_secure_enabled=0) - # for NDS authentication when calling /nodogsplash_auth/ - # - #option preauth '/usr/lib/nodogsplash/login.sh' - - # Your router may have several interfaces, and you - # probably want to keep them private from the gatewayinterface. - # If so, you should block the entire subnets on those interfaces, e.g.: - #list authenticated_users 'block to 192.168.0.0/16' - #list authenticated_users 'block to 10.0.0.0/8' - - # Typical ports you will probably want to open up. - #list authenticated_users 'allow tcp port 22' - #list authenticated_users 'allow tcp port 53' - #list authenticated_users 'allow udp port 53' - #list authenticated_users 'allow tcp port 80' - #list authenticated_users 'allow tcp port 443' - # Or for happy customers allow all - list authenticated_users 'allow all' - - # For preauthenticated users to resolve IP addresses in their - # initial request not using the router itself as a DNS server, - # Leave commented to help prevent DNS tunnelling - #list preauthenticated_users 'allow tcp port 53' - #list preauthenticated_users 'allow udp port 53' - - # Allow ports for SSH/Telnet/DNS/DHCP/HTTP/HTTPS - list users_to_router 'allow tcp port 22' - list users_to_router 'allow tcp port 23' - list users_to_router 'allow tcp port 53' - list users_to_router 'allow udp port 53' - list users_to_router 'allow udp port 67' - list users_to_router 'allow tcp port 80' - - # MAC addresses that are / are not allowed to access the splash page - # Value is either 'allow' or 'block'. The allowedmac or blockedmac list is used. - #option macmechanism 'allow' - #list allowedmac '00:00:C0:01:D0:0D' - #list allowedmac '00:00:C0:01:D0:1D' - #list blockedmac '00:00:C0:01:D0:2D' - - # MAC addresses that do not need to authenticate - #list trustedmac '00:00:C0:01:D0:1D' - - # Nodogsplash uses specific HEXADECIMAL values to mark packets used by iptables as a bitwise mask. - # This mask can conflict with the requirements of other packages such as mwan3, sqm etc - # Any values set here are interpreted as in hex format. - # - # List: fw_mark_authenticated - # Default: 30000 (0011|0000|0000|0000|0000 binary) - # - # List: fw_mark_trusted - # Default: 20000 (0010|0000|0000|0000|0000 binary) - # - # List: fw_mark_blocked - # Default: 10000 (0001|0000|0000|0000|0000 binary) - # - #option fw_mark_authenticated '30000' - #option fw_mark_trusted '20000' - #option fw_mark_blocked '10000' - diff --git a/nodogsplash/files/etc/init.d/nodogsplash b/nodogsplash/files/etc/init.d/nodogsplash deleted file mode 100755 index 4af51ca24..000000000 --- a/nodogsplash/files/etc/init.d/nodogsplash +++ /dev/null @@ -1,215 +0,0 @@ -#!/bin/sh /etc/rc.common - -# -# Startup/shutdown script for nodogsplash captive portal -# - -START=95 -STOP=95 - -USE_PROCD=1 - -IPT=/usr/sbin/iptables -WD_DIR=/usr/bin - -# Run in PROCD (-f) and log to SYSLOG (-s) -OPTIONS="-f -s" -# - -CONFIG="" - - -addline() { - append CONFIG "$1" "$N" -} - -setup_mac_lists() { - local cfg="$1" - local macs="" - local val - - append_mac() { - append macs "$1" "," - } - - config_get val "$cfg" macmechanism - if [ -z "$val" ]; then - # Check if we have AllowedMACList or BlockedMACList defined they will be ignored - config_get val "$cfg" allowedmac - if [ -n "$val" ]; then - echo "Ignoring allowedmac - macmechanism not \"allow\"" >&2 - fi - - config_get val "$cfg" blockedmac - if [ -n "$val" ]; then - echo "Ignoring blockedmac - macmechanism not \"block\"" >&2 - fi - elif [ "$val" = "allow" ]; then - config_list_foreach "$cfg" allowedmac append_mac - addline "MACmechanism allow" - addline "AllowedMACList $macs" - elif [ "$val" = "block" ]; then - config_list_foreach "$cfg" blockedmac append_mac - addline "MACmechanism block" - addline "BlockedMACList $macs" - else - echo "Invalid macmechanism '$val' - allow or block are valid." >&2 - return 1 - fi - - macs="" - config_list_foreach "$cfg" trustedmac append_mac - if [ -n "$macs" ]; then - addline "TrustedMACList $macs" - fi - - return 0 -} - -setup_firewall() { - local cfg="$1" - local uci_name - local val - - append_firewall() { - addline " FirewallRule $1" - } - - for rule in authenticated-users preauthenticated-users users-to-router trusted-users trusted-users-to-router; do - # uci does not allow dashes - uci_name=${rule//-/_} - addline "FirewallRuleSet $rule {" - config_list_foreach "$cfg" "$uci_name" append_firewall - addline "}" - config_get val "$cfg" "policy_${uci_name}" - if [ -n "$val" ]; then - addline "EmptyRuleSetPolicy $rule $val" - fi - done -} - -wait_for_interface() { - local ifname="$1" - local timeout=10 - - for i in $(seq $timeout); do - if [ $(ip -4 addr show dev $ifname 2> /dev/null | grep -c inet) -ne 0 ]; then - break - fi - sleep 1 - if [ $i = $timeout ]; then - echo "Interface $ifname not detected." >&2 - return 1 - fi - done - - return 0 -} - -generate_uci_config() { - local cfg="$1" - local val - local ifname - local download - local upload - - # Init config file content - CONFIG="# auto-generated config file from /etc/config/nodogsplash" - - config_get val "$cfg" config - if [ -n "$val" ]; then - if [ ! -f "$val" ]; then - echo "Configuration file '$file' doesn't exist." >&2 - return 1 - fi - addline "$(cat $val)" - fi - - config_get ifname "$cfg" gatewayinterface - - # Get device name if interface name is a section name in /etc/config/network - if network_get_device tmp "$ifname"; then - ifname="$tmp" - fi - - if [ -z "$ifname" ]; then - echo "Option network or gatewayinterface missing." >&2 - return 1 - fi - - wait_for_interface "$ifname" || return 1 - - addline "GatewayInterface $ifname" - - for option in preauth binauth \ - daemon debuglevel maxclients gatewayname gatewayinterface gatewayiprange \ - gatewayaddress gatewayport webroot splashpage statuspage \ - redirecturl sessiontimeout preauthidletimeout authidletimeout checkinterval \ - setmss mssvalue trafficcontrol downloadlimit uploadlimit \ - syslogfacility ndsctlsocket fw_mark_authenticated \ - fw_mark_blocked fw_mark_trusted - do - config_get val "$cfg" "$option" - - if [ -n "$val" ]; then - addline "$option $val" - fi - done - for option in fasport fasremoteip faspath fas_secure_enabled ; do - config_get val "$cfg" "$option" - if [ -n "$val" ]; then - echo "Warning: nodogsplash does not support $val" - return 1 - fi - done - config_get download "$cfg" downloadlimit - config_get upload "$cfg" uploadlimit - - if [ -n "$upload" -o -n "$download" ]; then - addline "TrafficControl yes" - fi - - setup_mac_lists "$cfg" || return 1 - setup_firewall "$cfg" - - echo "$CONFIG" > "/tmp/etc/nodogsplash_$cfg.conf" - return 0 -} - -# setup configuration and start instance -create_instance() { - local cfg="$1" - local val - - config_get_bool val "$cfg" enabled 0 - [ $val -gt 0 ] || return 0 - - if ! generate_uci_config "$cfg"; then - echo "Can not generate uci config. Will not start instance $cfg." >&2 - return 1 - fi - - procd_open_instance $cfg - procd_set_param command /usr/bin/nodogsplash -c "/tmp/etc/nodogsplash_$cfg.conf" $OPTIONS - procd_set_param respawn - procd_set_param file "/tmp/etc/nodogsplash_$cfg.conf" - procd_close_instance -} - -start_service() { - # For network_get_device() - include /lib/functions - - # For nodogsplash.conf file - mkdir -p /tmp/etc/ - - config_load nodogsplash - config_foreach create_instance nodogsplash -} - -stop_service() { - # When procd terminates nodogsplash, it does not exit fast enough. - # Otherwise procd will restart nodogsplash twice. First time starting - # nodogsplash fails, second time it succeeds. - sleep 1 -} diff --git a/nodogsplash/files/etc/uci-defaults/40_nodogsplash b/nodogsplash/files/etc/uci-defaults/40_nodogsplash deleted file mode 100644 index c4f461ac4..000000000 --- a/nodogsplash/files/etc/uci-defaults/40_nodogsplash +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -uci -q batch <<-EOF - delete firewall.nodogsplash - set firewall.nodogsplash=include - set firewall.nodogsplash.type=script - set firewall.nodogsplash.path=/usr/lib/nodogsplash/restart.sh - commit firewall -EOF diff --git a/nodogsplash/files/usr/lib/nodogsplash/restart.sh b/nodogsplash/files/usr/lib/nodogsplash/restart.sh deleted file mode 100755 index e67f11d12..000000000 --- a/nodogsplash/files/usr/lib/nodogsplash/restart.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# Check if nodogsplash is running -if ndsctl status &> /dev/null; then - if [ "$(uci -q get nodogsplash.@nodogsplash[0].fwhook_enabled)" = "1" ]; then - /etc/init.d/nodogsplash restart - fi -fi diff --git a/olsrd/Makefile b/olsrd/Makefile deleted file mode 100644 index 09a1abd0c..000000000 --- a/olsrd/Makefile +++ /dev/null @@ -1,332 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later -# -# Copyright (C) 2009-2016 OpenWrt.org -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=olsrd -PKG_SOURCE_DATE:=2024-06-09 -PKG_RELEASE:=2 - -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/OLSR/olsrd.git -PKG_SOURCE_VERSION:=d72be9ad60f65dda28a0543b4ffff8cd9a5da2d7 -PKG_MIRROR_HASH:=e05d2724e6c76233148ce460b9611bafccff2114904542fa3b5caf75dc1c4e04 - -PKG_MAINTAINER:=Nick Hainke -PKG_BUILD_PARALLEL:=0 -PKG_LICENSE:=BSD-3-Clause - -include $(INCLUDE_DIR)/package.mk - -TARGET_CFLAGS += $(FPIC) - -define Package/olsrd/template - SECTION:=net - CATEGORY:=Network - SUBMENU:=Routing and Redirection - MAINTAINER:=Saverio Proto - TITLE:=OLSR (Optimized Link State Routing) daemon - URL:=http://www.olsr.org/ -endef - -define Package/olsrd - $(call Package/olsrd/template) - MENU:=1 - DEPENDS:=+libpthread +libubus +iptables +IPV6:ip6tables -endef - -define Package/olsrd/conffiles -/etc/config/olsrd -/etc/config/olsrd6 -endef - -define Package/olsrd-mod-arprefresh - $(call Package/olsrd/template) - DEPENDS:=olsrd - TITLE:=Kernel ARP cache refresh plugin -endef - -define Package/olsrd-mod-dot-draw - $(call Package/olsrd/template) - DEPENDS:=olsrd - TITLE:=Dot topology information plugin -endef - - -define Package/olsrd-mod-filtergw - $(call Package/olsrd/template) - DEPENDS:=olsrd - TITLE:=Filter Gateway plugin -endef - -define Package/olsrd-mod-bmf - $(call Package/olsrd/template) - DEPENDS:=olsrd +kmod-tun - TITLE:=Basic multicast forwarding plugin -endef - -define Package/olsrd-mod-dyn-gw - $(call Package/olsrd/template) - DEPENDS:=olsrd - TITLE:=Dynamic internet gateway plugin -endef - -define Package/olsrd-mod-dyn-gw-plain - $(call Package/olsrd/template) - DEPENDS:=olsrd - TITLE:=Dynamic internet gateway plain plugin -endef - -define Package/olsrd-mod-httpinfo - $(call Package/olsrd/template) - DEPENDS:=olsrd - TITLE:=Small informative web server plugin -endef - -define Package/olsrd-mod-jsoninfo - $(call Package/olsrd/template) - DEPENDS:=olsrd - TITLE:=Small informative plugin with JSON output -endef - -define Package/olsrd-mod-netjson - $(call Package/olsrd/template) - DEPENDS:=olsrd - TITLE:=netjson plugin with JSON output -endef - -define Package/olsrd-mod-mdns - $(call Package/olsrd/template) - DEPENDS:=olsrd - TITLE:=MDNS/Zeroconf/Bonjour packet distribution -endef - -define Package/olsrd-mod-nameservice - $(call Package/olsrd/template) - DEPENDS:=olsrd - TITLE:=Lightweight hostname resolver plugin -endef - -define Package/olsrd-mod-p2pd - $(call Package/olsrd/template) - DEPENDS:=olsrd - TITLE:=Peer to Peer Discovery plugin -endef - -define Package/olsrd-mod-pgraph - $(call Package/olsrd/template) - DEPENDS:=olsrd - TITLE:=output network topology for pgraph -endef - -define Package/olsrd-mod-pud - $(call Package/olsrd/template) - DEPENDS:=olsrd +libgps - TITLE:=Position Update Distribution plugin -endef - -define Package/olsrd-mod-quagga - $(call Package/olsrd/template) - DEPENDS:=olsrd - TITLE:=Quagga plugin -endef - -define Package/olsrd-mod-secure - $(call Package/olsrd/template) - DEPENDS:=olsrd - TITLE:=Message signing plugin to secure routing domain -endef - -define Package/olsrd-mod-sgwdynspeed - $(call Package/olsrd/template) - DEPENDS:=olsrd - TITLE:=Smart Gateway dynamic speed plugin -endef - -define Package/olsrd-mod-txtinfo - $(call Package/olsrd/template) - DEPENDS:=olsrd - TITLE:=Small informative web server plugin -endef - -define Package/olsrd-mod-watchdog - $(call Package/olsrd/template) - DEPENDS:=olsrd - TITLE:=Watchdog plugin -endef - -define Package/olsrd-utils - $(call Package/olsrd/template) - DEPENDS:=olsrd - TITLE:=Utils for OLSRD -endef - -define Package/olsrd-mod-pud/conffiles -/etc/olsrd.d/olsrd.pud.position.conf -endef - -define Package/olsrd-mod-secure/conffiles -/etc/olsrd.d/olsrd_secure_key -endef - -define Package/olsrd-mod-sgwdynspeed/conffiles -/etc/olsrd.d/olsrd.sgw.speed.conf -endef - -MAKE_FLAGS+= \ - NO_DEBUG_MESSAGES=1 \ - OS="linux" \ - DESTDIR="$(PKG_INSTALL_DIR)" \ - STRIP="true" \ - INSTALL_LIB="true" \ - SUBDIRS="arprefresh bmf dot_draw dyn_gw dyn_gw_plain httpinfo filtergw jsoninfo netjson mdns nameservice p2pd pgraph pud quagga secure sgwdynspeed txtinfo watchdog" - -define Build/Compile - $(call Build/Compile/Default,all) - $(call Build/Compile/Default,libs) -endef - -define Package/olsrd/install - $(INSTALL_DIR) $(1)/lib/functions - $(INSTALL_DATA) ./files/olsrd.sh $(1)/lib/functions/olsrd.sh - $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_CONF) ./files/olsrd.config $(1)/etc/config/olsrd - $(INSTALL_CONF) ./files/olsrd6.config $(1)/etc/config/olsrd6 - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/olsrd $(1)/usr/sbin/ - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/olsrd4.init $(1)/etc/init.d/olsrd - $(INSTALL_BIN) ./files/olsrd6.init $(1)/etc/init.d/olsrd6 -endef - -define Package/olsrd-mod-arprefresh/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/arprefresh/olsrd_arprefresh.so.* $(1)/usr/lib/ -endef - -define Package/olsrd-mod-filtergw/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/filtergw/olsrd_filtergw.so.* $(1)/usr/lib/ -endef - -define Package/olsrd-mod-dot-draw/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/dot_draw/olsrd_dot_draw.so.* $(1)/usr/lib/ -endef - -define Package/olsrd-mod-bmf/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmf/olsrd_bmf.so.* $(1)/usr/lib/ -endef - -define Package/olsrd-mod-dyn-gw/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/dyn_gw/olsrd_dyn_gw.so.* $(1)/usr/lib/ -endef - -define Package/olsrd-mod-dyn-gw-plain/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/dyn_gw_plain/olsrd_dyn_gw_plain.so.* $(1)/usr/lib/ -endef - -define Package/olsrd-mod-httpinfo/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/httpinfo/olsrd_httpinfo.so.* $(1)/usr/lib/ -endef - -define Package/olsrd-mod-jsoninfo/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/jsoninfo/olsrd_jsoninfo.so.* $(1)/usr/lib/ -endef - -define Package/olsrd-mod-netjson/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/netjson/olsrd_netjson.so.* $(1)/usr/lib/ -endef - -define Package/olsrd-mod-mdns/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/mdns/olsrd_mdns.so.* $(1)/usr/lib/ -endef - -define Package/olsrd-mod-nameservice/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/nameservice/olsrd_nameservice.so.* $(1)/usr/lib/ -endef - -define Package/olsrd-mod-p2pd/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/p2pd/olsrd_p2pd.so.* $(1)/usr/lib/ -endef - -define Package/olsrd-mod-pgraph/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/pgraph/olsrd_pgraph.so.* $(1)/usr/lib/ -endef - -define Package/olsrd-mod-pud/install - $(INSTALL_DIR) $(1)/etc/olsrd.d - $(CP) ./files/olsrd.pud.position.conf $(1)/etc/olsrd.d/ - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/pud/nmealib/lib/libnmea.so $(1)/usr/lib/ - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/pud/wireformat/lib/libOlsrdPudWireFormat.so $(1)/usr/lib/ - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/pud/olsrd_pud.so.* $(1)/usr/lib/ -endef - -define Package/olsrd-mod-quagga/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/quagga/olsrd_quagga.so.* $(1)/usr/lib/ -endef - -define Package/olsrd-mod-secure/install - $(INSTALL_DIR) $(1)/etc/olsrd.d - $(CP) ./files/olsrd_secure_key $(1)/etc/olsrd.d/ - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/secure/olsrd_secure.so.* $(1)/usr/lib/ -endef - -define Package/olsrd-mod-sgwdynspeed/install - $(INSTALL_DIR) $(1)/etc/olsrd.d - $(CP) ./files/olsrd.sgw.speed.conf $(1)/etc/olsrd.d/ - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/sgwdynspeed/olsrd_sgwdynspeed.so.* $(1)/usr/lib/ -endef - -define Package/olsrd-mod-txtinfo/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/txtinfo/olsrd_txtinfo.so.* $(1)/usr/lib/ -endef - -define Package/olsrd-mod-watchdog/install - $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/watchdog/olsrd_watchdog.so.* $(1)/usr/lib/ -endef - -define Package/olsrd-utils/install - $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) ./files/olsrd-neigh.sh $(1)/usr/bin/olsrd-neigh -endef - -$(eval $(call BuildPackage,olsrd)) -$(eval $(call BuildPackage,olsrd-mod-arprefresh)) -$(eval $(call BuildPackage,olsrd-mod-dot-draw)) -$(eval $(call BuildPackage,olsrd-mod-filtergw)) -$(eval $(call BuildPackage,olsrd-mod-bmf)) -$(eval $(call BuildPackage,olsrd-mod-dyn-gw)) -$(eval $(call BuildPackage,olsrd-mod-dyn-gw-plain)) -$(eval $(call BuildPackage,olsrd-mod-httpinfo)) -$(eval $(call BuildPackage,olsrd-mod-jsoninfo)) -$(eval $(call BuildPackage,olsrd-mod-netjson)) -$(eval $(call BuildPackage,olsrd-mod-mdns)) -$(eval $(call BuildPackage,olsrd-mod-nameservice)) -$(eval $(call BuildPackage,olsrd-mod-p2pd)) -$(eval $(call BuildPackage,olsrd-mod-pgraph)) -$(eval $(call BuildPackage,olsrd-mod-pud)) -$(eval $(call BuildPackage,olsrd-mod-quagga)) -$(eval $(call BuildPackage,olsrd-mod-secure)) -$(eval $(call BuildPackage,olsrd-mod-sgwdynspeed)) -$(eval $(call BuildPackage,olsrd-mod-txtinfo)) -$(eval $(call BuildPackage,olsrd-mod-watchdog)) -$(eval $(call BuildPackage,olsrd-utils)) diff --git a/olsrd/files/olsrd-neigh.sh b/olsrd/files/olsrd-neigh.sh deleted file mode 100755 index 65a32a6b4..000000000 --- a/olsrd/files/olsrd-neigh.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/sh - -. /usr/share/libubox/jshn.sh - -hostsfile_getname() -{ - local config="$1" - local i=0 - local value file - - while value="$( uci -q get $config.@LoadPlugin[$i].library )"; do { - case "$value" in - 'olsrd_nameservice'*) - file="$( uci -q get $config.@LoadPlugin[$i].hosts_file )" - break - ;; - esac - - i=$(( i + 1 )) - } done - - echo "${file:-/var/run/hosts_olsr}" -} - -read_hostnames() -{ - local file_list=" $( hostsfile_getname 'olsrd' ) $(hostsfile_getname 'olsrd6' ) " - local line ip hostname file file_list_uniq - - for file in $file_list; do { - case " $file_list_uniq " in - *" $file "*) - ;; - *) - file_list_uniq="$file_list_uniq $file" - ;; - esac - } done - - for file in $file_list_uniq; do { - [ -e "$file" ] || continue - - while read -r line; do { - case "$line" in - [0-9]*) - # 2001:ffff:ffff:ffff::1 SomeNode-core.olsr # myself - # 10.0.0.1 SomeNode # 10.0.0.1 - set -f - set +f -- $line - ip="$1" - hostname="$2" - - # global vars, e.g. - # IP_1_2_3_4='foo' or IP_2001_ffff_ffff_ffff__1='bar' - eval IP_${ip//[.:]/_}="$hostname" - ;; - esac - } done <"$file" - } done -} - -read_hostnames - -VARS='localIP:Local remoteIP:Remote validityTime:vTime linkQuality:LQ' -VARS="$VARS neighborLinkQuality:NLQ linkCost:Cost remoteHostname:Host" - -for HOST in '127.0.0.1' '::1';do - # check for availability of HOST - nc $HOST 9090 >/dev/null 2>&1 - if [ $? != 0 ]; then - continue - fi - - json_init - json_load "$( echo /links | nc $HOST 9090 | sed -n '/^[}{ ]/p' )" # remove header/non-json - - if json_is_a links array;then - json_select links - for v in ${VARS};do - eval _${v%:*}=0 - done - for j in 0 1;do - case ${j} in 1) - for v in ${VARS};do - eval printf \"%-\${_${v%:*}}s \" ${v#*:} - done - echo - ;;esac - i=1;while json_is_a ${i} object;do - json_select ${i} - json_get_vars $(for v in ${VARS};do echo ${v%:*};done) - case ${j} in 0) - for v in ${VARS};do - eval "test \${_${v%:*}} -lt \${#${v%:*}} && _${v%:*}=\${#${v%:*}}" - done - ;;*) - for v in ${VARS};do - eval printf \"%-\${_${v%:*}}s \" \$${v%:*} - eval remoteHostname="\$IP_${remoteIP//[.:]/_}" - done - echo - ;;esac - json_select .. - i=$(( i + 1 )) - done - done - fi - echo -done diff --git a/olsrd/files/olsrd.config b/olsrd/files/olsrd.config deleted file mode 100644 index 68024ed3b..000000000 --- a/olsrd/files/olsrd.config +++ /dev/null @@ -1,29 +0,0 @@ -config olsrd - # uncomment the following line to use a custom config file instead: - #option config_file '/etc/olsrd.conf' - -config LoadPlugin - option library 'olsrd_arprefresh.so.0.1' - -config LoadPlugin - option library 'olsrd_dyn_gw.so.0.5' - -config LoadPlugin - option library 'olsrd_httpinfo.so.0.1' - option port '1978' - list Net '0.0.0.0 0.0.0.0' - -config LoadPlugin - option library 'olsrd_nameservice.so.0.4' - -config LoadPlugin - option library 'olsrd_txtinfo.so.1.1' - option accept '0.0.0.0' - -config Interface - list interface 'wlan' - -config procd procd - option respawn_threshold '3600' - option respawn_timeout '15' - option respawn_retry '0' diff --git a/olsrd/files/olsrd.pud.position.conf b/olsrd/files/olsrd.pud.position.conf deleted file mode 100644 index 0ab0fb749..000000000 --- a/olsrd/files/olsrd.pud.position.conf +++ /dev/null @@ -1,51 +0,0 @@ -# -# OLSrd PUD plugin position configuration file -# - -# GPS operating mode. -# Values : bad, 2d, 3d -# Default: bad -# Note : a value of 'bad' will make the resulting position information invalid -# (the mask will indicate that all other information is not present) -#fix = bad - -# GPS quality indicator. -# Values : bad, low, mid, high -# Default: high -#sig = high - -# HDOP (Horizontal Dilution Of Precision) -# Values : floating point value -# Default: 0.0 -# Note : From HDOP, VDOP and PDOP are determined: VDOP = HDOP, and PDOP = sqrt(2) * HDOP. -#hdop = 0.0 - -# Latitude -# Values : floating point value -# Unit is NMEA like latitude: ddmm.sssss (d=degrees, m=minutes, s=seconds) -# Default: 0000.00000 -#lat = 0000.00000 - -# Longitude -# Values: floating point value -# Unit is NMEA like longitude: dddmm.sssss (d=degrees, m=minutes, s=seconds) -# Default: 00000.00000 -#lon = 00000.00000 - -# Elevation -# Values: floating point value -# Unit is meters above the mean sea level (geoid) -# Default: 0.0 -#elv = 0.0 - -# Speed -# Values: floating point value -# Unit is over the ground in kph -# Default: 0.0 -#speed = 0.0 - -# Direction/Track -# Values: floating point value -# Unit is (compass) degrees -# Default: 0.0 -#direction = 0.0 diff --git a/olsrd/files/olsrd.sgw.speed.conf b/olsrd/files/olsrd.sgw.speed.conf deleted file mode 100644 index ae795d87d..000000000 --- a/olsrd/files/olsrd.sgw.speed.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -# OLSrd Smart Gateway uplink speed configuration file -# - - -# -# Upstream speed in kilobit/s -# Default: 128 -#upstream=128 - -# -# Downstream speed in kilobit/s -# Default: 1024 -#downstream=1024 diff --git a/olsrd/files/olsrd.sh b/olsrd/files/olsrd.sh deleted file mode 100644 index cb52d1973..000000000 --- a/olsrd/files/olsrd.sh +++ /dev/null @@ -1,852 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2008-2017 OpenWrt.org - -OLSRD_OLSRD_SCHEMA='ignore:internal config_file:internal DebugLevel=0 AllowNoInt=yes' -OLSRD_IPCCONNECT_SCHEMA='ignore:internal Host:list Net:list2' -OLSRD_LOADPLUGIN_SCHEMA='ignore:internal library:internal Host4:list Net4:list2 Host:list Net:list2 Host6:list Net6:list2 Ping:list redistribute:list NonOlsrIf:list name:list lat lon latlon_infile HNA:list2 hosts:list2 ipv6only:bool' -OLSRD_INTERFACE_SCHEMA='ignore:internal interface:internal AutoDetectChanges:bool LinkQualityMult:list2' -OLSRD_INTERFACE_DEFAULTS_SCHEMA='AutoDetectChanges:bool' - -T=' ' -N=' -' - -log() { - logger -t olsrd -p daemon.info -s "${initscript}: $*" -} - -error() { - logger -t olsrd -p daemon.err -s "${initscript}: ERROR: $*" -} - -warn() { - logger -t olsrd -p daemon.warn -s "${initscript}: WARNING: $*" -} - -validate_varname() { - local varname="$1" - [ -z "$varname" -o "$varname" != "${varname%%[!A-Za-z0-9_]*}" ] && return 1 - return 0 -} - -olsrd_list_configured_interfaces() -{ - local i=0 - local interface - - while interface="$( uci -q get $OLSRD.@Interface[$i].interface )"; do { - case "$( uci -q get $OLSRD.@Interface[$i].ignore )" in - 1|on|true|enabled|yes) - # is disabled - ;; - *) - echo "$interface" # e.g. 'lan' - ;; - esac - - i=$(( i + 1 )) - } done -} - -olsrd_interface_already_in_config() -{ - # e.g.: 'Interface "eth0.1" "eth0.2" "wlan0"' - if grep -s ^'Interface ' "/var/etc/$OLSRD.conf" | grep -q "\"$DEVICE\""; then - logger -t olsrd_hotplug -p daemon.debug "[OK] already_active: '$INTERFACE' => '$DEVICE'" - return 0 - else - logger -t olsrd_hotplug -p daemon.info "[OK] ifup: '$INTERFACE' => '$DEVICE'" - return 1 - fi -} - -olsrd_interface_needs_adding() -{ - local interface - - # likely and cheap operation: - olsrd_interface_already_in_config && return 1 - - for interface in $(olsrd_list_configured_interfaces); do { - [ "$interface" = "$INTERFACE" ] && { - olsrd_interface_already_in_config || return 0 - } - } done - - logger -t olsrd_hotplug -p daemon.debug "[OK] interface '$INTERFACE' => '$DEVICE' not used for $OLSRD" - return 1 -} - -validate_olsrd_option() { - local str="$1" - [ -z "$str" -o "$str" != "${str%%[! 0-9A-Za-z.%/|:_-]*}" ] && return 1 - return 0 -} - -system_config() { - local cfg="$1" - local cfgt hostname latlon oldIFS - - config_get cfgt "$cfg" TYPE - - if [ "$cfgt" = "system" ]; then - config_get hostname "$cfg" hostname - hostname="${hostname:-OpenWrt}" - SYSTEM_HOSTNAME="$hostname" - fi - - if [ -z "$SYSTEM_LAT" -o -z "$SYSTEM_LON" ]; then - config_get latlon "$cfg" latlon - oldIFS="$IFS"; IFS=" ${T}${N},"; set -- $latlon; IFS="$oldIFS" - SYSTEM_LAT="$1" - SYSTEM_LON="$2" - fi - - if [ -z "$SYSTEM_LAT" -o -z "$SYSTEM_LON" ]; then - config_get latlon "$cfg" latitude - SYSTEM_LAT="$latlon" - config_get latlon "$cfg" longitude - SYSTEM_LON="$latlon" - fi -} - -olsrd_find_config_file() { - local cfg="$1" - validate_varname "$cfg" || return 0 - - config_get_bool ignore "$cfg" ignore 0 - [ "$ignore" -ne 0 ] && return 0 - config_get OLSRD_CONFIG_FILE "$cfg" config_file - - return 0 -} - -warning_invalid_value() { - local funcname="warning_invalid_value" - local package="$1" - validate_varname "$package" || package= - local config="$2" - validate_varname "$config" || config= - local option="$3" - validate_varname "$option" || option= - - if [ -n "$package" -a -n "$config" ]; then - log "$funcname() in option '$package.$config${option:+.}$option', skipped" - else - log "$funcname() skipped" - fi - - return 0 -} - -olsrd_write_option() { - local param="$1" - local cfg="$2" - validate_varname "$cfg" || return 1 - local option="$3" - validate_varname "$option" || return 1 - local value="$4" - local option_type="$5" - - if [ "$option_type" = bool ]; then - case "$value" in - 1|on|true|enabled|yes) value=yes;; - 0|off|false|disabled|no) value=no;; - *) warning_invalid_value olsrd "$cfg" "$option"; return 1;; - esac - fi - - if ! validate_olsrd_option "$value"; then - warning_invalid_value olsrd "$cfg" "$option" - return 1 - fi - - if [ "$value" != "${value%%[G-Zg-z_-]*}" ]; then - if [ "$option" != "Ip6AddrType" -a "$option" != "LinkQualityMult" -a "$value" != "yes" -a "$value" != "no" ]; then - value="\"$value\"" - fi - fi - - printf '%s' "${N}$param$option $value" -} - -olsrd_write_plparam() { - local funcname="olsrd_write_plparam" - local param="$1" - local cfg="$2" - local option="$3" - local value="$4" - local option_type="$5" - local _option oldIFS - - validate_varname "$cfg" || return 1 - validate_varname "$option" || return 1 - - if [ "$option_type" = bool ]; then - case "$value" in - 1|on|true|enabled|yes) value=yes;; - 0|off|false|disabled|no) value=no;; - *) warning_invalid_value olsrd "$cfg" "$option"; return 1;; - esac - fi - - if ! validate_olsrd_option "$value"; then - warning_invalid_value olsrd "$cfg" "$option" - return 1 - fi - - oldIFS="$IFS" - IFS='-_' - set -- $option - option="$*" - IFS="$oldIFS" - _option="$option" - - if [ "$option" = 'hosts' ]; then - set -- $value - option="$1" - shift - value="$*" - fi - - if [ "$option" = 'NonOlsrIf' ]; then - if validate_varname "$value"; then - if network_get_device ifname "$value"; then - log "$funcname() Info: mdns Interface '$value' ifname '$ifname' found" - else - log "$funcname() Warning: mdns Interface '$value' not found, skipped" - fi - else - warning_invalid_value olsrd "$cfg" "NonOlsrIf" - fi - - [ -z "$ifname" ] || value=$ifname - fi - - printf '%s' "${N}${param}PlParam \"$option\" \"$value\"" -} - -config_update_schema() { - local schema_varname="$1" - local command="$2" - local option="$3" - local value="$4" - local schema - local cur_option - - validate_varname "$schema_varname" || return 1 - validate_varname "$command" || return 1 - validate_varname "$option" || return 1 - - case "$varname" in - *_LENGTH) return 0;; - *_ITEM*) return 0;; - esac - - eval "export -n -- \"schema=\${$schema_varname}\"" - - for cur_option in $schema; do - [ "${cur_option%%[:=]*}" = "$option" ] && return 0 - done - - if [ "$command" = list ]; then - set -- $value - if [ "$#" -ge "3" ]; then - schema_entry="$option:list3" - elif [ "$#" -ge "2" ]; then - schema_entry="$option:list2" - else - schema_entry="$option:list" - fi - else - schema_entry="$option" - fi - - append "$schema_varname" "$schema_entry" - - return 0 -} - -config_write_options() { - local funcname="config_write_options" - local schema="$1" - local cfg="$2" - validate_varname "$cfg" || return 1 - local write_func="$3" - [ -z "$write_func" ] && output_func=echo - local write_param="$4" - - local schema_entry option option_length option_type default value list_size list_item list_value i position speed oldIFS - local list_speed_vars="HelloInterval HelloValidityTime TcInterval TcValidityTime MidInterval MidValidityTime HnaInterval HnaValidityTime" - - get_value_for_entry() - { - local schema_entry="$1" - - default="${schema_entry#*[=]}" - [ "$default" = "$schema_entry" ] && default= - option="${schema_entry%%[=]*}" - - oldIFS="$IFS"; IFS=':'; set -- $option; IFS="$oldIFS" - option="$1" - option_type="$2" - - validate_varname "$option" || return 1 - [ -z "$option_type" ] || validate_varname "$option_type" || return 1 - [ "$option_type" = internal ] && return 1 - - config_get value "$cfg" "$option" - [ "$option" = "speed" ] && return 1 - - return 0 - } - - already_in_schema() - { - case " $schema " in - *" $1 "*) - return 0 - ;; - *) - return 1 - ;; - esac - } - - already_in_schema "speed" && { - get_value_for_entry "speed" - - if test 2>/dev/null "$value" -gt 0 -a "$value" -le 20 ; then - speed="$value" - else - log "$funcname() Warning: invalid speed-value: '$value' - allowed integers: 1...20, fallback to 6" - speed=6 - fi - - for schema_entry in $list_speed_vars; do { - already_in_schema "$schema_entry" || schema="$schema $schema_entry" - } done - } - - for schema_entry in $schema; do - if [ -n "$speed" ]; then # like sven-ola freifunk firmware fff-1.7.4 - case "$schema_entry" in - HelloInterval) - value="$(( speed / 2 + 1 )).0" - ;; - HelloValidityTime) - value="$(( speed * 25 )).0" - ;; - TcInterval) # todo: not fisheye? -> $(( speed * 2 )) - value=$(( speed / 2 )) - [ $value -eq 0 ] && value=1 - value="$value.0" - ;; - TcValidityTime) - value="$(( speed * 100 )).0" - ;; - MidInterval) - value="$(( speed * 5 )).0" - ;; - MidValidityTime) - value="$(( speed * 100 )).0" - ;; - HnaInterval) - value="$(( speed * 2 )).0" - ;; - HnaValidityTime) - value="$(( speed * 25 )).0" - ;; - *) - get_value_for_entry "$schema_entry" || continue - ;; - esac - - is_speed_var() - { - case " $list_speed_vars " in - *" $1 "*) - return 0 - ;; - *) - return 1 - ;; - esac - } - - is_speed_var "$schema_entry" && option="$schema_entry" - else - get_value_for_entry "$schema_entry" || continue - fi - - if [ -z "$value" ]; then - oldIFS="$IFS"; IFS='+'; set -- $default; IFS="$oldIFS" - value=$* - elif [ "$value" = '-' -a -n "$default" ]; then - continue - fi - - [ -z "$value" ] && continue - - case "$option_type" in - list) list_size=1;; - list2) list_size=2;; - list3) list_size=3;; - *) list_size=0;; - esac - - if [ "$list_size" -gt 0 ]; then - config_get option_length "$cfg" "${option}_LENGTH" - if [ -n "$option_length" ]; then - i=1 - while [ "$i" -le "$option_length" ]; do - config_get list_value "$cfg" "${option}_ITEM$i" - "$write_func" "$write_param" "$cfg" "$option" "$list_value" "$option_type" || break - i=$((i + 1)) - done - else - list_value= - i=0 - for list_item in $value; do - append "list_value" "$list_item" - i=$((i + 1)) - position=$((i % list_size)) - if [ "$position" -eq 0 ]; then - "$write_func" "$write_param" "$cfg" "$option" "$list_value" "$option_type" || break - list_value= - fi - done - [ "$position" -ne 0 ] && "$write_func" "$write_param" "$cfg" "$option" "$list_value" "$option_type" - fi - else - "$write_func" "$write_param" "$cfg" "$option" "$value" "$option_type" - fi - done - - return 0 -} - -olsrd_write_olsrd() { - local cfg="$1" - validate_varname "$cfg" || return 0 - local ignore - - config_get_bool ignore "$cfg" ignore 0 - [ "$ignore" -ne 0 ] && return 0 - - [ "$OLSRD_COUNT" -gt 0 ] && return 0 - - config_get smartgateway "$cfg" SmartGateway - config_get smartgatewayuplink "$cfg" SmartGatewayUplink - export smartgateway - export smartgatewayuplink - - config_write_options "$OLSRD_OLSRD_SCHEMA" "$cfg" olsrd_write_option - echo - OLSRD_COUNT=$((OLSRD_COUNT + 1)) - return 0 -} - -olsrd_write_ipcconnect() { - local cfg="$1" - validate_varname "$cfg" || return 0 - local ignore - - config_get_bool ignore "$cfg" ignore 0 - [ "$ignore" -ne 0 ] && return 0 - - [ "$IPCCONNECT_COUNT" -gt 0 ] && return 0 - - printf '%s' "${N}IpcConnect${N}{" - config_write_options "$OLSRD_IPCCONNECT_SCHEMA" "$cfg" olsrd_write_option "${T}" - echo "${N}}" - IPCCONNECT_COUNT=$((IPCCONNECT_COUNT + 1)) -} - -olsrd_write_hna4() { - local cfg="$1" - validate_varname "$cfg" || return 0 - local ignore - - config_get_bool ignore "$cfg" ignore 0 - [ "$ignore" -ne 0 ] && return 0 - - config_get netaddr "$cfg" netaddr - if ! validate_olsrd_option "$netaddr"; then - warning_invalid_value olsrd "$cfg" "netaddr" - return 0 - fi - - config_get netmask "$cfg" netmask - if ! validate_olsrd_option "$netmask"; then - warning_invalid_value olsrd "$cfg" "netmask" - return 0 - fi - - [ "$HNA4_COUNT" -le 0 ] && printf '%s' "${N}Hna4${N}{" - printf '%s' "${N}${T}${T}$netaddr $netmask" - HNA4_COUNT=$((HNA4_COUNT + 1)) -} - -olsrd_write_hna6() { - local cfg="$1" - validate_varname "$cfg" || return 0 - local ignore - - config_get_bool ignore "$cfg" ignore 0 - [ "$ignore" -ne 0 ] && return 0 - - config_get netaddr "$cfg" netaddr - if ! validate_olsrd_option "$netaddr"; then - warning_invalid_value olsrd "$cfg" "netaddr" - return 0 - fi - - config_get prefix "$cfg" prefix - if ! validate_olsrd_option "$prefix"; then - warning_invalid_value olsrd "$cfg" "prefix" - return 0 - fi - - [ "$HNA6_COUNT" -le 0 ] && printf '%s' "${N}Hna6${N}{" - printf '%s' "${N}${T}${T}$netaddr $prefix" - HNA6_COUNT=$((HNA6_COUNT + 1)) -} - -find_most_recent_plugin_libary() -{ - local library="$1" # e.g. 'olsrd_dyn_gw' or 'olsrd_txtinfo.so.1.1' - local file file_fullpath unixtime - - for file in "/lib/$library"* "/usr/lib/$library"* "/usr/local/lib/$library"*; do { - [ -f "$file" ] && { - file_fullpath="$file" - file="$( basename "$file" )" - # make sure that we do not select - # 'olsrd_dyn_gw_plain.so.0.4' if user wants - # 'olsrd_dyn_gw.so.0.5' -> compare part before 1st dot - [ "${library%%.*}" = "${file%%.*}" ] && { - unixtime="$( date +%s -r "$file_fullpath" )" - echo "$unixtime $file" - } - } - } done | sort -n | tail -n1 | cut -d' ' -f2 -} - -olsrd_write_loadplugin() -{ - local funcname='olsrd_write_loadplugin' - local cfg="$1" - local ignore name suffix lat lon latlon_infile - - validate_varname "$cfg" || return 0 - - config_get_bool ignore "$cfg" ignore 0 - [ "$ignore" -ne 0 ] && return 0 - - # e.g. olsrd_txtinfo.so.1.1 or 'olsrd_txtinfo' - config_get library "$cfg" library - - library="$( find_most_recent_plugin_libary "$library" )" - if [ -z "$library" ]; then - log "$funcname() Warning: Plugin library '$library' not found, skipped" - return 0 - else - library="$( basename "$library" )" - fi - - validate_olsrd_option "$library" || { - warning_invalid_value olsrd "$cfg" 'library' - return 0 - } - - case "$library" in - 'olsrd_nameservice.'*) - config_get name "$cfg" name - [ -z "$name" ] && config_set "$cfg" name $SYSTEM_HOSTNAME - - config_get suffix "$cfg" suffix - [ -z "$suffix" ] && config_set "$cfg" suffix '.olsr' - - config_get lat "$cfg" lat - config_get lon "$cfg" lon - config_get latlon_infile "$cfg" latlon_infile - if [ \( -z "$lat" -o -z "$lat" \) -a -z "$latlon_infile" ]; then - if [ -f '/var/run/latlon.txt' ]; then - config_set "$cfg" lat '' - config_set "$cfg" lon '' - config_set "$cfg" latlon_infile '/var/run/latlon.txt' - else - config_set "$cfg" lat "$SYSTEM_LAT" - config_set "$cfg" lon "$SYSTEM_LON" - fi - fi - - for f in latlon_file hosts_file services_file resolv_file macs_file; do - config_get $f "$cfg" $f - done - - [ -z "$latlon_file" ] && config_set "$cfg" latlon_file '/var/run/latlon.js' - ;; - 'olsrd_watchdog.'*) - config_get wd_file "$cfg" file - ;; - esac - - printf '%s' "${N}LoadPlugin \"$library\"${N}{" - config_write_options "$OLSRD_LOADPLUGIN_SCHEMA" "$cfg" olsrd_write_plparam "${T}" - echo "${N}}" -} - -olsrd_write_interface() { - local funcname="olsrd_write_interface" - local cfg="$1" - validate_varname "$cfg" || return 0 - local ignore - local interfaces - local interface - local ifnames - - config_get_bool ignore "$cfg" ignore 0 - [ "$ignore" -ne 0 ] && return 0 - - ifnames= - config_get interfaces "$cfg" interface - - for interface in $interfaces; do - if validate_varname "$interface"; then - if network_get_device IFNAME "$interface"; then - ifnames="$ifnames \"$IFNAME\"" - ifsglobal="$ifsglobal $IFNAME" - elif network_get_physdev IFNAME "$interface"; then - local proto="$(uci -q get network.${interface}.proto)" - if [ "$proto" = "static" -o "$proto" = "none" ]; then - ifnames="$ifnames \"$IFNAME\"" - ifsglobal="$ifsglobal $IFNAME" - fi - elif [[ "$(ip -details link show dev $interface)" == *"wireguard"* ]]; then - # wireguard interface - ifnames="$ifnames \"$interface\"" - ifsglobal="$ifsglobal $interface" - else - log "$funcname() Warning: Interface '$interface' not found, skipped" - fi - else - warning_invalid_value olsrd "$cfg" "interface" - fi - done - - [ -z "$ifnames" ] && return 0 - - printf '%s' "${N}Interface$ifnames${N}{" - config_write_options "$OLSRD_INTERFACE_SCHEMA" "$cfg" olsrd_write_option "${T}" - echo "${N}}" - INTERFACES_COUNT=$((INTERFACES_COUNT + 1)) -} - -olsrd_write_interface_defaults() { - local cfg="$1" - validate_varname "$cfg" || return 0 - - printf '%s' "${N}InterfaceDefaults$ifnames${N}{" - config_write_options "$OLSRD_INTERFACE_DEFAULTS_SCHEMA" "$cfg" olsrd_write_option "${T}" - echo "${N}}" - - return 1 -} - -olsrd_update_schema() { - local command="$1" - local varname="$2" - local value="$3" - local cfg="$CONFIG_SECTION" - local cfgt - - validate_varname "$command" || return 0 - validate_varname "$varname" || return 0 - - config_get cfgt "$cfg" TYPE - case "$cfgt" in - olsrd) config_update_schema OLSRD_OLSRD_SCHEMA "$command" "$varname" "$value";; - IpcConnect) config_update_schema OLSRD_IPCCONNECT_SCHEMA "$command" "$varname" "$value";; - LoadPlugin) config_update_schema OLSRD_LOADPLUGIN_SCHEMA "$command" "$varname" "$value";; - Interface) config_update_schema OLSRD_INTERFACE_SCHEMA "$command" "$varname" "$value";; - InterfaceDefaults) config_update_schema OLSRD_INTERFACE_DEFAULTS_SCHEMA "$command" "$varname" "$value";; - esac - - return 0 -} - -olsrd_write_config() { - OLSRD_COUNT=0 - config_foreach olsrd_write_olsrd olsrd - IPCCONNECT_COUNT=0 - config_foreach olsrd_write_ipcconnect IpcConnect - HNA4_COUNT=0 - config_foreach olsrd_write_hna4 Hna4 - [ "$HNA4_COUNT" -gt 0 ] && echo "${N}}" - HNA6_COUNT=0 - config_foreach olsrd_write_hna6 Hna6 - [ "$HNA6_COUNT" -gt 0 ] && echo "${N}}" - config_foreach olsrd_write_loadplugin LoadPlugin - INTERFACES_COUNT=0 - config_foreach olsrd_write_interface_defaults InterfaceDefaults - config_foreach olsrd_write_interface Interface - echo - - return 0 -} - -get_wan_ifnames() -{ - local wanifnames word catch_next - - command -v ip >/dev/null || return 1 - - set -- $( ip route list exact 0.0.0.0/0 table all ) - for word in $*; do - case "$word" in - dev) - catch_next="true" - ;; - *) - [ -n "$catch_next" ] && { - case "$wanifnames" in - *" $word "*) - ;; - *) - wanifnames="$wanifnames $word " - ;; - esac - - catch_next= - } - ;; - esac - done - - echo "$wanifnames" -} - -olsrd_setup_smartgw_rules() { - local funcname="olsrd_setup_smartgw_rules" - local file= - - for file in /etc/modules.d/[0-9]*-ipip; do :; done - [ -e "$file" ] || { - log "$funcname() Warning: kmod-ipip is missing. SmartGateway will not work until you install it." - return 1 - } - - local wanifnames="$( get_wan_ifnames )" - - if [ -z "$wanifnames" ]; then - nowan=1 - else - nowan=0 - fi - - IP4T="$( command -v iptables )" - IP6T="$( command -v ip6tables )" - - # Delete smartgw firewall rules first - if [ "$UCI_CONF_NAME" = "olsrd6" ]; then - while $IP6T -D forwarding_rule -o tnl_+ -j ACCEPT 2> /dev/null; do :;done - for IFACE in $wanifnames; do - while $IP6T -D forwarding_rule -i tunl0 -o $IFACE -j ACCEPT 2> /dev/null; do :; done - done - for IFACE in $ifsglobal; do - while $IP6T -D input_rule -i $IFACE -p 4 -j ACCEPT 2> /dev/null; do :; done - done - else - while $IP4T -D forwarding_rule -o tnl_+ -j ACCEPT 2> /dev/null; do :;done - for IFACE in $wanifnames; do - while $IP4T -D forwarding_rule -i tunl0 -o $IFACE -j ACCEPT 2> /dev/null; do :; done - done - for IFACE in $ifsglobal; do - while $IP4T -D input_rule -i $IFACE -p 4 -j ACCEPT 2> /dev/null; do :; done - done - while $IP4T -t nat -D postrouting_rule -o tnl_+ -j MASQUERADE 2> /dev/null; do :;done - fi - - # var 'smartgateway' + 'smartgatewayuplink' build in olsrd_write_olsrd() - if [ "$smartgateway" = "yes" ]; then - log "$funcname() Notice: Inserting firewall rules for SmartGateway" - - if [ ! "$smartgatewayuplink" = "none" ]; then - if [ "$smartgatewayuplink" = "ipv4" ]; then - # Allow everything to be forwarded to tnl_+ and use NAT for it - $IP4T -I forwarding_rule -o tnl_+ -j ACCEPT - $IP4T -t nat -I postrouting_rule -o tnl_+ -j MASQUERADE - # Allow forwarding from tunl0 to (all) wan-interfaces - if [ "$nowan" = '0' ]; then - for IFACE in $wanifnames; do - $IP4T -A forwarding_rule -i tunl0 -o $IFACE -j ACCEPT - done - fi - # Allow incoming ipip on all olsr-interfaces - for IFACE in $ifsglobal; do - $IP4T -I input_rule -i $IFACE -p 4 -j ACCEPT - done - elif [ "$smartgatewayuplink" = "ipv6" ]; then - $IP6T -I forwarding_rule -o tnl_+ -j ACCEPT - if [ "$nowan" = '0' ]; then - for IFACE in $wanifnames; do - $IP6T -A forwarding_rule -i tunl0 -o $IFACE -j ACCEPT - done - fi - for IFACE in $ifsglobal; do - $IP6T -I input_rule -i $IFACE -p 4 -j ACCEPT - done - else - $IP4T -t nat -I postrouting_rule -o tnl_+ -j MASQUERADE - for IPT in $IP4T $IP6T; do - $IPT -I forwarding_rule -o tnl_+ -j ACCEPT - if [ "$nowan" = '0' ]; then - for IFACE in $wanifnames; do - $IPT -A forwarding_rule -i tunl0 -o $IFACE -j ACCEPT - done - fi - for IFACE in $ifsglobal; do - $IPT -I input_rule -i $IFACE -p 4 -j ACCEPT - done - done - fi - fi - fi -} - -olsrd_generate_config() { - UCI_CONF_NAME="$1" - SYSTEM_HOSTNAME= - SYSTEM_LAT= - SYSTEM_LON= - config_load system - config_foreach system_config system - - option_cb() { - olsrd_update_schema "option" "$@" - } - - list_cb() { - olsrd_update_schema "list" "$@" - } - - . /lib/functions/network.sh - - config_load $UCI_CONF_NAME - reset_cb - - OLSRD_CONFIG_FILE= - config_foreach olsrd_find_config_file olsrd - - if [ -z "$OLSRD_CONFIG_FILE" ]; then - mkdir -p -- /var/etc/ - olsrd_write_config > /var/etc/$UCI_CONF_NAME.conf || return 1 - if [ "$INTERFACES_COUNT" -gt 0 -a "$OLSRD_COUNT" -gt 0 ]; then - OLSRD_CONFIG_FILE=/var/etc/$UCI_CONF_NAME.conf - fi - fi - - [ -z "$OLSRD_CONFIG_FILE" ] && return 1 -} diff --git a/olsrd/files/olsrd4.init b/olsrd/files/olsrd4.init deleted file mode 100644 index 62cb66d6f..000000000 --- a/olsrd/files/olsrd4.init +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2008-2013 OpenWrt.org - -. $IPKG_INSTROOT/lib/functions/olsrd.sh - -START=65 -USE_PROCD=1 -BIN=/usr/sbin/olsrd -OLSRD=olsrd -CONF=/var/etc/$OLSRD.conf -PID=/var/run/olsrd.pid - -wait_for_network() -{ - ubus -t 15 wait_for network.interface.$1 2>/dev/null -} - -wait_for_wireless() -{ - local count=0 - ubus -t 15 wait_for network.wireless 2>/dev/null - while [ $count -lt 30 ]; do - if [ "$(ubus call network.wireless status | jsonfilter -e '@[*]["pending"]' | grep true | wc -l)" == "0" ]; then - break - fi - count=$((count+1)) - sleep 1 - done -} - -boot() -{ - config_load network - config_foreach wait_for_network interface - wait_for_wireless - rc_procd start_service -} - -start_service() { - olsrd_generate_config $OLSRD - - procd_open_instance - - config_load olsrd - local _respawn_threshold - local _respawn_timeout - local _respawn_retry - - config_get _respawn_threshold procd respawn_threshold 3600 - config_get _respawn_timeout procd respawn_timeout 15 - config_get _respawn_retry procd respawn_retry 0 - - procd_set_param command "$BIN" - procd_append_param command -f ${CONF} - procd_append_param command -nofork - procd_append_param command -pidfile ${PID} - - # restart if olsrd dies - procd_set_param respawn $_respawn_threshold $_respawn_timeout $_respawn_retry - - # automatically restart olsrd if generated cfg has changed - procd_set_param file $CONF - - procd_set_param pidfile $PID - - procd_close_instance - - olsrd_setup_smartgw_rules -} - -service_triggers() { - # reload if config changed via uci - procd_add_reload_trigger "olsrd" - - # restart on ifup interface events - for n in $(olsrd_list_configured_interfaces $OLSRD); do - procd_add_reload_interface_trigger $n /etc/init.d/$OLSRD reload - done -} diff --git a/olsrd/files/olsrd6.config b/olsrd/files/olsrd6.config deleted file mode 100644 index 52a9b21cd..000000000 --- a/olsrd/files/olsrd6.config +++ /dev/null @@ -1,16 +0,0 @@ -config olsrd - # uncomment the following line to use a custom config file instead: - #option config_file '/etc/olsrd6.conf' - -config LoadPlugin - option library 'olsrd_txtinfo.so.1.1' - option accept '::' - option port '2007' - -config Interface - list interface 'wlan' - -config procd procd - option respawn_threshold '3600' - option respawn_timeout '15' - option respawn_retry '0' diff --git a/olsrd/files/olsrd6.init b/olsrd/files/olsrd6.init deleted file mode 100644 index a20e96728..000000000 --- a/olsrd/files/olsrd6.init +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2008-2013 OpenWrt.org - -. $IPKG_INSTROOT/lib/functions/olsrd.sh - -START=65 -USE_PROCD=1 -BIN=/usr/sbin/olsrd -OLSRD=olsrd6 -CONF=/var/etc/$OLSRD.conf -PID=/var/run/olsrd6.pid - -wait_for_network() -{ - ubus -t 15 wait_for network.interface.$1 2>/dev/null -} - -wait_for_wireless() -{ - local count=0 - ubus -t 15 wait_for network.wireless 2>/dev/null - while [ $count -lt 30 ]; do - if [ "$(ubus call network.wireless status | jsonfilter -e '@[*]["pending"]' | grep true | wc -l)" == "0" ]; then - break - fi - count=$((count+1)) - sleep 1 - done -} - -boot() -{ - config_load network - config_foreach wait_for_network interface - wait_for_wireless - rc_procd start_service -} - -start_service() { - olsrd_generate_config $OLSRD - - procd_open_instance - - config_load olsrd6 - local _respawn_threshold - local _respawn_timeout - local _respawn_retry - - config_get _respawn_threshold procd _respawn_threshold 3600 - config_get _respawn_timeout procd respawn_timeout 15 - config_get _respawn_retry procd respawn_retry 0 - - procd_set_param command "$BIN" - procd_append_param command -f ${CONF} - procd_append_param command -nofork - procd_append_param command -pidfile ${PID} - - # restart if olsrd dies - procd_set_param respawn $_respawn_threshold $_respawn_timeout $_respawn_retry - - # automatically restart olsrd if generated cfg has changed - procd_set_param file $CONF - - procd_set_param pidfile $PID - - procd_close_instance - - olsrd_setup_smartgw_rules -} - -service_triggers() { - # reload if config changed via uci - procd_add_reload_trigger "olsrd6" - - # restart on ifup interface events - for n in $(olsrd_list_configured_interfaces $OLSRD); do - procd_add_reload_interface_trigger $n /etc/init.d/$OLSRD reload - done -} diff --git a/olsrd/files/olsrd_secure_key b/olsrd/files/olsrd_secure_key deleted file mode 100644 index 4a7d7258f..000000000 --- a/olsrd/files/olsrd_secure_key +++ /dev/null @@ -1 +0,0 @@ -1234567890123456 \ No newline at end of file diff --git a/olsrd/patches/102-olsrd-prevent-storm-patches.patch b/olsrd/patches/102-olsrd-prevent-storm-patches.patch deleted file mode 100644 index 69d595216..000000000 --- a/olsrd/patches/102-olsrd-prevent-storm-patches.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 4dabd94d598dd893aaaffbd71c315923c8827a14 Mon Sep 17 00:00:00 2001 -From: Nick Hainke -Date: Wed, 22 Jun 2022 14:08:04 +0200 -Subject: [PATCH] olsrd: prevent storm patches - -As described in the PR: - - Limit the positive sequence number difference which is considered valid, - and prevent network storms. - Source: https://github.com/aredn/aredn_packages/pull/5 - -Signed-off-by: Nick Hainke ---- - src/duplicate_set.c | 16 ++++++++-------- - src/duplicate_set.h | 5 +++-- - 2 files changed, 11 insertions(+), 10 deletions(-) - ---- a/src/duplicate_set.c -+++ b/src/duplicate_set.c -@@ -70,7 +70,7 @@ void olsr_cleanup_duplicates(union olsr_ - - entry = (struct dup_entry *)olsrd_avl_find(&duplicate_set, orig); - if (entry != NULL) { -- entry->too_low_counter = DUP_MAX_TOO_LOW - 2; -+ entry->out_of_bounds_counter = DUP_MAX_OUT_OF_BOUNDS - 2; - } - } - -@@ -82,7 +82,7 @@ olsr_create_duplicate_entry(void *ip, ui - if (entry != NULL) { - memcpy(&entry->ip, ip, olsr_cnf->ip_version == AF_INET ? sizeof(entry->ip.v4) : sizeof(entry->ip.v6)); - entry->seqnr = seqnr; -- entry->too_low_counter = 0; -+ entry->out_of_bounds_counter = 0; - entry->olsrd_avl.key = &entry->ip; - entry->array = 0; - } -@@ -160,12 +160,12 @@ olsr_message_is_duplicate(union olsr_mes - } - - diff = olsr_seqno_diff(seqnr, entry->seqnr); -- if (diff < -31) { -- entry->too_low_counter++; -+ if (diff < -31 || diff > DUP_SEQNR_DIFF_HIGH_LIMIT) { -+ entry->out_of_bounds_counter++; - -- // client did restart with a lower number ? -- if (entry->too_low_counter > DUP_MAX_TOO_LOW) { -- entry->too_low_counter = 0; -+ // client did restart with a too low or too high number ? -+ if (entry->out_of_bounds_counter > DUP_MAX_OUT_OF_BOUNDS) { -+ entry->out_of_bounds_counter = 0; - entry->seqnr = seqnr; - entry->array = 1; - return false; /* start with a new sequence number, so NO duplicate */ -@@ -174,7 +174,7 @@ olsr_message_is_duplicate(union olsr_mes - return true; /* duplicate ! */ - } - -- entry->too_low_counter = 0; -+ entry->out_of_bounds_counter = 0; - if (diff <= 0) { - uint32_t bitmask = 1u << ((uint32_t) (-diff)); - ---- a/src/duplicate_set.h -+++ b/src/duplicate_set.h -@@ -54,13 +54,14 @@ - #define DUPLICATE_CLEANUP_INTERVAL 15000 - #define DUPLICATE_CLEANUP_JITTER 25 - #define DUPLICATE_VTIME 120000 --#define DUP_MAX_TOO_LOW 16 -+#define DUP_MAX_OUT_OF_BOUNDS 16 -+#define DUP_SEQNR_DIFF_HIGH_LIMIT 0x2000 - - struct dup_entry { - struct olsrd_avl_node olsrd_avl; - union olsr_ip_addr ip; - uint16_t seqnr; -- uint16_t too_low_counter; -+ uint16_t out_of_bounds_counter; - uint32_t array; - uint32_t valid_until; - }; diff --git a/olsrd/patches/600-add-ubus-support.patch b/olsrd/patches/600-add-ubus-support.patch deleted file mode 100644 index c43e78d51..000000000 --- a/olsrd/patches/600-add-ubus-support.patch +++ /dev/null @@ -1,60 +0,0 @@ ---- a/src/scheduler.c -+++ b/src/scheduler.c -@@ -59,6 +59,8 @@ - #include - #include - -+#include "ubus.h" -+ - #ifdef __MACH__ - #include "mach/clock_gettime.h" - #endif -@@ -363,6 +365,8 @@ poll_sockets(void) - } - OLSR_FOR_ALL_SOCKETS_END(entry); - -+ hfd = olsrd_ubus_add_read_sock(&ibits, hfd); -+ - /* Running select on the FD set */ - do { - n = olsr_select(hfd, fdsets & SP_PR_READ ? &ibits : NULL, fdsets & SP_PR_WRITE ? &obits : NULL, NULL, &tvp); -@@ -395,6 +399,7 @@ poll_sockets(void) - } - } - OLSR_FOR_ALL_SOCKETS_END(entry); -+ olsrd_ubus_receive(&ibits); - } - - static void ---- a/src/main.c -+++ b/src/main.c -@@ -74,6 +74,8 @@ - #include "lock_file.h" - #include "cli.h" - -+#include "ubus.h" -+ - #if defined(__GLIBC__) && defined(__linux__) && !defined(__ANDROID__) && !defined(__UCLIBC__) - #define OLSR_HAVE_EXECINFO_H - #endif -@@ -771,6 +773,9 @@ int main(int argc, char *argv[]) { - signal(SIGUSR2, SIG_IGN); - #endif /* _WIN32 */ - -+ /* Adding ubus */ -+ olsrd_add_ubus(); -+ - /* Starting scheduler */ - olsr_scheduler(); - ---- a/Makefile.inc -+++ b/Makefile.inc -@@ -252,7 +252,7 @@ else - ifeq ($(OS),win32) - LDFLAGS += -Wl,-export-all-symbols - else -- LDFLAGS += -Wl,-export-dynamic -+ LDFLAGS += -Wl,-export-dynamic,-lubus,-lubox - endif - ifeq ($(NORPATH),0) - LDFLAGS += -Wl,-rpath,$(LIBDIR) diff --git a/olsrd/src/src/ubus.c b/olsrd/src/src/ubus.c deleted file mode 100644 index 37c2dbf99..000000000 --- a/olsrd/src/src/ubus.c +++ /dev/null @@ -1,229 +0,0 @@ -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "defs.h" -#include "ifnet.h" -#include "interfaces.h" -#include "link_set.h" -#include "log.h" -#include "olsr.h" -#include "olsr_cfg.h" - -#include "ubus.h" - -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#define MIN(a, b) ((a) < (b) ? (a) : (b)) - -// Shared state maintained throughout calls to handle ubus messages. -static struct ubus_context *shared_ctx; - -enum { INTERFACE_IFNAME, INTERFACE_LQM, __INTERFACE_MAX }; - -static const struct blobmsg_policy interface_policy[__INTERFACE_MAX] = { - [INTERFACE_IFNAME] = {"ifname", BLOBMSG_TYPE_STRING}, - [INTERFACE_LQM] = {"lqm", BLOBMSG_TYPE_STRING}, -}; - -static int olsrd_ubus_add_interface(struct ubus_context *ctx_local, - struct ubus_object *obj, - struct ubus_request_data *req, - const char *method, struct blob_attr *msg) { - struct blob_attr *tb[__INTERFACE_MAX]; - struct blob_buf b = {0}; - union olsr_ip_addr addr; - int ret; - char *ifname, *lqm; - - blobmsg_parse(interface_policy, __INTERFACE_MAX, tb, blob_data(msg), - blob_len(msg)); - - if (!tb[INTERFACE_IFNAME]) - return UBUS_STATUS_INVALID_ARGUMENT; - - ifname = blobmsg_get_string(tb[INTERFACE_IFNAME]); - - struct interface_olsr *tmp = if_ifwithname(ifname); - if (tmp != NULL) { - return UBUS_STATUS_PERMISSION_DENIED; - } - - struct olsr_if *temp; - for (temp = olsr_cnf->interfaces; temp != NULL; temp = temp->next) { - if (strcmp(temp->name, ifname) == 0) - return UBUS_STATUS_PERMISSION_DENIED; - } - - struct olsr_if *tmp_ifs = olsr_create_olsrif(ifname, false); - tmp_ifs->cnf = - olsr_malloc(sizeof(struct if_config_options), "Set default config"); - *tmp_ifs->cnf = *olsr_cnf->interface_defaults; - - if (tb[INTERFACE_LQM]) { // add interface lqm - lqm = blobmsg_get_string(tb[INTERFACE_LQM]); - memset(&addr, 0, sizeof(addr)); - - struct olsr_lq_mult *mult = malloc(sizeof(*mult)); - if (mult == NULL) { - olsr_syslog(OLSR_LOG_ERR, "Out of memory (LQ multiplier).\n"); - return UBUS_STATUS_UNKNOWN_ERROR; - } - - double lqm_value = atof(lqm); - mult->addr = addr; - mult->value = (uint32_t)(lqm_value * LINK_LOSS_MULTIPLIER); - tmp_ifs->cnf->lq_mult = mult; - tmp_ifs->cnf->orig_lq_mult_cnt++; - } - - blob_buf_init(&b, 0); - blobmsg_add_string(&b, "adding", ifname); - - ret = ubus_send_reply(ctx_local, req, b.head); - if (ret) - olsr_syslog(OLSR_LOG_ERR, "Failed to send reply: %s\n", ubus_strerror(ret)); - - blob_buf_free(&b); - - return ret; -} - -static int olsrd_ubus_del_interface(struct ubus_context *ctx_local, - struct ubus_object *obj, - struct ubus_request_data *req, - const char *method, struct blob_attr *msg) { - struct blob_attr *tb[__INTERFACE_MAX]; - struct blob_buf b = {0}; - int ret; - char *ifname; - struct olsr_if *tmp_if, *del_if; - - blobmsg_parse(interface_policy, __INTERFACE_MAX, tb, blob_data(msg), - blob_len(msg)); - - if (!tb[INTERFACE_IFNAME]) - return UBUS_STATUS_INVALID_ARGUMENT; - - ifname = blobmsg_get_string(tb[INTERFACE_IFNAME]); - - struct interface_olsr *tmp = if_ifwithname(ifname); - - if (tmp != NULL) { - - struct olsr_if *temp = olsr_cnf->interfaces, *prev; - if (temp != NULL && (strcmp(temp->name, ifname) == 0)) { - olsr_cnf->interfaces = temp->next; - olsr_remove_interface(temp); - goto send_reply; - } - - while (temp != NULL && (strcmp(temp->name, ifname) != 0)) { - prev = temp; - temp = temp->next; - } - - if (temp == NULL) { - goto send_reply; - } - - prev->next = temp->next; - olsr_remove_interface(temp); - } else { - return UBUS_STATUS_PERMISSION_DENIED; - } - -send_reply: - - blob_buf_init(&b, 0); - blobmsg_add_string(&b, "deleting", ifname); - - ret = ubus_send_reply(ctx_local, req, b.head); - if (ret) - olsr_syslog(OLSR_LOG_ERR, "Failed to send reply: %s\n", ubus_strerror(ret)); - - blob_buf_free(&b); - - return ret; -} - -// List of functions we expose via the ubus bus. -static const struct ubus_method olsrd_methods[] = { - UBUS_METHOD("add_interface", olsrd_ubus_add_interface, interface_policy), - UBUS_METHOD("del_interface", olsrd_ubus_del_interface, interface_policy), -}; - -// Definition of the ubus object type. -static struct ubus_object_type olsrd_object_type = - UBUS_OBJECT_TYPE("olsrd", olsrd_methods); - -// Object we announce via the ubus bus. -static struct ubus_object olsrd_object = { - .name = "olsrd", - .type = &olsrd_object_type, - .methods = olsrd_methods, - .n_methods = ARRAY_SIZE(olsrd_methods), -}; - -// Registers handlers for olsrd methods in the global ubus context. -static bool ubus_init_object() { - int ret; - - ret = ubus_add_object(shared_ctx, &olsrd_object); - if (ret) { - olsr_syslog(OLSR_LOG_ERR, "Failed to add object: %s\n", ubus_strerror(ret)); - return false; - } - - return true; -} - -// Initializes the global ubus context, connecting to the bus to be able to -// receive and send messages. -static bool olsrd_ubus_init(void) { - if (shared_ctx) - return true; - - shared_ctx = ubus_connect(NULL); - if (!shared_ctx) - return false; - - return true; -} - -void olsrd_ubus_receive(fd_set *readfds) { - if (!shared_ctx) - return; - if (FD_ISSET(shared_ctx->sock.fd, readfds)) - ubus_handle_event(shared_ctx); -} - -int olsrd_ubus_add_read_sock(fd_set *readfds, int maxfd) { - if (!shared_ctx) - return maxfd; - - FD_SET(shared_ctx->sock.fd, readfds); - return MAX(maxfd, shared_ctx->sock.fd + 1); -} - -bool olsrd_add_ubus() { - if (!olsrd_ubus_init()) { - olsr_syslog(OLSR_LOG_ERR, "Failed to initialize ubus!\n"); - return false; - } - if (!ubus_init_object()) { - olsr_syslog(OLSR_LOG_ERR, "Failed to add objects to ubus!\n"); - return false; - } - return true; -} diff --git a/olsrd/src/src/ubus.h b/olsrd/src/src/ubus.h deleted file mode 100644 index 10bd59f72..000000000 --- a/olsrd/src/src/ubus.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - IPC integration of olsrd with OpenWrt. - - The ubus interface offers following functions: - - add_inteface '{"ifname":"wg_51820", "lqm": "0.5"}' - - del_inteface '{"ifname":"wg_51820"}' -*/ - -#include -#include - -/** - * Initialize ubus interface. - * - * Connect to the ubus daemon and expose the ubus functions. - * - * @return if initializing ubus was successful - */ -bool olsrd_add_ubus(); - -/** - * Add ubus socket to given filedescriptor set. - * - * We need to check repeatedly if the ubus socket has something to read. - * The functions allows to add the ubus socket to the normal while(1)-loop of - * olsrd. - * - * @param readfs: the filedescriptor set - * @param maxfd: the current maximum file descriptor - * @return the maximum file descriptor - */ -int olsrd_ubus_add_read_sock(fd_set *readfds, int maxfd); - -/** - * Check and process ubus socket. - * - * If the ubus-socket signals that data is available, the ubus_handle_event is - * called. - */ -void olsrd_ubus_receive(fd_set *readfds); diff --git a/opennds/Makefile b/opennds/Makefile deleted file mode 100644 index edda12e0f..000000000 --- a/opennds/Makefile +++ /dev/null @@ -1,90 +0,0 @@ -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=opennds -PKG_VERSION:=10.3.1 -PKG_RELEASE:=2 - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://codeload.github.com/opennds/opennds/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=f82fe0fa2e4e8ab66abf33cae7cb20e79661c8a183af82eefa11307e9c66968d -PKG_BUILD_DIR:=$(BUILD_DIR)/openNDS-$(PKG_VERSION) - -PKG_MAINTAINER:=Rob White -PKG_LICENSE:=GPL-2.0-or-later -PKG_LICENSE_FILES:=COPYING -PKG_CPE_ID:=cpe:/a:opennds:captive_portal - -PKG_FIXUP:=autoreconf -PKG_BUILD_PARALLEL:=1 - -include $(INCLUDE_DIR)/package.mk - -define Package/opennds - SUBMENU:=Captive Portals - SECTION:=net - CATEGORY:=Network - DEPENDS:=+libmicrohttpd-no-ssl - TITLE:=open Network Demarcation Service - URL:=https://github.com/opennds/opennds - CONFLICTS:=nodogsplash -endef - -define Package/opennds/description - openNDS (open Network Demarcation Service) is a high performance, small footprint, Captive Portal. - It provides a border control gateway between a public local area network and the Internet. - It supports all scenarios ranging from small stand alone venues through to large mesh networks with multiple portal entry points. - Both the client driven Captive Portal Detection method (CPD) and gateway driven Captive Portal Identification method (CPI - RFC 8910 and RFC 8908) are supported. - This version uses nftables. -endef - -define Package/opennds/install - $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/opennds $(1)/usr/bin/ - $(INSTALL_BIN) $(PKG_BUILD_DIR)/ndsctl $(1)/usr/bin/ - $(INSTALL_DIR) $(1)/etc/opennds/htdocs/images - $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_DIR) $(1)/etc/uci-defaults - $(INSTALL_DIR) $(1)/usr/lib/opennds - $(CP) $(PKG_BUILD_DIR)/resources/splash.css $(1)/etc/opennds/htdocs/ - $(CP) $(PKG_BUILD_DIR)/resources/splash.jpg $(1)/etc/opennds/htdocs/images/ - $(INSTALL_CONF) $(PKG_BUILD_DIR)/linux_openwrt/opennds/files/etc/config/opennds $(1)/etc/config/ - $(CP) $(PKG_BUILD_DIR)/linux_openwrt/opennds/files/etc/config/opennds $(1)/etc/opennds/config.uci - $(CP) $(PKG_BUILD_DIR)/linux_openwrt/opennds/files/etc/init.d/opennds $(1)/etc/init.d/ - $(CP) $(PKG_BUILD_DIR)/linux_openwrt/opennds/files/etc/uci-defaults/40_opennds $(1)/etc/uci-defaults/ - $(CP) $(PKG_BUILD_DIR)/linux_openwrt/opennds/files/usr/lib/opennds/restart.sh $(1)/usr/lib/opennds/ - $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/binauth/binauth_log.sh $(1)/usr/lib/opennds/ - $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/binauth/custombinauth.sh $(1)/usr/lib/opennds/ - $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/libopennds.sh $(1)/usr/lib/opennds/ - $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/PreAuth/theme_click-to-continue-basic.sh $(1)/usr/lib/opennds/ - $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/PreAuth/theme_click-to-continue-custom-placeholders.sh $(1)/usr/lib/opennds/ - $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/PreAuth/theme_user-email-login-basic.sh $(1)/usr/lib/opennds/ - $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/PreAuth/theme_user-email-login-custom-placeholders.sh $(1)/usr/lib/opennds/ - $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/get_client_interface.sh $(1)/usr/lib/opennds/ - $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/client_params.sh $(1)/usr/lib/opennds/ - $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/authmon.sh $(1)/usr/lib/opennds/ - $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/dnsconfig.sh $(1)/usr/lib/opennds/ - $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/download_resources.sh $(1)/usr/lib/opennds/ - $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/post-request.php $(1)/usr/lib/opennds/ - $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/fas-aes/fas-aes.php $(1)/etc/opennds/ - $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/fas-hid/fas-hid.php $(1)/etc/opennds/ - $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/fas-hid/fas-hid-https.php $(1)/etc/opennds/ - $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/fas-aes/fas-aes-https.php $(1)/etc/opennds/ -endef - -define Package/opennds/postrm -#!/bin/sh -uci delete firewall.opennds -uci commit firewall -endef - -define Package/opennds/conffiles -/etc/config/opennds -endef - -$(eval $(call BuildPackage,opennds))