diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2023-10-23 11:24:12 +0300 |
|---|---|---|
| committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2023-10-26 07:39:28 +0300 |
| commit | 80dfa9e012ebdb3e88cbd6de3101ae6dd9109ad2 (patch) | |
| tree | 5b6c1e472af55a831cfa1afbbc48c095bbd45221 /ospf6d/ospf6_interface.c | |
| parent | e8615867d08f0c79096c1270695fa5c52d689a87 (diff) | |
ospf6d: Set loopback interface cost to 0
https://www.rfc-editor.org/rfc/rfc5340.html#page-37 states:
If the interface type is point-
to-multipoint or the interface is in the state Loopback, the
global scope IPv6 addresses associated with the interface (if any)
are copied into the intra-area-prefix-LSA with the PrefixOptions
LA-bit set, the PrefixLength set to 128, and the metric set to 0.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'ospf6d/ospf6_interface.c')
| -rw-r--r-- | ospf6d/ospf6_interface.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index a20ddf6c10..2a6b816844 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -128,9 +128,19 @@ static uint8_t ospf6_default_iftype(struct interface *ifp) static uint32_t ospf6_interface_get_cost(struct ospf6_interface *oi) { /* If all else fails, use default OSPF cost */ - uint32_t cost; + uint32_t cost = 0; uint32_t bw, refbw; struct ospf6 *ospf6; + + /* If the interface type is point-to-multipoint or the interface + * is in the state Loopback, the global scope IPv6 addresses + * associated with the interface (if any) are copied into the + * intra-area-prefix-LSA with the PrefixOptions LA-bit set, the + * PrefixLength set to 128, and the metric set to 0. + */ + if (if_is_loopback(oi->interface)) + return cost; + /* interface speed and bw can be 0 in some platforms, * use ospf default bw. If bw is configured then it would * be used. |
