mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 22:30:43 +00:00
isisd: introduce new adjacency hooks
The 'isis_adj_ip_enabled_hook' hook will be called whenever an adjacency goes from zero to one or more IPv4 or IPv6 addresses. Conversely, the 'isis_adj_ip_disabled_hook' hook will be called whenever an adjacency goes from one or more IPv4/IPv6 addresses to no addresses at all. These hooks will be used by the upcoming SR code to add/delete Adj-SIDs depending on the IP addresses present in the remote adjacencies. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
parent
0b7005375f
commit
3056368301
@ -118,6 +118,10 @@ void isis_adj_process_threeway(struct isis_adjacency *adj,
|
||||
struct isis_threeway_adj *tw_adj,
|
||||
enum isis_adj_usage adj_usage);
|
||||
DECLARE_HOOK(isis_adj_state_change_hook, (struct isis_adjacency *adj), (adj))
|
||||
DECLARE_HOOK(isis_adj_ip_enabled_hook,
|
||||
(struct isis_adjacency *adj, int family), (adj, family))
|
||||
DECLARE_HOOK(isis_adj_ip_disabled_hook,
|
||||
(struct isis_adjacency *adj, int family), (adj, family))
|
||||
void isis_adj_state_change(struct isis_adjacency **adj,
|
||||
enum isis_adj_state state, const char *reason);
|
||||
void isis_adj_print(struct isis_adjacency *adj);
|
||||
|
@ -4413,10 +4413,22 @@ static void tlvs_protocols_supported_to_adj(struct isis_tlvs *tlvs,
|
||||
memcpy(adj->nlpids.nlpids, reduced.nlpids, reduced.count);
|
||||
}
|
||||
|
||||
DEFINE_HOOK(isis_adj_ip_enabled_hook, (struct isis_adjacency *adj, int family),
|
||||
(adj, family))
|
||||
DEFINE_HOOK(isis_adj_ip_disabled_hook,
|
||||
(struct isis_adjacency *adj, int family), (adj, family))
|
||||
|
||||
static void tlvs_ipv4_addresses_to_adj(struct isis_tlvs *tlvs,
|
||||
struct isis_adjacency *adj,
|
||||
bool *changed)
|
||||
{
|
||||
bool ipv4_enabled = false;
|
||||
|
||||
if (adj->ipv4_address_count == 0 && tlvs->ipv4_address.count > 0)
|
||||
ipv4_enabled = true;
|
||||
else if (adj->ipv4_address_count > 0 && tlvs->ipv4_address.count == 0)
|
||||
hook_call(isis_adj_ip_disabled_hook, adj, AF_INET);
|
||||
|
||||
if (adj->ipv4_address_count != tlvs->ipv4_address.count) {
|
||||
*changed = true;
|
||||
adj->ipv4_address_count = tlvs->ipv4_address.count;
|
||||
@ -4440,12 +4452,22 @@ static void tlvs_ipv4_addresses_to_adj(struct isis_tlvs *tlvs,
|
||||
*changed = true;
|
||||
adj->ipv4_addresses[i] = addr->addr;
|
||||
}
|
||||
|
||||
if (ipv4_enabled)
|
||||
hook_call(isis_adj_ip_enabled_hook, adj, AF_INET);
|
||||
}
|
||||
|
||||
static void tlvs_ipv6_addresses_to_adj(struct isis_tlvs *tlvs,
|
||||
struct isis_adjacency *adj,
|
||||
bool *changed)
|
||||
{
|
||||
bool ipv6_enabled = false;
|
||||
|
||||
if (adj->ipv6_address_count == 0 && tlvs->ipv6_address.count > 0)
|
||||
ipv6_enabled = true;
|
||||
else if (adj->ipv6_address_count > 0 && tlvs->ipv6_address.count == 0)
|
||||
hook_call(isis_adj_ip_disabled_hook, adj, AF_INET6);
|
||||
|
||||
if (adj->ipv6_address_count != tlvs->ipv6_address.count) {
|
||||
*changed = true;
|
||||
adj->ipv6_address_count = tlvs->ipv6_address.count;
|
||||
@ -4469,6 +4491,9 @@ static void tlvs_ipv6_addresses_to_adj(struct isis_tlvs *tlvs,
|
||||
*changed = true;
|
||||
adj->ipv6_addresses[i] = addr->addr;
|
||||
}
|
||||
|
||||
if (ipv6_enabled)
|
||||
hook_call(isis_adj_ip_enabled_hook, adj, AF_INET6);
|
||||
}
|
||||
|
||||
void isis_tlvs_to_adj(struct isis_tlvs *tlvs, struct isis_adjacency *adj,
|
||||
|
Loading…
Reference in New Issue
Block a user