forked from freifunk-franken/firmware
Compare commits
35 Commits
20211201-b
...
master
Author | SHA1 | Date |
---|---|---|
Dennis Eisold | 4721f2086e | |
Dennis Eisold | b75041997b | |
Dennis Eisold | 9c97da67ca | |
Dennis Eisold | e11cb2d012 | |
Dennis Eisold | b52801fe14 | |
Dennis Eisold | 9cc28b9114 | |
Johannes Kimmel | 87d923c1ef | |
Christian Dresel | 0e8c32a363 | |
Fabian Bläse | a5ad4a9b00 | |
Fabian Bläse | 17bc1a7e62 | |
Fabian Bläse | 330ed1b52d | |
Fabian Bläse | 5b23824344 | |
Fabian Bläse | 5424eb728c | |
Fabian Bläse | 209c9debbf | |
Fabian Bläse | 1c3328e64a | |
Fabian Bläse | a8ce8e1ad6 | |
Fabian Bläse | 3f765e4ba7 | |
Fabian Bläse | 1917c8a1df | |
Fabian Bläse | c2f80c9999 | |
Adrian Schmutzler | 27baecaf37 | |
Christian Dresel | 825d760bd8 | |
Fabian Bläse | 51ec3648cf | |
Fabian Bläse | 8ef6dba5a1 | |
Robert Langhammer | a6b90f1a83 | |
Robert Langhammer | 085dbb64fe | |
Robert Langhammer | 12f60419cd | |
Robert Langhammer | 1febd2a9b2 | |
Johannes Kimmel | feeead6c43 | |
Johannes Kimmel | 9d745d0d5c | |
Fabian Bläse | 7c3f3230ff | |
Fabian Bläse | a3d62c7fcc | |
Fabian Bläse | c3cb53ebef | |
Fabian Bläse | 40be50311b | |
Fabian Bläse | 596a785ebc | |
Fabian Bläse | 6bf01bb070 |
|
@ -7,11 +7,11 @@ CONFIG_TARGET_MULTI_PROFILE=y
|
|||
CONFIG_TARGET_DEVICE_ath79_generic_DEVICE_glinet_gl-ar150=y
|
||||
CONFIG_TARGET_DEVICE_PACKAGES_ath79_generic_DEVICE_glinet_gl-ar150=""
|
||||
CONFIG_TARGET_DEVICE_ath79_generic_DEVICE_tplink_archer-c25-v1=y
|
||||
CONFIG_TARGET_DEVICE_PACKAGES_ath79_generic_DEVICE_tplink_archer-c25-v1="-kmod-ath10k-ct-smallbuffers kmod-ath10k -ath10k-firmware-qca9887-ct ath10k-firmware-qca9887"
|
||||
CONFIG_TARGET_DEVICE_PACKAGES_ath79_generic_DEVICE_tplink_archer-c25-v1="-kmod-ath10k-ct-smallbuffers kmod-ath10k-smallbuffers -ath10k-firmware-qca9887-ct ath10k-firmware-qca9887"
|
||||
CONFIG_TARGET_DEVICE_ath79_generic_DEVICE_tplink_archer-c60-v1=y
|
||||
CONFIG_TARGET_DEVICE_PACKAGES_ath79_generic_DEVICE_tplink_archer-c60-v1="-kmod-ath10k-ct-smallbuffers kmod-ath10k -ath10k-firmware-qca9888-ct ath10k-firmware-qca9888"
|
||||
CONFIG_TARGET_DEVICE_PACKAGES_ath79_generic_DEVICE_tplink_archer-c60-v1="-kmod-ath10k-ct-smallbuffers kmod-ath10k-smallbuffers -ath10k-firmware-qca9888-ct ath10k-firmware-qca9888"
|
||||
CONFIG_TARGET_DEVICE_ath79_generic_DEVICE_tplink_archer-c60-v2=y
|
||||
CONFIG_TARGET_DEVICE_PACKAGES_ath79_generic_DEVICE_tplink_archer-c60-v2="-kmod-ath10k-ct-smallbuffers kmod-ath10k -ath10k-firmware-qca9888-ct ath10k-firmware-qca9888"
|
||||
CONFIG_TARGET_DEVICE_PACKAGES_ath79_generic_DEVICE_tplink_archer-c60-v2="-kmod-ath10k-ct-smallbuffers kmod-ath10k-smallbuffers -ath10k-firmware-qca9888-ct ath10k-firmware-qca9888"
|
||||
CONFIG_TARGET_DEVICE_ath79_generic_DEVICE_tplink_archer-c7-v2=y
|
||||
CONFIG_TARGET_DEVICE_PACKAGES_ath79_generic_DEVICE_tplink_archer-c7-v2="-kmod-ath10k-ct kmod-ath10k -ath10k-firmware-qca988x-ct ath10k-firmware-qca988x"
|
||||
CONFIG_TARGET_DEVICE_ath79_generic_DEVICE_tplink_archer-c7-v5=y
|
||||
|
@ -88,6 +88,7 @@ CONFIG_PACKAGE_wpad-mini=m
|
|||
CONFIG_PACKAGE_ath10k-firmware-qca9887=m
|
||||
CONFIG_PACKAGE_ath10k-firmware-qca9888=m
|
||||
CONFIG_PACKAGE_ath10k-firmware-qca988x=m
|
||||
CONFIG_PACKAGE_kmod-ath10k-smallbuffers=m
|
||||
CONFIG_PACKAGE_kmod-ath10k=m
|
||||
CONFIG_PACKAGE_ath10k-firmware-qca9887-ct=m
|
||||
CONFIG_PACKAGE_ath10k-firmware-qca9888-ct=m
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
From: Adrian Schmutzler <freifunk@adrianschmutzler.de>
|
||||
Date: Wed, 10 Feb 2021 22:53:00 +0100
|
||||
Subject: mac80211: add back ath10k_pci memory hacks
|
||||
|
||||
These hacks have been removed in commit 1e27befe63ff ("mac80211: remove
|
||||
ath10k_pci memory hacks").
|
||||
|
||||
However, since we still use mainline ath10k, we will need them.
|
||||
|
||||
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
|
||||
|
||||
diff --git a/package/kernel/mac80211/patches/ath/960-ath10k-limit-htt-rx-ring-size.patch b/package/kernel/mac80211/patches/ath/960-ath10k-limit-htt-rx-ring-size.patch
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e907c7ab73677a3db928ef3620d77bf22a4d752a
|
||||
--- /dev/null
|
||||
+++ b/package/kernel/mac80211/patches/ath/960-ath10k-limit-htt-rx-ring-size.patch
|
||||
@@ -0,0 +1,11 @@
|
||||
+--- a/drivers/net/wireless/ath/ath10k/htt.h
|
||||
++++ b/drivers/net/wireless/ath/ath10k/htt.h
|
||||
+@@ -236,7 +236,7 @@ enum htt_rx_ring_flags {
|
||||
+ };
|
||||
+
|
||||
+ #define HTT_RX_RING_SIZE_MIN 128
|
||||
+-#define HTT_RX_RING_SIZE_MAX 2048
|
||||
++#define HTT_RX_RING_SIZE_MAX 512
|
||||
+ #define HTT_RX_RING_SIZE HTT_RX_RING_SIZE_MAX
|
||||
+ #define HTT_RX_RING_FILL_LEVEL (((HTT_RX_RING_SIZE) / 2) - 1)
|
||||
+ #define HTT_RX_RING_FILL_LEVEL_DUAL_MAC (HTT_RX_RING_SIZE - 1)
|
||||
diff --git a/package/kernel/mac80211/patches/ath/961-ath10k-limit-pci-buffer-size.patch b/package/kernel/mac80211/patches/ath/961-ath10k-limit-pci-buffer-size.patch
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b5e5c3a9bb00a407096936ece1916e331e0164f5
|
||||
--- /dev/null
|
||||
+++ b/package/kernel/mac80211/patches/ath/961-ath10k-limit-pci-buffer-size.patch
|
||||
@@ -0,0 +1,38 @@
|
||||
+--- a/drivers/net/wireless/ath/ath10k/pci.c
|
||||
++++ b/drivers/net/wireless/ath/ath10k/pci.c
|
||||
+@@ -131,7 +131,7 @@ static const struct ce_attr pci_host_ce_
|
||||
+ .flags = CE_ATTR_FLAGS,
|
||||
+ .src_nentries = 0,
|
||||
+ .src_sz_max = 2048,
|
||||
+- .dest_nentries = 512,
|
||||
++ .dest_nentries = 128,
|
||||
+ .recv_cb = ath10k_pci_htt_htc_rx_cb,
|
||||
+ },
|
||||
+
|
||||
+@@ -140,7 +140,7 @@ static const struct ce_attr pci_host_ce_
|
||||
+ .flags = CE_ATTR_FLAGS,
|
||||
+ .src_nentries = 0,
|
||||
+ .src_sz_max = 2048,
|
||||
+- .dest_nentries = 128,
|
||||
++ .dest_nentries = 64,
|
||||
+ .recv_cb = ath10k_pci_htc_rx_cb,
|
||||
+ },
|
||||
+
|
||||
+@@ -167,7 +167,7 @@ static const struct ce_attr pci_host_ce_
|
||||
+ .flags = CE_ATTR_FLAGS,
|
||||
+ .src_nentries = 0,
|
||||
+ .src_sz_max = 512,
|
||||
+- .dest_nentries = 512,
|
||||
++ .dest_nentries = 128,
|
||||
+ .recv_cb = ath10k_pci_htt_rx_cb,
|
||||
+ },
|
||||
+
|
||||
+@@ -192,7 +192,7 @@ static const struct ce_attr pci_host_ce_
|
||||
+ .flags = CE_ATTR_FLAGS,
|
||||
+ .src_nentries = 0,
|
||||
+ .src_sz_max = 2048,
|
||||
+- .dest_nentries = 128,
|
||||
++ .dest_nentries = 96,
|
||||
+ .recv_cb = ath10k_pci_pktlog_rx_cb,
|
||||
+ },
|
||||
+
|
|
@ -1,101 +0,0 @@
|
|||
From c50ece58c41647880cc74c927d98b465cdfbdad8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fabian=20Bl=C3=A4se?= <fabian@blaese.de>
|
||||
Date: Sun, 29 Aug 2021 21:21:35 +0200
|
||||
Subject: [PATCH] kernel: backport switchdev fix for bridge in bridge
|
||||
configurations
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This patch fixes the forwarding behavior of bridge in bridge
|
||||
configurations with DSA.
|
||||
|
||||
Without it, the configuration of the upper bridge might overwrite
|
||||
settings of the lower bridge. For example, a vlan-aware bridge
|
||||
with DSA interfaces in it might be offloaded to the DSA hardware. If the
|
||||
bridge interface itself gets slave of a different bridge without vlan
|
||||
filtering, the vlan filtering setting of the lower bridge is overwritten
|
||||
by the upper bridge, which results in an incorrect hardware
|
||||
configuration.
|
||||
|
||||
This was backported from kernel 5.7.
|
||||
|
||||
Ref: https://lore.kernel.org/netdev/20191222192235.GK25745@shell.armlinux.org.uk/
|
||||
Fixes: FS#3996
|
||||
Signed-off-by: Fabian Bläse <fabian@blaese.de>
|
||||
---
|
||||
...-not-propagate-bridge-updates-across.patch | 60 +++++++++++++++++++
|
||||
1 file changed, 60 insertions(+)
|
||||
create mode 100644 target/linux/generic/backport-5.4/790-v5.7-net-switchdev-do-not-propagate-bridge-updates-across.patch
|
||||
|
||||
diff --git a/target/linux/generic/backport-5.4/790-v5.7-net-switchdev-do-not-propagate-bridge-updates-across.patch b/target/linux/generic/backport-5.4/790-v5.7-net-switchdev-do-not-propagate-bridge-updates-across.patch
|
||||
new file mode 100644
|
||||
index 000000000000..bc8014b772f8
|
||||
--- /dev/null
|
||||
+++ b/target/linux/generic/backport-5.4/790-v5.7-net-switchdev-do-not-propagate-bridge-updates-across.patch
|
||||
@@ -0,0 +1,60 @@
|
||||
+From 07c6f9805f12f1bb538ef165a092b300350384aa Mon Sep 17 00:00:00 2001
|
||||
+From: Russell King <rmk+kernel@armlinux.org.uk>
|
||||
+Date: Wed, 26 Feb 2020 17:14:21 +0000
|
||||
+Subject: [PATCH] net: switchdev: do not propagate bridge updates across
|
||||
+ bridges
|
||||
+
|
||||
+When configuring a tree of independent bridges, propagating changes
|
||||
+from the upper bridge across a bridge master to the lower bridge
|
||||
+ports brings surprises.
|
||||
+
|
||||
+For example, a lower bridge may have vlan filtering enabled. It
|
||||
+may have a vlan interface attached to the bridge master, which may
|
||||
+then be incorporated into another bridge. As soon as the lower
|
||||
+bridge vlan interface is attached to the upper bridge, the lower
|
||||
+bridge has vlan filtering disabled.
|
||||
+
|
||||
+This occurs because switchdev recursively applies its changes to
|
||||
+all lower devices no matter what.
|
||||
+
|
||||
+Reviewed-by: Ido Schimmel <idosch@mellanox.com>
|
||||
+Tested-by: Ido Schimmel <idosch@mellanox.com>
|
||||
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
|
||||
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
+Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
+---
|
||||
+ net/switchdev/switchdev.c | 9 +++++++++
|
||||
+ 1 file changed, 9 insertions(+)
|
||||
+
|
||||
+diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
|
||||
+index 60630762a748b7..f25604d68337cf 100644
|
||||
+--- a/net/switchdev/switchdev.c
|
||||
++++ b/net/switchdev/switchdev.c
|
||||
+@@ -476,6 +476,9 @@ static int __switchdev_handle_port_obj_a
|
||||
+ * necessary to go through this helper.
|
||||
+ */
|
||||
+ netdev_for_each_lower_dev(dev, lower_dev, iter) {
|
||||
++ if (netif_is_bridge_master(lower_dev))
|
||||
++ continue;
|
||||
++
|
||||
+ err = __switchdev_handle_port_obj_add(lower_dev, port_obj_info,
|
||||
+ check_cb, add_cb);
|
||||
+ if (err && err != -EOPNOTSUPP)
|
||||
+@@ -528,6 +531,9 @@ static int __switchdev_handle_port_obj_d
|
||||
+ * necessary to go through this helper.
|
||||
+ */
|
||||
+ netdev_for_each_lower_dev(dev, lower_dev, iter) {
|
||||
++ if (netif_is_bridge_master(lower_dev))
|
||||
++ continue;
|
||||
++
|
||||
+ err = __switchdev_handle_port_obj_del(lower_dev, port_obj_info,
|
||||
+ check_cb, del_cb);
|
||||
+ if (err && err != -EOPNOTSUPP)
|
||||
+@@ -579,6 +585,9 @@ static int __switchdev_handle_port_attr_
|
||||
+ * necessary to go through this helper.
|
||||
+ */
|
||||
+ netdev_for_each_lower_dev(dev, lower_dev, iter) {
|
||||
++ if (netif_is_bridge_master(lower_dev))
|
||||
++ continue;
|
||||
++
|
||||
+ err = __switchdev_handle_port_attr_set(lower_dev, port_attr_info,
|
||||
+ check_cb, set_cb);
|
||||
+ if (err && err != -EOPNOTSUPP)
|
||||
--
|
||||
2.33.0
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
From: =?UTF-8?q?Fabian=20Bl=C3=A4se?= <fabian@blaese.de>
|
||||
Date: Sat, 23 Oct 2021 23:34:07 +0200
|
||||
Subject: [PATCH] mt7621: retain old compat_version
|
||||
|
||||
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
|
||||
index a3bc14d59d..99887e8192 100644
|
||||
--- a/target/linux/ramips/image/mt7621.mk
|
||||
+++ b/target/linux/ramips/image/mt7621.mk
|
||||
@@ -91,8 +91,7 @@ define Build/zytrx-header
|
||||
endef
|
||||
|
||||
define Device/dsa-migration
|
||||
- DEVICE_COMPAT_VERSION := 1.1
|
||||
- DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA
|
||||
+ DEVICE_COMPAT_VERSION := 1.0
|
||||
endef
|
||||
|
||||
define Device/adslr_g7
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
From f53b71d2907eeb0d80e79d99fa7b756b5e5bf32b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fabian=20Bl=C3=A4se?= <fabian@blaese.de>
|
||||
Date: Thu, 24 Feb 2022 00:04:47 +0100
|
||||
Subject: [PATCH] Add hack which fixes forwarding on a stacked bridge
|
||||
configuration using DSA
|
||||
|
||||
---
|
||||
.../hack-5.4/999-fix-stacked-bridge-forwarding.patch | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
create mode 100644 target/linux/generic/hack-5.4/999-fix-stacked-bridge-forwarding.patch
|
||||
|
||||
diff --git a/target/linux/generic/hack-5.4/999-fix-stacked-bridge-forwarding.patch b/target/linux/generic/hack-5.4/999-fix-stacked-bridge-forwarding.patch
|
||||
new file mode 100644
|
||||
index 0000000000..e1d4cb9cd5
|
||||
--- /dev/null
|
||||
+++ b/target/linux/generic/hack-5.4/999-fix-stacked-bridge-forwarding.patch
|
||||
@@ -0,0 +1,12 @@
|
||||
+--- a/net/bridge/br_input.c
|
||||
++++ b/net/bridge/br_input.c
|
||||
+@@ -52,6 +52,9 @@ static int br_pass_frame_up(struct sk_bu
|
||||
+ return NET_RX_DROP;
|
||||
+ }
|
||||
+
|
||||
++ /* remove offload flag, so upper bridges do not drop the packet */
|
||||
++ br_switchdev_frame_unmark(skb);
|
||||
++
|
||||
+ indev = skb->dev;
|
||||
+ skb->dev = brdev;
|
||||
+ skb = br_handle_vlan(br, NULL, vg, skb);
|
||||
--
|
||||
2.35.1
|
||||
|
11
buildscript
11
buildscript
|
@ -7,9 +7,9 @@ set -o pipefail
|
|||
builddir=./build
|
||||
|
||||
# OpenWrt: package hashes correspond to core repo version
|
||||
OPENWRTREV="v21.02.0"
|
||||
PACKAGEREV="65057dcbb5de371503c9159de3d45824bec482e0"
|
||||
ROUTINGREV="c30c9ffc93702365439a7647244a052531f2e957"
|
||||
OPENWRTREV="v21.02.2"
|
||||
PACKAGEREV="b0ccc356900f6e1e1dc613d0ea980d5572f553dd"
|
||||
ROUTINGREV="10d3ffd8b30186b49538167bac1fa1bf9c88f860"
|
||||
|
||||
# Gluon packages: master from 2020-02-04
|
||||
GLUONREV="12e41d0ff07ec54bbd67a31ab50d12ca04f2238c"
|
||||
|
@ -290,7 +290,8 @@ cp_firmware() {
|
|||
filename_build=${f##*/}
|
||||
filename_build=${filename_build//openwrt/fff-${version}}
|
||||
filename_build=${filename_build//squashfs-/}
|
||||
filename_build=${filename_build//${chipset}-${subtarget}-/}
|
||||
filename_build=${filename_build//${chipset}-/}
|
||||
filename_build=${filename_build//${subtarget}-/}
|
||||
cp "$f" "$imagedestpath/$filename_build"
|
||||
done
|
||||
done
|
||||
|
@ -316,7 +317,7 @@ buildrelease() {
|
|||
fi
|
||||
|
||||
cd bin/$variant
|
||||
for binary in *.bin; do
|
||||
for binary in *.bin *.img *.tar; do
|
||||
md5sum "$binary" > ./"$binary".md5
|
||||
sha256sum "$binary" > ./"$binary".sha256
|
||||
done
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-alfred-monitoring-proxy
|
||||
PKG_RELEASE:=5
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-alfred
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-babeld
|
||||
PKG_RELEASE:=8
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -38,10 +38,18 @@ babel_add_peeraddr() {
|
|||
uci add_list "$option"="$peer_ip"
|
||||
elif router_ip=$(uci -q get gateway.meta.router_ip); then
|
||||
# use router_ip if no peer_ip is set
|
||||
uci add_list "$option"="$router_ip"
|
||||
ip=$router_ip
|
||||
|
||||
# use only first ip
|
||||
ip=${ip%% *}
|
||||
|
||||
# remove CIDR mask
|
||||
ip=${ip%%/*}
|
||||
|
||||
uci add_list "$option"="$ip"
|
||||
elif ipaddr=$(uci -q get gateway.@client[0].ipaddr); then
|
||||
# use client interface address (without subnet) if no router_ip is set
|
||||
uci add_list "$option"=$(echo $ipaddr | cut -d / -f1)
|
||||
uci add_list "$option"=${ipaddr%%/*}
|
||||
else
|
||||
echo "WARNING: No peer_ip, router_ip or client interface ipaddr set! IPv4 routing is not possible."
|
||||
return 1
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
|
||||
SCRIPT_DATA_FILE=$(uci get nodewatcher.@script[0].data_file).json
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
json_load_file $SCRIPT_DATA_FILE
|
||||
|
||||
json_select babel
|
||||
|
||||
json_add_array "neighbours"
|
||||
|
||||
if pgrep babeld >/dev/null; then
|
||||
neighbours="$(echo dump | nc ::1 33123 | grep '^add neighbour' |
|
||||
awk '{
|
||||
for (i=2; i < NF; i += 2) {
|
||||
vars[$i] = $(i+1)
|
||||
}
|
||||
}
|
||||
{
|
||||
printf "%s;%s;%s;>", vars["address"], vars["if"], vars["cost"]
|
||||
}')"
|
||||
|
||||
IFS='>'; set $neighbours; IFS=$' \t\n'
|
||||
for a; do
|
||||
json_add_object
|
||||
json_add_string "ip" "$(echo $a | awk '{split($0, b, ";"); printf b[1]}')"
|
||||
json_add_string "outgoing_interface" "$(echo $a | awk '{split($0, b, ";"); printf b[2]}')"
|
||||
json_add_string "link_cost" "$(echo $a | awk '{split($0, b, ";"); printf b[3]}')"
|
||||
json_close_object #this_neighbour
|
||||
done
|
||||
fi
|
||||
|
||||
json_close_object #neighbours
|
||||
|
||||
json_dump > $SCRIPT_DATA_FILE
|
||||
|
||||
#exit 0
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-batman-adv
|
||||
PKG_RELEASE:=4
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-boardname
|
||||
PKG_RELEASE:=8
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-config
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
vm.panic_on_oom=1
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-dhcp
|
||||
PKG_RELEASE:=6
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
# Use a larger cachesize by default
|
||||
cachesize=1024
|
||||
|
||||
# Increase cachesize for systems with enough memory
|
||||
mem="$(awk '/^MemTotal:/ {print $2}' /proc/meminfo)"
|
||||
[ "$mem" -gt 65536 ] && cachesize=8192
|
||||
|
||||
uci batch >/dev/null <<EOF
|
||||
delete dhcp.@dnsmasq[0]
|
||||
delete dhcp.lan
|
||||
|
@ -12,6 +19,7 @@ uci batch >/dev/null <<EOF
|
|||
set dhcp.@dnsmasq[-1].domain='fff.community'
|
||||
set dhcp.@dnsmasq[-1].expandhosts='0'
|
||||
set dhcp.@dnsmasq[-1].nonegcache='0'
|
||||
set dhcp.@dnsmasq[-1].cachesize="$cachesize"
|
||||
set dhcp.@dnsmasq[-1].authoritative='1'
|
||||
set dhcp.@dnsmasq[-1].readethers='1'
|
||||
set dhcp.@dnsmasq[-1].leasefile='/tmp/dhcp.leases'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-fastd
|
||||
PKG_RELEASE:=3
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ ln -s /tmp/fastd_fff_peers /etc/fastd/fff/peers
|
|||
echo "#!/bin/sh" > /etc/fastd/fff/up.sh
|
||||
echo "ip link set up dev fffVPN" >> /etc/fastd/fff/up.sh
|
||||
echo "batctl if add fffVPN" >> /etc/fastd/fff/up.sh
|
||||
echo "batctl hardif fffVPN hop_penalty 30" >> /etc/fastd/fff/up.sh
|
||||
chmod +x /etc/fastd/fff/up.sh
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
protocol=fastd
|
||||
|
||||
fastd_clear() {
|
||||
rm /tmp/fastd_fff_peers/*
|
||||
}
|
||||
|
||||
fastd_addpeer() {
|
||||
[ -d /tmp/fastd_fff_peers ] || mkdir /tmp/fastd_fff_peers
|
||||
|
||||
# write fastd-config
|
||||
json_get_var servername name
|
||||
filename="/etc/fastd/fff/peers/$servername"
|
||||
echo "#name \"${servername}\";" > "$filename"
|
||||
json_get_var key key
|
||||
echo "key \"${key}\";" >> "$filename"
|
||||
json_get_var address address
|
||||
json_get_var port port
|
||||
echo "remote \"${address}\" port ${port};" >> "$filename"
|
||||
echo "" >> "$filename"
|
||||
echo "float yes;" >> "$filename"
|
||||
}
|
||||
|
||||
fastd_start_stop() {
|
||||
/etc/init.d/fastd reload # does nothing if fastd was not running
|
||||
|
||||
# fastd start/stop for various situations
|
||||
# this is needed for first start and if fastd comes up or disappears in hoodfile
|
||||
pidfile="/tmp/run/fastd.fff.pid"
|
||||
if [ "$(ls /etc/fastd/fff/peers/* 2>/dev/null)" ]; then
|
||||
([ -s "$pidfile" ] && [ -d "/proc/$(cat "$pidfile")" ]) || /etc/init.d/fastd start
|
||||
else
|
||||
([ -s "$pidfile" ] && [ -d "/proc/$(cat "$pidfile")" ]) && /etc/init.d/fastd stop
|
||||
fi
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-firewall
|
||||
PKG_RELEASE:=8
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
#solves MTU problem with bad ISPs
|
||||
iptables -A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
|
|
@ -1,5 +0,0 @@
|
|||
# Limit ssh to 6 new connections per 60 seconds
|
||||
/usr/sbin/ip6tables -A INPUT -p tcp --dport 22 -m conntrack --ctstate NEW -m recent --set --name dropbear
|
||||
/usr/sbin/ip6tables -A INPUT -p tcp --dport 22 -m conntrack --ctstate NEW -m recent --update --seconds 60 --hitcount 6 --rttl --name dropbear -j DROP
|
||||
/usr/sbin/iptables -A INPUT -p tcp --dport 22 -m conntrack --ctstate NEW -m recent --set --name dropbear
|
||||
/usr/sbin/iptables -A INPUT -p tcp --dport 22 -m conntrack --ctstate NEW -m recent --update --seconds 60 --hitcount 6 --rttl --name dropbear -j DROP
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-hoods
|
||||
PKG_RELEASE:=19
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-hoodutils
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-layer3-config
|
||||
PKG_RELEASE:=9
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ configure() {
|
|||
|
||||
# ip6addr
|
||||
#remove old ip6addr
|
||||
for ip in $(uci get network.client.ip6addr); do
|
||||
for ip in $(uci -q get network.client.ip6addr); do
|
||||
if echo "$ip" | grep -v -e "fdff:" -e "fe80::1/64" > /dev/null; then
|
||||
uci del_list network.client.ip6addr="$ip"
|
||||
fi
|
||||
|
@ -50,11 +50,10 @@ configure() {
|
|||
|
||||
# set interface
|
||||
#remove all eth interfaces
|
||||
ifaces=$(uci get network.client.ifname | sed 's/\beth[^ ]* *//g' | sed 's/\bswitch[^ ]* *//g')
|
||||
if vlan=$(uci -q get gateway.@client[0].vlan); then
|
||||
uci set network.client.ifname="${SWITCHDEV}.$vlan $ifaces"
|
||||
uci set network.client.ifname="${SWITCHDEV}.$vlan"
|
||||
elif iface=$(uci -q get gateway.@client[0].iface); then
|
||||
uci set network.client.ifname="$iface $ifaces"
|
||||
uci set network.client.ifname="$iface"
|
||||
else
|
||||
echo "WARNING: No Interface for client specified"
|
||||
fi
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-layer3-snat
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/fff-layer3-snat
|
||||
SECTION:=base
|
||||
CATEGORY:=Freifunk
|
||||
TITLE:=Freifunk-Franken layer3 configuration with SNAT
|
||||
URL:=https://www.freifunk-franken.de
|
||||
DEPENDS:= \
|
||||
+fff-firewall \
|
||||
+fff-layer3-config \
|
||||
+kmod-ipt-nat
|
||||
endef
|
||||
|
||||
define Package/fff-layer3-snat/description
|
||||
With this package it is possible to make SNAT with IPv4 on the router
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Package/fff-layer3-snat/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,fff-layer3-snat))
|
|
@ -0,0 +1,34 @@
|
|||
configure() {
|
||||
# first we delete the snat config
|
||||
uci -q del network.client.fff_snat
|
||||
uci -q del network.client.fff_snat_sourceip
|
||||
if [ "$(uci -q get gateway.@client[0].snat)" = '1' ]; then
|
||||
|
||||
# first check the config is plausible
|
||||
if ! routerip=$(uci -q get gateway.meta.router_ip); then
|
||||
echo "ERROR: No router_ip set, which is required for SNAT!"
|
||||
return 1
|
||||
fi
|
||||
if ! uci -q get gateway.@client[0].ipaddr >/dev/null; then
|
||||
echo "ERROR: No ipaddr set, which is required for SNAT!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# keep only the first IP
|
||||
routerip=${routerip%% *}
|
||||
# keep only the IP without the CIDR
|
||||
routerip=${routerip%%/*}
|
||||
|
||||
# We set the snat config
|
||||
uci set network.client.fff_snat=1
|
||||
uci set network.client.fff_snat_sourceip=$routerip
|
||||
fi
|
||||
}
|
||||
|
||||
apply() {
|
||||
uci commit network
|
||||
}
|
||||
|
||||
revert() {
|
||||
uci revert network
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
if [ "$(uci -q get network.client.fff_snat)" = '1' ]; then
|
||||
iptables -t mangle -A PREROUTING -i br-client -j MARK --set-mark 0x736e6174
|
||||
iptables -t nat -A POSTROUTING -m mark --mark 0x736e6174 -j SNAT --to-source $(uci -q get network.client.fff_snat_sourceip)
|
||||
fi
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-layer3
|
||||
PKG_RELEASE:=9
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
@ -15,6 +15,7 @@ define Package/fff-layer3
|
|||
+fff-boardname \
|
||||
+fff-dhcp \
|
||||
+fff-layer3-config \
|
||||
+fff-layer3-snat \
|
||||
+fff-mqtt-monitoring \
|
||||
+fff-network \
|
||||
+fff-ra \
|
||||
|
@ -36,6 +37,7 @@ define Package/fff-layer3
|
|||
+iptables-mod-ipopt \
|
||||
+iptables-mod-conntrack-extra \
|
||||
+mtr \
|
||||
+snmp-utils \
|
||||
+tc \
|
||||
+tcpdump \
|
||||
+vxlan
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-mqtt-monitoring
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/fff-mqtt-monitoring
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
*/5 * * * * sleep $(/usr/bin/random 70 85); /usr/sbin/json-mqtt-proxy
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
MACADDR=$(/bin/sed 's/://g' < /sys/class/net/br-client/address)
|
||||
SCRIPT_DATA_FILE=$(uci get nodewatcher.@script[0].data_file).json
|
||||
|
||||
if [ -n "$(uci -q get fff.mqtt.server)" ] ; then
|
||||
mosquitto_pub -h "$(uci get fff.mqtt.server)" -p 1883 -t /monitoring/v2/"$MACADDR" -f "$SCRIPT_DATA_FILE"
|
||||
fi
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-mqtt
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/fff-mqtt
|
||||
|
||||
|
@ -15,8 +15,7 @@ define Package/fff-mqtt
|
|||
DEPENDS:= \
|
||||
+fff-config \
|
||||
+libmosquitto-ssl \
|
||||
+mosquitto-client-ssl \
|
||||
+mosquitto-ssl
|
||||
+mosquitto-client-ssl
|
||||
endef
|
||||
|
||||
define Package/fff-mqtt/description
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-network
|
||||
PKG_RELEASE:=50
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
config globals 'globals'
|
||||
option packet_steering '1'
|
||||
|
||||
config interface 'loopback'
|
||||
option ifname 'lo'
|
||||
option proto 'static'
|
||||
option ipaddr '127.0.0.1'
|
||||
option netmask '255.0.0.0'
|
||||
|
||||
config interface 'client'
|
||||
option type 'bridge'
|
||||
option auto '1'
|
||||
|
||||
config interface 'wan'
|
||||
option proto 'none'
|
||||
option ifname 'eth2'
|
||||
|
||||
config interface 'wan4'
|
||||
option proto 'dhcp'
|
||||
option ifname '@wan'
|
||||
|
||||
config interface 'wan6'
|
||||
option proto 'dhcpv6'
|
||||
option reqprefix 'no'
|
||||
option sourcefilter '0'
|
||||
option ifname '@wan'
|
||||
|
||||
config interface 'ethmesh'
|
||||
option proto 'batadv_hardif'
|
||||
option master 'bat0'
|
|
@ -0,0 +1,141 @@
|
|||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
. /lib/functions/system.sh
|
||||
. /lib/functions/fff/network
|
||||
|
||||
BOARD="$(uci get board.model.name)"
|
||||
. /etc/network.$BOARD
|
||||
|
||||
[ -n "$ROUTERMAC" ] || ROUTERMAC=$(get_mac_label)
|
||||
|
||||
# Clear possibly existing network configuration
|
||||
> /etc/config/network
|
||||
|
||||
# Add basic network configuration
|
||||
uci batch <<-__EOF__
|
||||
set network.loopback='interface'
|
||||
set network.loopback.ifname='lo'
|
||||
set network.loopback.proto='static'
|
||||
set network.loopback.ipaddr='127.0.0.1'
|
||||
set network.loopback.netmask='255.0.0.0'
|
||||
|
||||
set network.client='interface'
|
||||
set network.client.type='bridge'
|
||||
set network.client.auto='1'
|
||||
|
||||
set network.wan='interface'
|
||||
set network.wan.proto='none'
|
||||
set network.wan.ifname="$WANDEV"
|
||||
|
||||
set network.wan4='interface'
|
||||
set network.wan4.proto='dhcp'
|
||||
set network.wan4.ifname='@wan'
|
||||
|
||||
set network.wan6='interface'
|
||||
set network.wan6.proto='dhcpv6'
|
||||
set network.wan6.reqprefix='no'
|
||||
set network.wan6.sourcefilter='0'
|
||||
set network.wan6.ifname='@wan'
|
||||
|
||||
set network.ethmesh='interface'
|
||||
set network.ethmesh.proto='batadv_hardif'
|
||||
set network.ethmesh.master='bat0'
|
||||
__EOF__
|
||||
|
||||
SWITCHHW=$(swconfig list | awk '{ print $4 }')
|
||||
if [ "$DSA" = "1" ]; then
|
||||
uci batch <<-__EOF__
|
||||
set network.$SWITCHDEV=device
|
||||
set network.$SWITCHDEV.name=$SWITCHDEV
|
||||
set network.$SWITCHDEV.type=bridge
|
||||
# temporary workaround for netifd bug present in OpenWrt 21.02.0 (FS#4104)
|
||||
set network.$SWITCHDEV.bridge_empty='1'
|
||||
|
||||
set network.${SWITCHDEV}_1=bridge-vlan
|
||||
set network.${SWITCHDEV}_1.device=$SWITCHDEV
|
||||
set network.${SWITCHDEV}_1.vlan=1
|
||||
set network.${SWITCHDEV}_1.ports="$CLIENT_PORTS"
|
||||
|
||||
set network.${SWITCHDEV}_3=bridge-vlan
|
||||
set network.${SWITCHDEV}_3.device=$SWITCHDEV
|
||||
set network.${SWITCHDEV}_3.vlan=3
|
||||
set network.${SWITCHDEV}_3.ports="$BATMAN_PORTS"
|
||||
__EOF__
|
||||
|
||||
if [ "$WANDEV" = "$SWITCHDEV" ] || ! [ -z "$WAN_PORTS" ]; then
|
||||
uci batch <<-__EOF__
|
||||
set network.${SWITCHDEV}_2=bridge-vlan
|
||||
set network.${SWITCHDEV}_2.device=$SWITCHDEV
|
||||
set network.${SWITCHDEV}_2.vlan=2
|
||||
set network.${SWITCHDEV}_2.ports="$WAN_PORTS"
|
||||
__EOF__
|
||||
fi
|
||||
elif [ -n "$SWITCHHW" ]; then
|
||||
uci batch <<-__EOF__
|
||||
set network.$SWITCHDEV=switch
|
||||
set network.$SWITCHDEV.name=$SWITCHHW
|
||||
set network.$SWITCHDEV.enable=1
|
||||
set network.$SWITCHDEV.reset=1
|
||||
set network.$SWITCHDEV.enable_vlan=1
|
||||
|
||||
set network.${SWITCHDEV}_1=switch_vlan
|
||||
set network.${SWITCHDEV}_1.device=$SWITCHHW
|
||||
set network.${SWITCHDEV}_1.vlan=1
|
||||
set network.${SWITCHDEV}_1.ports="$CLIENT_PORTS"
|
||||
|
||||
set network.${SWITCHDEV}_3=switch_vlan
|
||||
set network.${SWITCHDEV}_3.device=$SWITCHHW
|
||||
set network.${SWITCHDEV}_3.vlan=3
|
||||
set network.${SWITCHDEV}_3.ports="$BATMAN_PORTS"
|
||||
__EOF__
|
||||
|
||||
if [ "$WANDEV" = "$SWITCHDEV" ] || [ -n "$WAN_PORTS" ]; then
|
||||
uci batch <<-__EOF__
|
||||
set network.${SWITCHDEV}_2=switch_vlan
|
||||
set network.${SWITCHDEV}_2.device=$SWITCHHW
|
||||
set network.${SWITCHDEV}_2.vlan=2
|
||||
set network.${SWITCHDEV}_2.ports="$WAN_PORTS"
|
||||
__EOF__
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$SWITCHHW" ] || [ "$DSA" = "1" ]; then
|
||||
uci set network.client.ifname="$SWITCHDEV.1 bat0"
|
||||
uci set network.ethmesh.ifname="$SWITCHDEV.3"
|
||||
|
||||
if [ "$WANDEV" = "$SWITCHDEV" ]; then
|
||||
uci set network.wan.ifname=$WANDEV.2
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$ETHMESHMAC" ]; then
|
||||
uci set network.ethmesh.macaddr=$ETHMESHMAC
|
||||
fi
|
||||
|
||||
if [ -n "$ROUTERMAC" ]; then
|
||||
uci set network.client.macaddr=$ROUTERMAC
|
||||
fi
|
||||
|
||||
|
||||
prefix="fdff::/64"
|
||||
|
||||
# Set $prefix::1 as IP
|
||||
addr1=$(owipcalc "$prefix" add ::1)
|
||||
# Set $prefix::MAC as IP
|
||||
addr2=$(owipcalc "$prefix" add "::$(ipMacSuffix "$ROUTERMAC")")
|
||||
# Set $prefix::EUI64 as IP
|
||||
addr3=$(owipcalc "$prefix" add "::$(ipEUISuffix "$ROUTERMAC")")
|
||||
|
||||
uci batch <<-__EOF__
|
||||
del network.globals
|
||||
set network.globals=globals
|
||||
set network.globals.ula_prefix=$prefix
|
||||
add_list network.client.ip6addr=$addr1
|
||||
add_list network.client.ip6addr=$addr2
|
||||
add_list network.client.ip6addr=$addr3
|
||||
set network.client.proto=static
|
||||
__EOF__
|
||||
|
||||
|
||||
uci -q commit network
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Enable RPS
|
||||
uci batch <<-__EOF__
|
||||
set network.globals=globals
|
||||
set network.globals.packet_steering='1'
|
||||
__EOF__
|
||||
|
||||
uci -q commit network
|
|
@ -0,0 +1,100 @@
|
|||
#!/bin/sh
|
||||
|
||||
IFACEBLACKLIST=$(uci get nodewatcher.@network[0].iface_blacklist)
|
||||
IPWHITELIST=$(uci get nodewatcher.@network[0].ip_whitelist)
|
||||
|
||||
debug() {
|
||||
(>&2 echo "nodewatcher: $1")
|
||||
}
|
||||
|
||||
inArray() {
|
||||
local value
|
||||
for value in $1; do
|
||||
[ "$value" = "$2" ] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
debug "Collecting information from network interfaces"
|
||||
|
||||
SCRIPT_DATA_FILE=$(uci get nodewatcher.@script[0].data_file).json
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
json_load_file $SCRIPT_DATA_FILE
|
||||
|
||||
json_add_array "interfaces"
|
||||
|
||||
# Loop through interfaces: for entry in $IFACES; do
|
||||
for filename in $(grep 'up\|unknown' /sys/class/net/*/operstate); do
|
||||
ifpath=${filename%/operstate*}
|
||||
iface=${ifpath#/sys/class/net/}
|
||||
|
||||
inArray "$IFACEBLACKLIST" "$iface" && continue
|
||||
|
||||
json_add_object ""
|
||||
|
||||
json_add_string "name" "$iface"
|
||||
|
||||
#Get interface data for whitelisted interfaces
|
||||
# shellcheck disable=SC2016
|
||||
mac_addr=$(ip addr show dev $iface | awk '/ether/ { printf $2 }')
|
||||
json_add_string "mac_addr" "$mac_addr"
|
||||
mtu=$(ip addr show dev $iface | awk '/mtu/ { printf $5 }')
|
||||
json_add_string "mtu" "$mtu"
|
||||
|
||||
if inArray "$IPWHITELIST" "$iface"; then
|
||||
# shellcheck disable=SC2016
|
||||
json_add_array ipv4_addr
|
||||
IN=$(ip addr show dev $iface | awk '/inet / { split($2, a, "/"); printf a[1]";" }')
|
||||
IFS=';'; set $IN; IFS=$' \t\n'
|
||||
for a; do json_add_string "" "$a"; done
|
||||
json_close_object #ipv4_addr
|
||||
|
||||
json_add_array ipv6_addr
|
||||
IN=$(ip addr show dev $iface | awk '/inet6/ && /scope global/ { printf $2";" }')
|
||||
IFS=';'; set $IN; IFS=$' \t\n'
|
||||
for a; do json_add_string "" "$a"; done
|
||||
json_close_object #ipv6_addr
|
||||
|
||||
json_add_array ipv6_link_local_addr
|
||||
IN=$(ip addr show dev $iface | awk '/inet6/ && /scope link/ { printf $2 }')
|
||||
IFS=';'; set $IN; IFS=$' \t\n'
|
||||
for a; do json_add_string "" "$a"; done
|
||||
json_close_object #ipv6_link_local_addr
|
||||
fi
|
||||
|
||||
json_add_object "traffic"
|
||||
traffic_rx=$(cat "$ifpath/statistics/rx_bytes")
|
||||
json_add_string "rx" "$(cat "$ifpath/statistics/rx_bytes")"
|
||||
traffic_tx=$(cat "$ifpath/statistics/tx_bytes")
|
||||
json_add_string "tx" "$traffic_tx"
|
||||
json_close_object #traffic
|
||||
|
||||
wlan_mode=$(iwconfig $iface 2>/dev/null | awk -F':' '/Mode/{ split($2, m, " "); printf m[1] }')
|
||||
if [[ $wlan_mode ]]; then
|
||||
json_add_object "wlan"
|
||||
wlan_cell=$(iwconfig $iface 2>/dev/null | awk -F':' '/Cell/{ split($0, c, " "); printf c[5] }')
|
||||
wlan_essid=$(iwconfig $iface 2>/dev/null | awk -F':' '/ESSID/ { split($0, e, "\""); printf e[2] }')
|
||||
wlan_frequency=$(iwconfig $iface 2>/dev/null | awk -F':' '/Freq/{ split($3, f, " "); printf f[1]f[2] }')
|
||||
wlan_tx_power=$(iwconfig $iface 2>/dev/null | awk -F':' '/Tx-Power/{ split($0, p, "="); sub(/[[:space:]]*$/, "", p[2]); printf p[2] }')
|
||||
wlan_ssid=$(iw dev $iface info 2>/dev/null | awk '/ssid/{ split($0, s, " "); printf s[2]}')
|
||||
wlan_type=$(iw dev $iface info 2>/dev/null | awk '/type/ { split($0, t, " "); printf t[2]}')
|
||||
wlan_channel=$(iw dev $iface info 2>/dev/null | awk '/channel/{ split($0, c, " "); printf c[2]}')
|
||||
wlan_width=$(iw dev $iface info 2>/dev/null | awk '/width/{ split($0, w, ": "); sub(/ .*/, "", w[2]); printf w[2]}')
|
||||
[[ $wlan_mode ]] && json_add_string "mode" "$wlan_mode"
|
||||
[[ $wlan_cell ]] && json_add_string "cell" "$wlan_cell"
|
||||
[[ $wlan_essid ]] && json_add_string "essid" "$wlan_essid"
|
||||
[[ $wlan_frequency ]] && json_add_string "frequency" "$wlan_frequency"
|
||||
[[ "$wlan_tx_power" ]] && json_add_string "tx_power" "$wlan_tx_power"
|
||||
[[ $wlan_ssid ]] && json_add_string "ssid" "$wlan_ssid"
|
||||
[[ $wlan_type ]] && json_add_string "type" "$wlan_type"
|
||||
[[ $wlan_channel ]] && json_add_string "channel" "$wlan_channel"
|
||||
[[ $wlan_width ]] && json_add_string "width" "$wlan_width"
|
||||
json_close_object #wlan
|
||||
fi
|
||||
|
||||
json_close_object #iface object
|
||||
done
|
||||
|
||||
json_dump > $SCRIPT_DATA_FILE
|
||||
#exit 0
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/sh
|
||||
|
||||
MESH_INTERFACE=$(uci get nodewatcher.@network[0].mesh_interface)
|
||||
SCRIPT_DATA_FILE=$(uci get nodewatcher.@script[0].data_file).json
|
||||
|
||||
debug() {
|
||||
(>&2 echo "nodewatcher: $1")
|
||||
}
|
||||
|
||||
debug "Collecting information about connected clients"
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
json_load_file $SCRIPT_DATA_FILE
|
||||
|
||||
json_add_object "clients"
|
||||
|
||||
json_add_array interfaces
|
||||
|
||||
client_count=0
|
||||
CLIENT_INTERFACES=$(ls "/sys/class/net/$MESH_INTERFACE/brif" | grep -v '^bat')
|
||||
|
||||
for clientif in ${CLIENT_INTERFACES}; do
|
||||
json_add_object ""
|
||||
cc=$(bridge fdb show br "$MESH_INTERFACE" brport "$clientif" | grep -v self | grep -v permanent -c)
|
||||
client_count=$((client_count + cc))
|
||||
json_add_string "$clientif" "$cc"
|
||||
json_close_object #iface object
|
||||
done
|
||||
|
||||
json_close_object #interfaces array
|
||||
json_add_string "count" "$client_count"
|
||||
json_close_object #clients
|
||||
|
||||
json_dump > $SCRIPT_DATA_FILE
|
||||
|
||||
#exit 0
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
BOARD="$(uci get board.model.name)"
|
||||
. /etc/network.$BOARD
|
||||
[ -n "$ROUTERMAC" ] || ROUTERMAC=$(get_mac_label)
|
||||
|
||||
if [ -s /etc/network.config ] ; then
|
||||
. /etc/network.config
|
||||
|
@ -105,109 +104,6 @@ elif [ "$TWO_PORT" = "YES" ]; then
|
|||
|
||||
uci commit network
|
||||
fi
|
||||
else
|
||||
if ! uci -q get network.$SWITCHDEV > /dev/null ; then
|
||||
|
||||
if [ "$DSA" = "1" ]; then
|
||||
uci set network.$SWITCHDEV=device
|
||||
uci set network.$SWITCHDEV.name=$SWITCHDEV
|
||||
uci set network.$SWITCHDEV.type=bridge
|
||||
# temporary workaround for netifd bug present in OpenWrt 21.02.0 (FS#4104)
|
||||
uci set network.$SWITCHDEV.bridge_empty='1'
|
||||
|
||||
uci set network.${SWITCHDEV}_1=bridge-vlan
|
||||
uci set network.${SWITCHDEV}_1.device=$SWITCHDEV
|
||||
uci set network.${SWITCHDEV}_1.vlan=1
|
||||
uci set network.${SWITCHDEV}_1.ports="$CLIENT_PORTS"
|
||||
|
||||
if [ "$WANDEV" = "$SWITCHDEV" ] || ! [ -z "$WAN_PORTS" ]; then
|
||||
uci set network.${SWITCHDEV}_2=bridge-vlan
|
||||
uci set network.${SWITCHDEV}_2.device=$SWITCHDEV
|
||||
uci set network.${SWITCHDEV}_2.vlan=2
|
||||
uci set network.${SWITCHDEV}_2.ports="$WAN_PORTS"
|
||||
fi
|
||||
|
||||
uci set network.${SWITCHDEV}_3=bridge-vlan
|
||||
uci set network.${SWITCHDEV}_3.device=$SWITCHDEV
|
||||
uci set network.${SWITCHDEV}_3.vlan=3
|
||||
uci set network.${SWITCHDEV}_3.ports="$BATMAN_PORTS"
|
||||
else
|
||||
SWITCHHW=$(swconfig list | awk '{ print $4 }')
|
||||
|
||||
uci set network.$SWITCHDEV=switch
|
||||
uci set network.$SWITCHDEV.name=$SWITCHHW
|
||||
uci set network.$SWITCHDEV.enable=1
|
||||
uci set network.$SWITCHDEV.reset=1
|
||||
uci set network.$SWITCHDEV.enable_vlan=1
|
||||
|
||||
uci set network.${SWITCHDEV}_1=switch_vlan
|
||||
uci set network.${SWITCHDEV}_1.device=$SWITCHHW
|
||||
uci set network.${SWITCHDEV}_1.vlan=1
|
||||
uci set network.${SWITCHDEV}_1.ports="$CLIENT_PORTS"
|
||||
|
||||
if [ "$WANDEV" = "$SWITCHDEV" ] || [ -n "$WAN_PORTS" ]; then
|
||||
uci set network.${SWITCHDEV}_2=switch_vlan
|
||||
uci set network.${SWITCHDEV}_2.device=$SWITCHHW
|
||||
uci set network.${SWITCHDEV}_2.vlan=2
|
||||
uci set network.${SWITCHDEV}_2.ports="$WAN_PORTS"
|
||||
fi
|
||||
|
||||
uci set network.${SWITCHDEV}_3=switch_vlan
|
||||
uci set network.${SWITCHDEV}_3.device=$SWITCHHW
|
||||
uci set network.${SWITCHDEV}_3.vlan=3
|
||||
uci set network.${SWITCHDEV}_3.ports="$BATMAN_PORTS"
|
||||
fi
|
||||
|
||||
uci set network.client.ifname="$SWITCHDEV.1 bat0"
|
||||
|
||||
uci set network.ethmesh.ifname="$SWITCHDEV.3"
|
||||
|
||||
if [ "$WANDEV" = "$SWITCHDEV" ]; then
|
||||
uci set network.wan.ifname=$WANDEV.2
|
||||
else
|
||||
uci set network.wan.ifname=$WANDEV
|
||||
fi
|
||||
|
||||
uci commit network
|
||||
fi
|
||||
fi
|
||||
|
||||
/etc/init.d/network restart
|
||||
|
||||
if [ -n "$ETHMESHMAC" ]; then
|
||||
if uci get network.ethmesh.macaddr
|
||||
then
|
||||
echo "MAC for ethmesh is set already"
|
||||
else
|
||||
echo "Fixing MAC on $SWITCHDEV.3 (ethmesh)"
|
||||
sleep 10
|
||||
|
||||
uci set network.ethmesh.macaddr=$ETHMESHMAC
|
||||
uci commit network
|
||||
|
||||
ifconfig $SWITCHDEV.3 down
|
||||
ifconfig $SWITCHDEV.3 hw ether $ETHMESHMAC
|
||||
ifconfig $SWITCHDEV.3 up
|
||||
/etc/init.d/network restart
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$ROUTERMAC" ]; then
|
||||
if uci get network.client.macaddr
|
||||
then
|
||||
echo "MAC for client is set already"
|
||||
else
|
||||
echo "Fixing MAC on br-client"
|
||||
sleep 10
|
||||
|
||||
uci set network.client.macaddr=$ROUTERMAC
|
||||
uci commit network
|
||||
|
||||
ifconfig br-client down
|
||||
ifconfig br-client hw ether $ROUTERMAC
|
||||
ifconfig br-client up
|
||||
/etc/init.d/network restart
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$ETH0MAC" ]; then
|
||||
|
@ -216,44 +112,6 @@ if [ -n "$ETH0MAC" ]; then
|
|||
NEW_MACADDR=$(cat "/sys/class/net/${ETH0MAC}/address")
|
||||
uci set network.$ETH0DEV.macaddr=$NEW_MACADDR
|
||||
uci commit network
|
||||
ifconfig $ETH0DEV down
|
||||
ifconfig $ETH0DEV hw ether $NEW_MACADDR
|
||||
ifconfig $ETH0DEV up
|
||||
/etc/init.d/network restart
|
||||
fi
|
||||
|
||||
if uci -q get "network.client.ip6addr" > /dev/null
|
||||
then
|
||||
echo "IPv6 for client is set already"
|
||||
else
|
||||
echo "Setting IPv6 addresses"
|
||||
# Some time needed :(
|
||||
sleep 5
|
||||
|
||||
for ip in $(ip -6 addr show br-client | awk '/fdff/{ print $2 }'); do
|
||||
ip -6 addr del $ip dev br-client
|
||||
done
|
||||
|
||||
prefix="fdff::/64"
|
||||
# Set $prefix::MAC as IP
|
||||
addr=$(owipcalc "$prefix" add "::$(ipMacSuffix "$ROUTERMAC")")
|
||||
ip -6 addr add $addr dev br-client
|
||||
|
||||
uci -q set network.globals.ula_prefix=$prefix
|
||||
uci -q add_list network.client.ip6addr=$addr
|
||||
uci -q set network.client.proto=static
|
||||
|
||||
# Set $prefix::1 as IP
|
||||
addr=$(owipcalc "$prefix" add ::1)
|
||||
ip -6 addr add $addr dev br-client
|
||||
uci -q add_list network.client.ip6addr=$addr
|
||||
|
||||
# Set $prefix::link-local as IP
|
||||
addr=$(owipcalc "$prefix" add "::$(ipEUISuffix "$ROUTERMAC")")
|
||||
ip -6 addr add $addr dev br-client
|
||||
uci -q add_list network.client.ip6addr=$addr
|
||||
|
||||
uci -q commit network
|
||||
|
||||
[ -s /etc/init.d/fff-uradvd ] && /etc/init.d/fff-uradvd restart
|
||||
fi
|
||||
reload_config
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-node
|
||||
PKG_RELEASE:=3
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
@ -12,6 +12,7 @@ define Package/fff-node
|
|||
URL:=https://www.freifunk-franken.de
|
||||
DEPENDS:=+fff-batman-adv \
|
||||
+fff-fastd \
|
||||
+fff-vxlan-node-vpn \
|
||||
+fff-firewall \
|
||||
+fff-hoods \
|
||||
+fff-uradvd
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
*/5 * * * * sleep $(/usr/bin/random 0 29); /usr/sbin/nodewatcher-json
|
|
@ -0,0 +1,145 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
json_init
|
||||
|
||||
SCRIPT_STATUS_FILE=$(uci get nodewatcher.@script[0].status_text_file)
|
||||
SCRIPT_VERSION=$(cat /etc/nodewatcher_version)
|
||||
SCRIPT_DATA_FILE=$(uci get nodewatcher.@script[0].data_file).json
|
||||
|
||||
debug() {
|
||||
(>&2 echo "nodewatcher: $1")
|
||||
}
|
||||
|
||||
debug "Collecting basic system status data"
|
||||
|
||||
json_add_object "system"
|
||||
|
||||
json_add_string "status" "online"
|
||||
hostname="$(cat /proc/sys/kernel/hostname)"
|
||||
mac=$(awk '{ mac=toupper($1); gsub(":", "", mac); print mac }' /sys/class/net/br-client/address 2>/dev/null)
|
||||
|
||||
[ "$hostname" = "OpenWrt" ] && hostname="$mac"
|
||||
[ "$hostname" = "FFF" ] && hostname="$mac"
|
||||
|
||||
json_add_string "hostname" "$hostname"
|
||||
|
||||
description="$(uci -q get fff.system.description)"
|
||||
[ -n "$description" ] && json_add_string "description" "$description"
|
||||
|
||||
latitude="$(uci -q get fff.system.latitude)"
|
||||
longitude="$(uci -q get fff.system.longitude)"
|
||||
if [ -n "$longitude" -a -n "$latitude" ]; then
|
||||
json_add_object "geo"
|
||||
json_add_string "lat" "$latitude"
|
||||
json_add_string "lng" "$longitude"
|
||||
json_close_object #geo
|
||||
fi
|
||||
|
||||
position_comment="$(uci -q get fff.system.position_comment)"
|
||||
[ -n "$position_comment" ] && json_add_string "position_comment" "$position_comment"
|
||||
|
||||
contact="$(uci -q get fff.system.contact)"
|
||||
[ -n "$contact" ] && json_add_string "contact" "$contact"
|
||||
|
||||
json_add_string "uptime" $(awk '{ printf $1 }' /proc/uptime)
|
||||
json_add_string "idletime" $(awk '{ printf $2 }' /proc/uptime)
|
||||
|
||||
# Add Memory
|
||||
json_add_object "memory"
|
||||
json_add_string "total" $(awk '/^MemTotal/ { printf $2 }' /proc/meminfo)
|
||||
json_add_string "available" $(awk '/^MemAvail/ { printf $2 }' /proc/meminfo)
|
||||
json_add_string "caching" $(awk '/^Cached/ { printf $2 }' /proc/meminfo)
|
||||
json_add_string "buffering" $(awk '/^Buffers/ { printf $2 }' /proc/meminfo)
|
||||
json_add_string "free" $(awk '/^MemFree/ { printf $2 }' /proc/meminfo)
|
||||
json_close_object #memory
|
||||
|
||||
# Add CPU
|
||||
json_add_array cpu
|
||||
IN=$(awk -F': ' ' /model/ { printf $2";" }' /proc/cpuinfo)
|
||||
IFS=';'; set $IN; IFS=$' \t\n'
|
||||
for a; do json_add_string "" "$a"; done
|
||||
json_close_object #cpu
|
||||
|
||||
# Add Chipset
|
||||
IN=$(awk -F': ' ' /system type/ { printf $2";" }' /proc/cpuinfo)
|
||||
IFS=';'; set $IN; IFS=$' \t\n'
|
||||
for a; do json_add_string "chipset" "$a"; done
|
||||
|
||||
IN=$(awk -F': ' ' /platform/ { printf $2";" }' /proc/cpuinfo)
|
||||
IFS=';'; set $IN; IFS=$' \t\n'
|
||||
for a; do json_add_string "chipset" "$a"; done
|
||||
|
||||
model=$(cat /var/sysinfo/model)
|
||||
[ -n "$model" ] && json_add_string "model" "$model"
|
||||
local_time=$(date +%s)
|
||||
[ -n "$local_time" ] && json_add_string "local_time" "$local_time"
|
||||
loadavg=$(awk '{ printf $3 }' /proc/loadavg)
|
||||
[ -n "$loadavg" ] && json_add_string "loadavg" "$loadavg"
|
||||
processes=$(awk '{ printf $4 }' /proc/loadavg)
|
||||
[ -n "$processes" ] && json_add_string "processes" "$processes"
|
||||
|
||||
debug "Collecting version information"
|
||||
json_close_object #system
|
||||
|
||||
if [ -e /sys/module/batman_adv/version ]; then
|
||||
batman_advanced_version=$(cat /sys/module/batman_adv/version)
|
||||
json_add_object "batman_advanced"
|
||||
json_add_string "version" "$batman_advanced_version"
|
||||
json_close_object #batman_advanced
|
||||
fi
|
||||
|
||||
json_select system
|
||||
json_add_string "kernel_version" "$(uname -r)"
|
||||
json_add_string "nodewatcher_version" "$SCRIPT_VERSION"
|
||||
|
||||
if [ -x /usr/bin/fastd ]; then
|
||||
json_add_string "fastd_version" "$(/usr/bin/fastd -v | awk '{ print $2 }')"
|
||||
fi
|
||||
|
||||
json_close_object #system
|
||||
|
||||
if [ -x /usr/sbin/babeld ]; then
|
||||
json_add_object "babel"
|
||||
json_add_string "version" "$(/usr/sbin/babeld -V 2>&1)"
|
||||
json_close_object #babel
|
||||
fi
|
||||
|
||||
json_select system
|
||||
json_add_object "dist"
|
||||
. /etc/openwrt_release
|
||||
json_add_string "name" "$DISTRIB_ID"
|
||||
json_add_string "version" "$DISTRIB_RELEASE"
|
||||
json_close_object #dist
|
||||
|
||||
json_add_object "firmware"
|
||||
. /etc/firmware_release
|
||||
json_add_string "version" "$FIRMWARE_VERSION"
|
||||
json_add_string "revision" "$BUILD_DATE"
|
||||
json_add_object "openwrt"
|
||||
json_add_string "core_revision" "$OPENWRT_CORE_REVISION"
|
||||
json_add_string "feeds_packages_revision" "$OPENWRT_FEEDS_PACKAGES_REVISION"
|
||||
json_close_object #openwrt
|
||||
json_close_object #firmware
|
||||
|
||||
debug "Collecting hood information and additional status data"
|
||||
|
||||
json_add_object "hood"
|
||||
hoodname="$(uci -q get "system.@system[0].hood")"
|
||||
[ -n "$hoodname" ] && json_add_string "name" "$hoodname"
|
||||
hoodid="$(uci -q get "system.@system[0].hoodid")"
|
||||
[ -n "$hoodid" ] && json_add_string "id" "$hoodid"
|
||||
json_close_object #hood
|
||||
|
||||
if [ -s "$SCRIPT_STATUS_FILE" ]; then
|
||||
status_text="$(cat "$SCRIPT_STATUS_FILE")"
|
||||
json_add_string "status_text" "$status_text"
|
||||
fi
|
||||
|
||||
# Checks if fastd is running
|
||||
vpn_active=0
|
||||
pidof fastd >/dev/null && vpn_active=1
|
||||
json_add_string "vpn_active" "$vpn_active"
|
||||
|
||||
json_dump > $SCRIPT_DATA_FILE
|
||||
#exit 0
|
|
@ -0,0 +1,45 @@
|
|||
#!/bin/sh
|
||||
|
||||
test -f /tmp/started || exit
|
||||
|
||||
# Allow only one instance
|
||||
lockfile="/var/lock/${0##*/}.json.lock"
|
||||
if ! lock -n "$lockfile"; then
|
||||
echo "Only one instance of $0 allowed."
|
||||
exit 1
|
||||
fi
|
||||
trap "lock -u \"$lockfile\"" INT TERM EXIT
|
||||
|
||||
[ -s /etc/config/nodewatcher ] || exit 1
|
||||
[ "$(uci get nodewatcher.@script[0].disabled)" = "1" ] && exit 0
|
||||
|
||||
SCRIPT_DATA_FILE=$(uci get nodewatcher.@script[0].data_file).json
|
||||
|
||||
debug() {
|
||||
(>&2 echo "nodewatcher: $1")
|
||||
}
|
||||
|
||||
#This method generates the crawl data JSON file that is being fetched by netmon
|
||||
#and provided by a small local httpd
|
||||
crawl() {
|
||||
debug "Putting all information into a JSON-File and save it at $SCRIPT_DATA_FILE"
|
||||
|
||||
for f in /usr/lib/nodewatcher-json.d/*.sh; do
|
||||
tmp="$($f)"
|
||||
if [ $? -ne 0 ]; then
|
||||
debug "Error when executing subscript $f, exiting!"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
SCRIPT_DATA_DIR=$(dirname "$SCRIPT_DATA_FILE")
|
||||
test -d "$SCRIPT_DATA_DIR" || mkdir -p "$SCRIPT_DATA_DIR"
|
||||
}
|
||||
|
||||
LANG=C
|
||||
|
||||
#Erzeugt die statusdaten
|
||||
debug "Generate actual status data"
|
||||
crawl
|
||||
|
||||
exit 0
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-ra
|
||||
PKG_RELEASE:=3
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-random
|
||||
PKG_RELEASE:=3
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -0,0 +1,143 @@
|
|||
#!/bin/sh
|
||||
. /lib/functions.sh
|
||||
SCRIPT_DATA_FILE=$(uci get nodewatcher.@script[0].data_file).json
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
json_load_file $SCRIPT_DATA_FILE
|
||||
|
||||
json_add_array "s2nproxy"
|
||||
|
||||
# Example for /etc/config/s2nproxy
|
||||
#
|
||||
# config s2nproxy 'DEVICE_NAME'
|
||||
# option ip 'IP_ADDRESS'
|
||||
# option device 'DEVICE_TYPE'
|
||||
# option community 'COMMUNITY'
|
||||
|
||||
# SNMP Walk
|
||||
walk() {
|
||||
community=$1
|
||||
ip=$2
|
||||
oid=$3
|
||||
echo $(snmpwalk -O vQ -P e -L n -v 1 -c $community $ip $oid)
|
||||
}
|
||||
|
||||
# Format the dirty mikrotik mac address result
|
||||
format_mac() {
|
||||
echo $(echo $1 | xargs | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//' | sed 's/\ /\:/g')
|
||||
}
|
||||
|
||||
s2np() {
|
||||
if [ -z "$(uci -q get s2nproxy.$1.community)" ]; then
|
||||
community="public"
|
||||
else
|
||||
community=$(uci get s2nproxy.$1.community)
|
||||
fi
|
||||
|
||||
ip=$(uci get s2nproxy.$1.ip)
|
||||
|
||||
# Check if host is available
|
||||
if ping -c 1 -W 1 $ip &> /dev/null ; then
|
||||
json_add_object
|
||||
json_add_string "ip" "$ip"
|
||||
|
||||
# Switch throught device types
|
||||
case "$(uci -q get s2nproxy.$1.device)" in
|
||||
airmaxac)
|
||||
# Ubiquity AirMAX Richtfunk
|
||||
name=$(walk $community $ip "iso.3.6.1.2.1.1.5.0" | xargs)
|
||||
mac=$(format_mac "$(walk $community $ip 1.3.6.1.2.1.2.2.1.6.8)")
|
||||
hw=$(walk $community $ip "iso.3.6.1.4.1.41112.1.4.1.1.9.1" | xargs)
|
||||
signal=$(walk $community $ip "iso.3.6.1.4.1.41112.1.4.5.1.5")
|
||||
capacity=$(walk $community $ip "iso.3.6.1.4.1.41112.1.4.5.1.10" / 1024)
|
||||
capacity=$(printf %.2f "$((10**9 * $capacity / 1048576))e-9")
|
||||
remotemac=$(format_mac "$(walk $community $ip iso.3.6.1.4.1.41112.1.4.5.1.4.1)")
|
||||
latency=$(ping -qc1 -4 $ip 2>&1 | awk -F'/' 'END{ print (/^round-trip/? $4:"0") }')
|
||||
json_add_string "type" "airmaxac"
|
||||
json_add_string "mac" "$mac"
|
||||
json_add_string "name" "$name"
|
||||
json_add_string "hw" "$hw"
|
||||
json_add_string "signal" "$signal"
|
||||
json_add_string "capacity" "$capacity"
|
||||
json_add_string "remotemac" "$remotemac"
|
||||
json_add_string "latency" "$latency"
|
||||
;;
|
||||
|
||||
mikrotikap)
|
||||
# Mikrotik AP
|
||||
name=$(walk $community $ip 1.3.6.1.2.1.1.5 | xargs)
|
||||
fw=$(walk $community $ip 1.3.6.1.4.1.14988.1.1.7.7 | xargs)
|
||||
hw=$(walk $community $ip 1.3.6.1.4.1.14988.1.1.7.9 | xargs)
|
||||
frequency=$(walk $community $ip 1.3.6.1.4.1.14988.1.1.1.3.1.7.1 | xargs)
|
||||
frequency2=$(walk $community $ip 1.3.6.1.4.1.14988.1.1.1.3.1.7.2 | xargs)
|
||||
mac=$(format_mac "$(walk $community $ip 1.3.6.1.2.1.2.2.1.6.1)")
|
||||
clients=$(( $(walk $community $ip 1.3.6.1.4.1.14988.1.1.1.3.1.6.1) + $(walk $community $ip 1.3.6.1.4.1.14988.1.1.1.3.1.6.2) ))
|
||||
latency=$(ping -qc1 -4 $ip 2>&1 | awk -F'/' 'END{ print (/^round-trip/? $4:"0") }')
|
||||
json_add_string "type" "mikrotikap"
|
||||
json_add_string "mac" "$mac"
|
||||
json_add_string "name" "$name"
|
||||
json_add_string "hw" "$hw"
|
||||
json_add_string "fw" "$fw"
|
||||
json_add_string "frequency" "$frequency"
|
||||
json_add_string "frequency2" "$frequency2"
|
||||
json_add_string "clients" "$clients"
|
||||
json_add_string "latency" "$latency"
|
||||
;;
|
||||
|
||||
mikrotikw60grf)
|
||||
# Mikrotik 60GHz Richtfunk
|
||||
name=$(walk $community $ip 1.3.6.1.2.1.1.5 | xargs)
|
||||
fw=$(walk $community $ip 1.3.6.1.4.1.14988.1.1.7.7 | xargs)
|
||||
hw=$(walk $community $ip 1.3.6.1.4.1.14988.1.1.7.9 | xargs)
|
||||
signal=$(walk $community $ip 1.3.6.1.4.1.14988.1.1.1.8.1.8.1)
|
||||
capacity=$(walk $community $ip 1.3.6.1.4.1.14988.1.1.1.8.1.13.1)
|
||||
frequency=$(walk $community $ip 1.3.6.1.4.1.14988.1.1.1.8.1.6.1)
|
||||
mac=$(format_mac "$(walk $community $ip 1.3.6.1.2.1.2.2.1.6.1)")
|
||||
remotemac=$(format_mac "$(walk $community $ip 1.3.6.1.4.1.14988.1.1.1.8.1.5.1)")
|
||||
latency=$(ping -qc1 -4 $ip 2>&1 | awk -F'/' 'END{ print (/^round-trip/? $4:"0") }')
|
||||
json_add_string "type" "mikrotikw60grf"
|
||||
json_add_string "mac" "$mac"
|
||||
json_add_string "name" "$name"
|
||||
json_add_string "hw" "$hw"
|
||||
json_add_string "fw" "$fw"
|
||||
json_add_string "signal" "$signal"
|
||||
json_add_string "capacity" "$capacity"
|
||||
json_add_string "frequency" "$frequency"
|
||||
json_add_string "latency" "$latency"
|
||||
json_add_string "remotemac" "$remotemac"
|
||||
;;
|
||||
|
||||
mikrotikw60gst)
|
||||
# Mikrotik 60GHz Sektor
|
||||
name=$(walk $community $ip 1.3.6.1.2.1.1.5 | xargs)
|
||||
fw=$(walk $community $ip 1.3.6.1.4.1.14988.1.1.7.7 | xargs)
|
||||
hw=$(walk $community $ip 1.3.6.1.4.1.14988.1.1.7.9 | xargs)
|
||||
frequency=$(walk $community $ip 1.3.6.1.4.1.14988.1.1.1.8.1.6.1)
|
||||
mac=$(format_mac "$(walk $community $ip 1.3.6.1.2.1.2.2.1.6.1)")
|
||||
latency=$(ping -qc1 -4 $ip 2>&1 | awk -F'/' 'END{ print (/^round-trip/? $4:"0") }')
|
||||
json_add_string "type" "mikrotikw60gst"
|
||||
json_add_string "mac" "$mac"
|
||||
json_add_string "name" "$name"
|
||||
json_add_string "hw" "$hw"
|
||||
json_add_string "fw" "$fw"
|
||||
json_add_string "latency" "$latency"
|
||||
json_add_string "frequency" "$frequency"
|
||||
;;
|
||||
|
||||
latenz)
|
||||
latency=$(ping -qc1 -4 $ip 2>&1 | awk -F'/' 'END{ print (/^round-trip/? $4:"0") }')
|
||||
json_add_string "type" "latenz"
|
||||
json_add_string "latency" "$latency"
|
||||
;;
|
||||
esac
|
||||
|
||||
json_close_object
|
||||
fi
|
||||
}
|
||||
|
||||
config_load s2nproxy
|
||||
config_foreach s2np s2nproxy
|
||||
|
||||
json_close_object #s2nproxy
|
||||
|
||||
json_dump > $SCRIPT_DATA_FILE
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-simple-tc
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
SCRIPT_DATA_FILE=$(uci get nodewatcher.@script[0].data_file).json
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
json_load_file $SCRIPT_DATA_FILE
|
||||
|
||||
config_load simple-tc
|
||||
tc_enabled="0"
|
||||
tc_in="0"
|
||||
tc_out="0"
|
||||
parseTcInterface() {
|
||||
local iface="$1"
|
||||
|
||||
config_get ifname "$iface" ifname
|
||||
[ "wan" = "$ifname" ] || return
|
||||
|
||||
config_get tc_enabled "$iface" enabled "0"
|
||||
config_get tc_in "$iface" limit_ingress "0"
|
||||
config_get tc_out "$iface" limit_egress "0"
|
||||
}
|
||||
config_foreach parseTcInterface 'interface'
|
||||
|
||||
json_add_object "traffic_control"
|
||||
json_add_object "wan"
|
||||
|
||||
json_add_string "enabled" "$tc_enabled"
|
||||
json_add_string "in" "$tc_in"
|
||||
json_add_string "out" "$tc_out"
|
||||
|
||||
json_close_object #wan
|
||||
json_close_object #traffic_control
|
||||
|
||||
json_dump > $SCRIPT_DATA_FILE
|
||||
|
||||
#exit 0
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-support
|
||||
PKG_RELEASE:=9
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-sysupgrade
|
||||
PKG_RELEASE:=13
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-timeserver
|
||||
PKG_RELEASE:=3
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-uradvd
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -11,10 +11,16 @@ URADVD_BIN=/usr/sbin/uradvd
|
|||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "fff-uradvd"
|
||||
procd_add_reload_trigger "fff-uradvd" "network"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command "$URADVD_BIN" -i br-client -p $(uci get network.globals.ula_prefix)
|
||||
}
|
||||
|
||||
reload_service()
|
||||
{
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-vpn-select
|
||||
PKG_RELEASE:=5
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -1,65 +1,45 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Usage: vpn-select <path-to-hood-file>
|
||||
# To add a new protocol, put a file with three functions to /usr/lib/vpn-select.d/ .
|
||||
# The file must start with protocol=name. It is most important to use the same name here and in hoodfile.
|
||||
# The old config can be cleared in function ${protocol}_clear(). It is called first once per installed protocol.
|
||||
# The function ${protocol}_addpeer() is called for every selected peer in hoodfile.
|
||||
# The function ${protocol}_start_stop() is called at the end once per installed protocol.
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
hoodfile="$1"
|
||||
|
||||
make_config() {
|
||||
# remove old config
|
||||
rm /tmp/fastd_fff_peers/*
|
||||
# source functions
|
||||
for file in /usr/lib/vpn-select.d/*; do
|
||||
[ -f $file ] && . "$file"
|
||||
supported_protocols="$supported_protocols $protocol"
|
||||
done
|
||||
|
||||
# prepare
|
||||
Index=1
|
||||
# clear old config
|
||||
for protocol in $supported_protocols; do
|
||||
"${protocol}_clear"
|
||||
done
|
||||
|
||||
# configure vpn
|
||||
|
||||
if [ -n "$hoodfile" ] && [ -s "$hoodfile" ] ; then
|
||||
json_load "$(cat "$hoodfile")"
|
||||
json_select hood
|
||||
json_get_var id id
|
||||
json_select ".."
|
||||
json_select vpn
|
||||
|
||||
# get fastd peers
|
||||
while json_select "$Index" > /dev/null
|
||||
do
|
||||
json_get_keys vpn_keys
|
||||
for key in $vpn_keys; do
|
||||
json_select $key
|
||||
json_get_var protocol protocol
|
||||
if [ "$protocol" = "fastd" ]; then
|
||||
# set up fastd
|
||||
json_get_var servername name
|
||||
filename="/etc/fastd/fff/peers/$servername"
|
||||
echo "#name \"${servername}\";" > "$filename"
|
||||
json_get_var key key
|
||||
echo "key \"${key}\";" >> "$filename"
|
||||
json_get_var address address
|
||||
json_get_var port port
|
||||
echo "remote \"${address}\" port ${port};" >> "$filename"
|
||||
echo "" >> "$filename"
|
||||
echo "float yes;" >> "$filename"
|
||||
fi
|
||||
"${protocol}_addpeer"
|
||||
json_select ".." # back to vpn
|
||||
Index=$(( Index + 1 ))
|
||||
done
|
||||
json_select ".." # back to root
|
||||
}
|
||||
|
||||
# Only do something if file is there and not empty; otherwise exit 1
|
||||
if [ -s "$hoodfile" ]; then
|
||||
if [ ! -d /tmp/fastd_fff_peers ]; then
|
||||
# first run after reboot
|
||||
mkdir /tmp/fastd_fff_peers
|
||||
make_config
|
||||
# start fastd only if there are some peers
|
||||
[ "$(ls /etc/fastd/fff/peers/* 2>/dev/null)" ] && /etc/init.d/fastd start
|
||||
else
|
||||
make_config
|
||||
/etc/init.d/fastd reload
|
||||
|
||||
# fastd start/stop for various situations
|
||||
pidfile="/tmp/run/fastd.fff.pid"
|
||||
if [ "$(ls /etc/fastd/fff/peers/* 2>/dev/null)" ]; then
|
||||
([ -s "$pidfile" ] && [ -d "/proc/$(cat "$pidfile")" ]) || /etc/init.d/fastd start
|
||||
else
|
||||
([ -s "$pidfile" ] && [ -d "/proc/$(cat "$pidfile")" ]) && /etc/init.d/fastd stop
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
else
|
||||
echo "vpn-select: Hood file not found or empty!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# start/restart/stop vpnservices
|
||||
for protocol in $supported_protocols; do
|
||||
"${protocol}_start_stop"
|
||||
done
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
rm /tmp/fastd_fff_peers/*
|
||||
/etc/init.d/fastd stop
|
||||
|
|
@ -0,0 +1 @@
|
|||
vpn-select
|
|
@ -0,0 +1,29 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-vxlan-node-vpn
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=base
|
||||
CATEGORY:=Freifunk
|
||||
TITLE:=Freifunk-Franken vxlan-node
|
||||
URL:=http://www.freifunk-franken.de
|
||||
DEPENDS:=+vxlan
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
This is the vxlan-node-vpn package for the Freifunk Franken Firmware
|
||||
This will configure and set up the VPN via vxlan
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
|
@ -0,0 +1,16 @@
|
|||
uci batch <<EOF
|
||||
set network.vxlan0=interface
|
||||
set network.vxlan0.proto=vxlan6
|
||||
set network.vxlan0.port=8472
|
||||
set network.vxlan0.ip6addr=auto
|
||||
set network.vxlan0.srcportmin=8472
|
||||
set network.vxlan0.srcportmax=8473
|
||||
set network.vxlan0.ageing=30
|
||||
set network.vxlan0.mtu=1422
|
||||
set network.vxlan0.vid=0
|
||||
|
||||
set network.vxbat=interface
|
||||
set network.vxbat.proto=batadv_hardif
|
||||
set network.vxbat.master=bat0
|
||||
set network.vxbat.ifname=vxlan0
|
||||
EOF
|
|
@ -0,0 +1,27 @@
|
|||
protocol=vxlan
|
||||
|
||||
vxlan_clear() {
|
||||
while uci -q delete network.@vxlan_peer[0]; do :; done
|
||||
}
|
||||
|
||||
vxlan_addpeer() {
|
||||
uci set network.vxlan0.vid="$id"
|
||||
json_get_var address address
|
||||
address=$(ping6 -w1 -c1 "$address" | awk '/from/ {print substr($4, 1, length($4)-1); exit}')
|
||||
[ -z $address ] && return ## address not reachable
|
||||
uci add network vxlan_peer
|
||||
uci set network.@vxlan_peer[-1].vxlan="vxlan0"
|
||||
uci set network.@vxlan_peer[-1].dst="$address"
|
||||
}
|
||||
|
||||
vxlan_start_stop() {
|
||||
uci commit network
|
||||
# reload_config will not add new peers. A ifup is needed
|
||||
ifup vxlan0
|
||||
|
||||
# this workaround is cleaning up old fdb entries
|
||||
# and can be removed if someday netifd will do that
|
||||
bridge fdb show dev vxlan0 state permanent | while read mac dst ip rest ; do
|
||||
grep -q "$ip" /etc/config/network || bridge fdb del $mac dev vxlan0 dst $ip
|
||||
done
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-web-hood
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-web-mqtt
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-web-ui
|
||||
PKG_RELEASE:=18
|
||||
PKG_RELEASE:=$(shell echo -n $$(( $(COMMITCOUNT) + 20 )))
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-wireguard
|
||||
PKG_RELEASE:=8
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-wireless
|
||||
PKG_RELEASE:=20
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ wifiGetFreq() {
|
|||
|
||||
local radio=$1
|
||||
|
||||
# Use hwmode for switching, since this is always set by firmware (effectively hard-coded)
|
||||
# Use uci radio band for switching, since this is always set by firmware (effectively hard-coded)
|
||||
# Do not use channel, as this might be "auto" for both
|
||||
[ "$(uci get "wireless.${radio}.hwmode")" = "11a" ] && echo "5" || echo "2"
|
||||
[ "$(uci get "wireless.${radio}.band")" = "5g" ] && echo "5" || echo "2"
|
||||
return 0
|
||||
}
|
||||
# vim: set noexpandtab:tabstop=4
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh
|
||||
|
||||
SCRIPT_DATA_FILE=$(uci get nodewatcher.@script[0].data_file).json
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
json_load_file $SCRIPT_DATA_FILE
|
||||
|
||||
json_add_object "airtime"
|
||||
|
||||
w2dump="$(iw dev w2ap survey dump 2> /dev/null | sed '/Survey/,/\[in use\]/d')"
|
||||
if [ -n "$w2dump" ] ; then
|
||||
json_add_object "w2"
|
||||
w2_ACT="$(ACTIVE=$(echo "$w2dump" | grep "active time:"); set ${ACTIVE:-0 0 0 0 0}; echo -e "${4}")"
|
||||
w2_BUS="$(BUSY=$(echo "$w2dump" | grep "busy time:"); set ${BUSY:-0 0 0 0 0}; echo -e "${4}")"
|
||||
json_add_string "active" "$w2_ACT"
|
||||
json_add_string "busy" "$w2_BUS"
|
||||
json_close_object #w2
|
||||
fi
|
||||
|
||||
w5dump="$(iw dev w5ap survey dump 2> /dev/null | sed '/Survey/,/\[in use\]/d')"
|
||||
if [ -n "$w5dump" ] ; then
|
||||
json_add_object "w5"
|
||||
w5_ACT="$(ACTIVE=$(echo "$w5dump" | grep "active time:"); set ${ACTIVE:-0 0 0 0 0}; echo -e "${4}")"
|
||||
w5_BUS="$(BUSY=$(echo "$w5dump" | grep "busy time:"); set ${BUSY:-0 0 0 0 0}; echo -e "${4}")"
|
||||
json_add_string "active" "$w5_ACT"
|
||||
json_add_string "busy" "$w5_BUS"
|
||||
json_close_object #w5
|
||||
fi
|
||||
json_close_object #airtime
|
||||
|
||||
json_dump > $SCRIPT_DATA_FILE
|
||||
|
||||
#exit 0
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff
|
||||
PKG_RELEASE:=9
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
Loading…
Reference in New Issue