From f101ea4afa4c3020bda3079e193d963ec4526d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Floure?= Date: Mon, 19 Feb 2024 12:41:05 +0100 Subject: [PATCH] [__bird_radv] fix MTU setting, link routing tables to __object_id, add preference parameters --- type/__bird_radv/man.rst | 7 +++++++ type/__bird_radv/manifest | 22 ++++++++++++++++++---- type/__bird_radv/parameter/optional | 2 ++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/type/__bird_radv/man.rst b/type/__bird_radv/man.rst index 819b213..1448f1d 100644 --- a/type/__bird_radv/man.rst +++ b/type/__bird_radv/man.rst @@ -26,6 +26,13 @@ OPTIONAL PARAMETERS mtu 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 ---------------------------- diff --git a/type/__bird_radv/manifest b/type/__bird_radv/manifest index aee8690..6c27be0 100755 --- a/type/__bird_radv/manifest +++ b/type/__bird_radv/manifest @@ -58,27 +58,41 @@ fi MTU= if [ -f "${__object:?}/parameter/mtu" ]; 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 __file "${confdir:?}/radv-${__object_id:?}.conf" \ --mode 0640 --owner root --group bird \ --source - << EOF -ipv6 table radv_routes; +ipv6 table radv_routes_${__object_id}; protocol static { 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") } protocol radv ${__object_id:?} { propagate routes ${have_routes:?}; - ipv6 { table radv_routes; export all; }; + ipv6 { table radv_routes_${__object_id}; export all; }; interface "$(cat "${__object:?}/parameter/interface")" { $MTU + $DEFAULT_PREFERENCE + $ROUTE_PREFERENCE }; $RDNS diff --git a/type/__bird_radv/parameter/optional b/type/__bird_radv/parameter/optional index ee48c5c..87494d7 100644 --- a/type/__bird_radv/parameter/optional +++ b/type/__bird_radv/parameter/optional @@ -1 +1,3 @@ mtu +default-preference +route-preference