mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 04:33:00 +02:00
confd: add must expression to verify ospf backbone is not nssa/stub
Silently drop any area-type setting for ospf backbone in a migrate script to prevent any field issues after upgrading to this fix. Fixes #1247 Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
# Remove area-type from OSPF backbone area (0.0.0.0)
|
||||
# The backbone area cannot be configured as stub or NSSA per RFC 2328/3101
|
||||
# Silently drop any area-type setting for area 0.0.0.0
|
||||
|
||||
file=$1
|
||||
temp=${file}.tmp
|
||||
|
||||
jq '
|
||||
if .["ietf-routing:routing"]?."control-plane-protocols"?."control-plane-protocol" then
|
||||
.["ietf-routing:routing"]."control-plane-protocols"."control-plane-protocol" |= map(
|
||||
if .["ietf-ospf:ospf"]?.areas?.area then
|
||||
.["ietf-ospf:ospf"].areas.area |= map(
|
||||
if (.["area-id"] == "0.0.0.0") and .["area-type"] then
|
||||
# Remove area-type from backbone area
|
||||
del(.["area-type"])
|
||||
else
|
||||
.
|
||||
end
|
||||
)
|
||||
else
|
||||
.
|
||||
end
|
||||
)
|
||||
else
|
||||
.
|
||||
end
|
||||
' "$file" > "$temp" && mv "$temp" "$file"
|
||||
@@ -1,3 +1,4 @@
|
||||
migratedir = $(pkgdatadir)/migrate/1.6
|
||||
dist_migrate_DATA = 10-dhcp-client-to-ipv4.sh \
|
||||
20-autoconf-to-presence.sh
|
||||
20-autoconf-to-presence.sh \
|
||||
30-ospf-backbone-area-type.sh
|
||||
|
||||
@@ -22,7 +22,7 @@ MODULES=(
|
||||
"ieee802-dot1q-types@2022-10-29.yang"
|
||||
"infix-ip@2025-11-02.yang"
|
||||
"infix-if-type@2025-02-12.yang"
|
||||
"infix-routing@2024-11-27.yang"
|
||||
"infix-routing@2025-11-10.yang"
|
||||
"ieee802-dot1ab-lldp@2022-03-15.yang"
|
||||
"infix-lldp@2025-05-05.yang"
|
||||
"infix-dhcp-common@2025-01-29.yang"
|
||||
|
||||
@@ -20,6 +20,10 @@ module infix-routing {
|
||||
contact "kernelkit@googlegroups.com";
|
||||
description "Deviations and augments for ietf-routing and ietf-ospf.";
|
||||
|
||||
revision 2025-11-10 {
|
||||
description "Add must constraint to prevent backbone area as stub/NSSA";
|
||||
reference "RFC 2328, RFC 3101";
|
||||
}
|
||||
revision 2024-11-27 {
|
||||
description "Deviate address-family in OSPF";
|
||||
reference "internal";
|
||||
@@ -348,6 +352,19 @@ module infix-routing {
|
||||
}
|
||||
|
||||
/* OSPF Area */
|
||||
deviation "/rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:area-type" {
|
||||
deviate add {
|
||||
must "(../ospf:area-id != '0.0.0.0') or "
|
||||
+ "(derived-from-or-self(., 'ospf:normal-area'))" {
|
||||
error-message "Area 0.0.0.0 (backbone) cannot be configured as "
|
||||
+ "stub or NSSA.";
|
||||
description
|
||||
"The backbone area (area 0.0.0.0) must be a normal area. "
|
||||
+ "It cannot be configured as a stub area or NSSA as per "
|
||||
+ "RFC 2328 and RFC 3101.";
|
||||
}
|
||||
}
|
||||
}
|
||||
deviation "/rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:virtual-links" {
|
||||
deviate not-supported;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user