Skip to content

Commit

Permalink
Merge pull request #14682 from FRRouting/mergify/bp/dev/9.1/pr-14635
Browse files Browse the repository at this point in the history
ospf6d: Set loopback interface cost to 0 (backport #14635)
  • Loading branch information
ton31337 authored Oct 30, 2023
2 parents 66ef808 + b132f6f commit 1c44c6b
Show file tree
Hide file tree
Showing 13 changed files with 182 additions and 51 deletions.
12 changes: 11 additions & 1 deletion ospf6d/ospf6_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def _bgp_verify_v6_global_nexthop_validity():
"2001:db8:1::1": {
"valid": True,
"complete": True,
"igpMetric": 20,
"igpMetric": 10,
"pathCount": 2,
"peer": "2001:db8:1::1",
"nexthops": [{"interfaceName": "pe2-eth0"}],
Expand Down
14 changes: 7 additions & 7 deletions tests/topotests/ospf6_gr_topo1/rt1/show_ipv6_route.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"vrfId":0,
"vrfName":"default",
"distance":110,
"metric":10,
"metric":0,
"nexthops":[
{
"directlyConnected":true,
Expand All @@ -25,7 +25,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":20,
"metric":10,
"installed":true,
"nexthops":[
{
Expand All @@ -45,7 +45,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":30,
"metric":20,
"installed":true,
"nexthops":[
{
Expand All @@ -65,7 +65,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":40,
"metric":30,
"installed":true,
"nexthops":[
{
Expand All @@ -85,7 +85,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":50,
"metric":40,
"installed":true,
"nexthops":[
{
Expand All @@ -105,7 +105,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":40,
"metric":30,
"installed":true,
"nexthops":[
{
Expand All @@ -125,7 +125,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":50,
"metric":40,
"installed":true,
"nexthops":[
{
Expand Down
14 changes: 7 additions & 7 deletions tests/topotests/ospf6_gr_topo1/rt2/show_ipv6_route.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":20,
"metric":10,
"installed":true,
"nexthops":[
{
Expand All @@ -26,7 +26,7 @@
"vrfId":0,
"vrfName":"default",
"distance":110,
"metric":10,
"metric":0,
"nexthops":[
{
"directlyConnected":true,
Expand All @@ -45,7 +45,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":20,
"metric":10,
"installed":true,
"nexthops":[
{
Expand All @@ -65,7 +65,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":30,
"metric":20,
"installed":true,
"nexthops":[
{
Expand All @@ -85,7 +85,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":40,
"metric":30,
"installed":true,
"nexthops":[
{
Expand All @@ -105,7 +105,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":30,
"metric":20,
"installed":true,
"nexthops":[
{
Expand All @@ -125,7 +125,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":40,
"metric":30,
"installed":true,
"nexthops":[
{
Expand Down
14 changes: 7 additions & 7 deletions tests/topotests/ospf6_gr_topo1/rt3/show_ipv6_route.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":30,
"metric":20,
"installed":true,
"nexthops":[
{
Expand All @@ -28,7 +28,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":20,
"metric":10,
"installed":true,
"nexthops":[
{
Expand All @@ -46,7 +46,7 @@
"vrfId":0,
"vrfName":"default",
"distance":110,
"metric":10,
"metric":0,
"nexthops":[
{
"directlyConnected":true,
Expand All @@ -65,7 +65,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":20,
"metric":10,
"installed":true,
"nexthops":[
{
Expand All @@ -85,7 +85,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":30,
"metric":20,
"installed":true,
"nexthops":[
{
Expand All @@ -105,7 +105,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":20,
"metric":10,
"installed":true,
"nexthops":[
{
Expand All @@ -125,7 +125,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":30,
"metric":20,
"installed":true,
"nexthops":[
{
Expand Down
14 changes: 7 additions & 7 deletions tests/topotests/ospf6_gr_topo1/rt4/show_ipv6_route.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":40,
"metric":30,
"installed":true,
"nexthops":[
{
Expand All @@ -28,7 +28,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":30,
"metric":20,
"installed":true,
"nexthops":[
{
Expand All @@ -48,7 +48,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":20,
"metric":10,
"installed":true,
"nexthops":[
{
Expand All @@ -66,7 +66,7 @@
"vrfId":0,
"vrfName":"default",
"distance":110,
"metric":10,
"metric":0,
"nexthops":[
{
"directlyConnected":true,
Expand All @@ -85,7 +85,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":20,
"metric":10,
"installed":true,
"nexthops":[
{
Expand All @@ -105,7 +105,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":30,
"metric":20,
"installed":true,
"nexthops":[
{
Expand All @@ -125,7 +125,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":40,
"metric":30,
"installed":true,
"nexthops":[
{
Expand Down
14 changes: 7 additions & 7 deletions tests/topotests/ospf6_gr_topo1/rt5/show_ipv6_route.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":50,
"metric":40,
"installed":true,
"nexthops":[
{
Expand All @@ -28,7 +28,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":40,
"metric":30,
"installed":true,
"nexthops":[
{
Expand All @@ -48,7 +48,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":30,
"metric":20,
"installed":true,
"nexthops":[
{
Expand All @@ -68,7 +68,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":20,
"metric":10,
"installed":true,
"nexthops":[
{
Expand All @@ -86,7 +86,7 @@
"vrfId":0,
"vrfName":"default",
"distance":110,
"metric":10,
"metric":0,
"nexthops":[
{
"directlyConnected":true,
Expand All @@ -105,7 +105,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":40,
"metric":30,
"installed":true,
"nexthops":[
{
Expand All @@ -125,7 +125,7 @@
"selected":true,
"destSelected":true,
"distance":110,
"metric":50,
"metric":40,
"installed":true,
"nexthops":[
{
Expand Down
Loading

0 comments on commit 1c44c6b

Please sign in to comment.