diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2021-07-20 17:13:22 +0200 | 
|---|---|---|
| committer | Adriano Marto Reis <adrianomarto@gmail.com> | 2023-10-10 07:54:56 +1000 | 
| commit | 73940e52f285819b1d548b4e7128f7946c6bfe39 (patch) | |
| tree | e9e169ec8fc9b2e94639737fd8490b3089ef3ba8 /ospf6d | |
| parent | 6fdd69ed0755526f1ea0b058770d449b28142cc7 (diff) | |
ospf6d: factor out link-local addr change
For PtMP the cost may need to be recalculated when the LL addr changes
(since neighbors are configured by LL addr and a different entry with a
different cost may match.)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'ospf6d')
| -rw-r--r-- | ospf6d/ospf6_message.c | 2 | ||||
| -rw-r--r-- | ospf6d/ospf6_neighbor.c | 9 | ||||
| -rw-r--r-- | ospf6d/ospf6_neighbor.h | 3 | 
3 files changed, 13 insertions, 1 deletions
diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 07da9a5ec1..b50b408ead 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -479,7 +479,7 @@ static void ospf6_hello_recv(struct in6_addr *src, struct in6_addr *dst,  	on->hello_in++;  	/* Always override neighbor's source address */ -	memcpy(&on->linklocal_addr, src, sizeof(struct in6_addr)); +	ospf6_neighbor_lladdr_set(on, src);  	/* Neighbor ifindex check */  	if (on->ifindex != (ifindex_t)ntohl(hello->interface_id)) { diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index e1aec06f8e..d7d0d305f6 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -182,6 +182,15 @@ void ospf6_neighbor_delete(struct ospf6_neighbor *on)  	XFREE(MTYPE_OSPF6_NEIGHBOR, on);  } +void ospf6_neighbor_lladdr_set(struct ospf6_neighbor *on, +			       const struct in6_addr *addr) +{ +	if (IPV6_ADDR_SAME(addr, &on->linklocal_addr)) +		return; + +	memcpy(&on->linklocal_addr, addr, sizeof(struct in6_addr)); +} +  static void ospf6_neighbor_state_change(uint8_t next_state,  					struct ospf6_neighbor *on, int event)  { diff --git a/ospf6d/ospf6_neighbor.h b/ospf6d/ospf6_neighbor.h index 226f4c1322..f8bab6dc9a 100644 --- a/ospf6d/ospf6_neighbor.h +++ b/ospf6d/ospf6_neighbor.h @@ -190,6 +190,9 @@ struct ospf6_neighbor *ospf6_neighbor_create(uint32_t router_id,  					     struct ospf6_interface *oi);  void ospf6_neighbor_delete(struct ospf6_neighbor *on); +void ospf6_neighbor_lladdr_set(struct ospf6_neighbor *on, +			       const struct in6_addr *addr); +  /* Neighbor event */  extern void hello_received(struct event *thread);  extern void twoway_received(struct event *thread);  | 
