summaryrefslogtreecommitdiff
path: root/ospfd/ospf_interface.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-05-09 13:10:35 -0400
committerDonald Sharp <sharpd@nvidia.com>2023-05-10 08:35:45 -0400
commitdd2bc4fb406cc9284d35ef623ebb8838cb158bc8 (patch)
tree9817fc006bd78436e16531f8c1c8c2c728eb483f /ospfd/ospf_interface.c
parent11feb307064c7e170e63fe4515c41174fc791a8a (diff)
ospfd: Respect loopback's cost that is set and set loopback costs to 0
When setting an loopback's cost, set the value to 0, unless the operator has assigned a value for the loopback's cost. RFC states: If the state of the interface is Loopback, add a Type 3 link (stub network) as long as this is not an interface to an unnumbered point-to-point network. The Link ID should be set to the IP interface address, the Link Data set to the mask 0xffffffff (indicating a host route), and the cost set to 0. FRR is going to allow this to be overridden if the operator specifically sets a value too. Fixes: #13472 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'ospfd/ospf_interface.c')
-rw-r--r--ospfd/ospf_interface.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index 5742ece1f7..f18aa399a4 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -101,6 +101,9 @@ int ospf_if_get_output_cost(struct ospf_interface *oi)
cost = 1;
else if (cost > 65535)
cost = 65535;
+
+ if (if_is_loopback(oi->ifp))
+ cost = 0;
}
return cost;