[__bird_radv] fix MTU setting, link routing tables to __object_id, add preference parameters

This commit is contained in:
fnux 2024-02-19 12:41:05 +01:00
parent 2511218dd6
commit f101ea4afa
No known key found for this signature in database
GPG key ID: 4502C902C00A1E12
3 changed files with 27 additions and 4 deletions

View file

@ -26,6 +26,13 @@ OPTIONAL PARAMETERS
mtu mtu
An optional MTU setting to include in the router advertisements. An optional MTU setting to include in the router advertisements.
default-preference
This option specifies the Default Router Preference value to advertise to
hosts. Default: medium.
route-preference
This option specifies the default value of advertised route preference for
specific routes. Default: medium.
OPTIONAL MULTIPLE PARAMETERS OPTIONAL MULTIPLE PARAMETERS
---------------------------- ----------------------------

View file

@ -58,27 +58,41 @@ fi
MTU= MTU=
if [ -f "${__object:?}/parameter/mtu" ]; if [ -f "${__object:?}/parameter/mtu" ];
then then
MTU="link mtu $(cat "${__object:?}/parameter/mtu")" MTU="link mtu $(cat "${__object:?}/parameter/mtu");"
fi
DEFAULT_PREFERENCE=
if [ -f "${__object:?}/parameter/default-preference" ];
then
DEFAULT_PREFERENCE="default preference $(cat "${__object:?}/parameter/default-preference");"
fi
ROUTE_PREFERENCE=
if [ -f "${__object:?}/parameter/route-preference" ];
then
ROUTE_PREFERENCE="route preference $(cat "${__object:?}/parameter/route-preference");"
fi fi
__file "${confdir:?}/radv-${__object_id:?}.conf" \ __file "${confdir:?}/radv-${__object_id:?}.conf" \
--mode 0640 --owner root --group bird \ --mode 0640 --owner root --group bird \
--source - << EOF --source - << EOF
ipv6 table radv_routes; ipv6 table radv_routes_${__object_id};
protocol static { protocol static {
description "Routes advertised via RAs"; description "Routes advertised via RAs";
ipv6 { table radv_routes; }; ipv6 { table radv_routes_${__object_id}; };
$(sed -e 's/^/\troute /' -e 's/$/ unreachable;/' "${__object:?}/parameter/route") $(sed -e 's/^/\troute /' -e 's/$/ unreachable;/' "${__object:?}/parameter/route")
} }
protocol radv ${__object_id:?} { protocol radv ${__object_id:?} {
propagate routes ${have_routes:?}; propagate routes ${have_routes:?};
ipv6 { table radv_routes; export all; }; ipv6 { table radv_routes_${__object_id}; export all; };
interface "$(cat "${__object:?}/parameter/interface")" { interface "$(cat "${__object:?}/parameter/interface")" {
$MTU $MTU
$DEFAULT_PREFERENCE
$ROUTE_PREFERENCE
}; };
$RDNS $RDNS

View file

@ -1 +1,3 @@
mtu mtu
default-preference
route-preference