This commit is contained in:
Alex D. 2021-05-12 21:12:27 +00:00
parent fd3977af16
commit 2eb73196b1
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
5 changed files with 134 additions and 0 deletions

11
config/bird/APKBUILD Normal file
View File

@ -0,0 +1,11 @@
# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer: Alex Denes <caskd@redxen.eu>
_svcname=bird
. ../APKBUILD-config.common
pkgver=2021.05.12
pkgrel=0
source="redxen.conf"
sha512sums="063c456c53d547ca5c96a2f89870e9e7e7569c04fad166fa9f3c7d589252cba1e3f801c14b367e106ee7b119bb3abb1d44c1059996d3704352023aefd4ed1184 redxen.conf"

49
config/bird/redxen.conf Normal file
View File

@ -0,0 +1,49 @@
# Configure logging
log syslog all;
# log "/var/log/bird.log" { debug, trace, info, remote, warning, error, auth, fatal, bug };
# Turn on global debugging of all protocols (all messages or just selected classes)
# debug protocols all;
# debug protocols { events, states };
# Turn on internal watchdog
# watchdog warning 5 s;
# watchdog timeout 30 s;
filter crxn_filter
{
if (net ~ fd8a:6111:3b1a::/48) then accept;
reject;
}
# The Device protocol is not a real routing protocol. It does not generate any
# routes and it only serves as a module for getting information about network
# interfaces from the kernel. It is necessary in almost any configuration.
protocol device {
}
protocol direct {
ipv6;
interface "crxn*";
}
# The Kernel protocol is not a real routing protocol. Instead of communicating
# with other routers in the network, it performs synchronization of BIRD
# routing tables with the OS kernel. One instance per table.
protocol kernel {
persist;
ipv6 {
import all;
export all;
};
}
protocol babel {
ipv6 {
import filter crxn_filter;
export all;
};
interface "crxn*" {
type wired;
};
}

12
openrc/bird/APKBUILD Normal file
View File

@ -0,0 +1,12 @@
# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer: Alex Denes <caskd@redxen.eu>
_svcname=bird
_grpname=network
. ../APKBUILD-openrc.common
pkgver=2021.05.12
pkgrel=1
sha512sums="4f96de2677c1495af058e3ace9882c6b45437763a5aa22d57997a463fe5ba8be4f2e40234a86633555b665dccc3d897007aa5074b95e8ae954989d2ad8d970df runfile
e10326b72cf5fc4ff32b27b6524e1d56c5bf0410a6a4e321ffa6f155eac6645b22b37c1fd024ced631800d1a69d4fa9395f6534d55f111a0c4b5c85d5037b97b conffile"

1
openrc/bird/conffile Normal file
View File

@ -0,0 +1 @@
CONF_FILE="/etc/bird/redxen.conf"

61
openrc/bird/runfile Normal file
View File

@ -0,0 +1,61 @@
#!/sbin/openrc-run
# Copyright 1999-2019 Gentoo Authors
# Copyright 2019 Alarig Le Lay <alarig@grifon.fr>
# Distributed under the terms of the GNU General Public License v2
extra_started_commands="reload"
pidfile="/run/bird/${RC_SVCNAME}.pid"
# See https://bird.network.cz/?get_doc&v=20&f=bird-1.html#ss1.4 for priveleges
# requirements.
command="/usr/sbin/bird"
retry=15
: ${CONF_FILE:="/etc/${RC_SVCNAME}.conf"}
SOCK="/run/${RC_SVCNAME}.ctl"
client_args="-s ${SOCK}"
command_args="-u bird -g bird ${client_args} -R -c ${CONF_FILE} -P ${pidfile}"
client_args="${client_args} -r"
depend() {
need net
use logger
after firewall
}
start_pre() {
# Used to store bird's PID file, which iscreated after privilege drop.
checkpath --directory --owner bird:bird --mode 0775 /run/bird
# Ensure permissions on configuration file are correct for upgrades.
checkpath --file --owner root:bird --mode 0640 ${CONF_FILE}
}
check_run() {
BIRD_CHECK_CONF="birdc ${client_args} configure check \"${CONF_FILE}\""
# Check if the bird parser returns what we want
# We cant use $? because its always 0 if the sock works
STATE=$(${BIRD_CHECK_CONF} | grep 'Configuration OK')
if [ -n "${STATE}" ]; then
return 0
else
# We remove the first three lines (garbage informations), the
# errors begin after that
eerror "$(${BIRD_CHECK_CONF} | sed '1,3d')"
return 1
fi
}
reload() {
check_run || return 1
ebegin "Reloading BIRD"
start-stop-daemon --signal HUP --pidfile "${pidfile}"
eend $?
}
stop_pre() {
if [ "${RC_CMD}" = "restart" ] ; then
check_run || return 1
fi
}