diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2021-10-05 21:25:55 -0300 | 
|---|---|---|
| committer | Renato Westphal <renato@opensourcerouting.org> | 2021-10-05 21:25:55 -0300 | 
| commit | 5f2fe4bb77662abca01557ed5808b7d0d8612e1f (patch) | |
| tree | 5b9535c05b778f644918123ffe6b77a2db1d30cd /ospf6d/ospf6_nssa.c | |
| parent | 576e842480034f99b5757f0b0b63b5bbb586ccf8 (diff) | |
ospf6d: fix selection of NSSA forwarding address
Change ospf6_get_nssa_fwd_addr() to try finding a global address
on any interface of the area and not on the first one only.
Additionally, do a micro-optimization in
ospf6_interface_get_global_address() to return as soon as a global
address is found.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ospf6d/ospf6_nssa.c')
| -rw-r--r-- | ospf6d/ospf6_nssa.c | 12 | 
1 files changed, 8 insertions, 4 deletions
diff --git a/ospf6d/ospf6_nssa.c b/ospf6d/ospf6_nssa.c index 282eea8526..de0c39ba22 100644 --- a/ospf6d/ospf6_nssa.c +++ b/ospf6d/ospf6_nssa.c @@ -1249,10 +1249,14 @@ static struct in6_addr *ospf6_get_nssa_fwd_addr(struct ospf6_area *oa)  	struct ospf6_interface *oi;  	for (ALL_LIST_ELEMENTS(oa->if_list, node, nnode, oi)) { -		if (if_is_operative(oi->interface)) -			if (oi->area && IS_AREA_NSSA(oi->area)) -				return ospf6_interface_get_global_address( -					oi->interface); +		struct in6_addr *addr; + +		if (!if_is_operative(oi->interface)) +			continue; + +		addr = ospf6_interface_get_global_address(oi->interface); +		if (addr) +			return addr;  	}  	return NULL;  }  | 
