Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ospf6d: Set loopback interface cost to 0 #14635

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading