Add bird babel implementation
Signed-off-by: Fabian Bläse <fabian@blaese.de>
This commit is contained in:
parent
f7e1ec318f
commit
8d0a7118c7
|
@ -22,7 +22,7 @@ ROUTINGREV="02b4dbfcb7b8f8b566940847d22d5a6f229d2e66"
|
|||
GLUONREV="12e41d0ff07ec54bbd67a31ab50d12ca04f2238c"
|
||||
|
||||
OPENWRT_PKGS="gpioctl-sysfs libugpio fastd haserl micrond mtr bmon"
|
||||
ROUTING_PKGS="kmod-batman-adv batctl alfred babeld"
|
||||
ROUTING_PKGS="kmod-batman-adv batctl alfred babeld bird2"
|
||||
GLUON_PKGS="simple-tc uradvd"
|
||||
|
||||
FFF_VARIANTS="node layer3"
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-babel-bird2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/fff-babel-bird2
|
||||
SECTION:=base
|
||||
CATEGORY:=Freifunk
|
||||
TITLE:=Freifunk-Franken babel-bird2
|
||||
URL:=https://www.freifunk-franken.de
|
||||
DEPENDS:=+bird2 +bird2c
|
||||
PROVIDES:=fff-babel-implementation
|
||||
CONFLICTS:=fff-babeld
|
||||
endef
|
||||
|
||||
define Package/fff-babel-bird2/description
|
||||
This is the Freifunk Franken Firmware babel-bird2 package.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Package/fff-babel-bird2/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,fff-babel-bird2))
|
|
@ -0,0 +1 @@
|
|||
include "/etc/bird-babel/*.conf";
|
|
@ -0,0 +1,108 @@
|
|||
ipv4 table fff4;
|
||||
ipv6 sadr table fff6;
|
||||
|
||||
ipv4 table local4;
|
||||
ipv6 sadr table local6;
|
||||
|
||||
protocol device {
|
||||
scan time 15;
|
||||
}
|
||||
|
||||
# device routes for ipv4 peering address
|
||||
protocol direct {
|
||||
ipv4 {
|
||||
table fff4;
|
||||
import filter {
|
||||
if (net ~ 10.50.0.0/16 || net ~ 10.83.0.0/16) && net.len = 32 then {
|
||||
accept;
|
||||
}
|
||||
reject;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
# device routes on loopback interface
|
||||
protocol direct {
|
||||
ipv4 {
|
||||
table fff4;
|
||||
import filter {
|
||||
if net ~ 10.50.0.0/16 || net ~ 10.83.0.0/16 then {
|
||||
accept;
|
||||
}
|
||||
reject;
|
||||
};
|
||||
};
|
||||
|
||||
ipv6 sadr {
|
||||
table fff6;
|
||||
import filter {
|
||||
if net ~ 2000::/3 from ::/0 then {
|
||||
accept;
|
||||
}
|
||||
reject;
|
||||
};
|
||||
import keep filtered;
|
||||
};
|
||||
|
||||
interface "lo";
|
||||
}
|
||||
|
||||
# ipv6 kernel route interface
|
||||
protocol kernel {
|
||||
ipv6 sadr {
|
||||
table fff6;
|
||||
import filter {
|
||||
# only import routes from kernel with proto static
|
||||
if krt_source = 4 then {
|
||||
accept;
|
||||
}
|
||||
reject;
|
||||
};
|
||||
export all;
|
||||
};
|
||||
kernel table 10;
|
||||
scan time 15;
|
||||
learn yes;
|
||||
}
|
||||
|
||||
# ipv4 kernel route interface
|
||||
protocol kernel {
|
||||
ipv4 {
|
||||
table fff4;
|
||||
import filter {
|
||||
# only import routes from kernel with proto static
|
||||
if krt_source = 4 then {
|
||||
accept;
|
||||
}
|
||||
reject;
|
||||
};
|
||||
export all;
|
||||
};
|
||||
kernel table 10;
|
||||
scan time 15;
|
||||
learn yes;
|
||||
}
|
||||
|
||||
protocol babel {
|
||||
randomize router id yes;
|
||||
|
||||
ipv4 {
|
||||
table fff4;
|
||||
import filter {
|
||||
accept;
|
||||
};
|
||||
export all;
|
||||
};
|
||||
|
||||
ipv6 sadr {
|
||||
table fff6;
|
||||
import filter {
|
||||
accept;
|
||||
};
|
||||
export filter {
|
||||
accept;
|
||||
};
|
||||
};
|
||||
|
||||
include "/etc/bird-babel-include.conf";
|
||||
};
|
|
@ -0,0 +1,3 @@
|
|||
mv /etc/bird-fff.conf /etc/bird.conf
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,47 @@
|
|||
babel_add_interface() {
|
||||
[ "$#" -ne "4" ] && return 1
|
||||
|
||||
local name="$1"
|
||||
local interface="$2"
|
||||
local type="$3"
|
||||
local rxcost="$4"
|
||||
|
||||
mkdir -p /tmp/bird-babel
|
||||
echo "interface \"$interface\" { type $type; rxcost $rxcost; };" > /tmp/bird-babel/$name.conf
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
babel_delete_interface() {
|
||||
return 0
|
||||
}
|
||||
|
||||
babel_add_redistribute_filter() {
|
||||
return 0
|
||||
}
|
||||
|
||||
babel_remove_custom_redistribute_filters() {
|
||||
return 0
|
||||
}
|
||||
|
||||
babel_apply() {
|
||||
mv /tmp/bird-babel /etc/bird-babel
|
||||
}
|
||||
|
||||
babel_reload() {
|
||||
# Change include file path, so bird uses the correct configuration, depending on the configuration state:
|
||||
# - If test mode is active (and /tmp/bird-babel exists), switch to the temporary (/tmp) configuration to be tested.
|
||||
# - If new settings are applied or the old settings are restored after an unsuccessful test (and /tmp/bird-babel does not exist),
|
||||
# switch back to the permanent configuration (/etc).
|
||||
if [ -d /tmp/bird-babel ]; then
|
||||
echo 'include "/tmp/bird-babel/*.conf";' > /etc/bird-babel-include.conf
|
||||
else
|
||||
echo 'include "/etc/bird-babel/*.conf";' > /etc/bird-babel-include.conf
|
||||
fi
|
||||
|
||||
/etc/init.d/bird reload
|
||||
}
|
||||
|
||||
babel_revert() {
|
||||
rm -r /tmp/bird-babel
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
neighbours="$(birdc -r show babel neighbors |
|
||||
tail -n +5 |
|
||||
awk '{ printf "<neighbour><ip>%s</ip><outgoing_interface>%s</outgoing_interface><link_cost>%s</link_cost></neighbour>", $1, $2, $3 }'
|
||||
)"
|
||||
|
||||
echo -n "<babel_neighbours>$neighbours</babel_neighbours>"
|
||||
|
||||
exit 0
|
|
@ -12,6 +12,7 @@ define Package/fff-layer3
|
|||
URL:=https://www.freifunk-franken.de
|
||||
DEPENDS:=+fff-alfred-monitoring-proxy \
|
||||
+fff-babel \
|
||||
+fff-babel-bird2 \
|
||||
+fff-boardname \
|
||||
+fff-dhcp \
|
||||
+fff-layer3-config \
|
||||
|
|
|
@ -74,6 +74,8 @@ fi
|
|||
|
||||
if [ -x /usr/sbin/babeld ]; then
|
||||
SYSTEM_DATA="$SYSTEM_DATA<babel_version>$(/usr/sbin/babeld -V 2>&1)</babel_version>"
|
||||
elif [ -x /usr/sbin/bird ]; then
|
||||
SYSTEM_DATA="$SYSTEM_DATA<babel_version>$(/usr/sbin/bird --version 2>&1 | sed "s/BIRD version /bird-/")</babel_version>"
|
||||
fi
|
||||
|
||||
# example for /etc/openwrt_release:
|
||||
|
|
Loading…
Reference in New Issue