fib: Adjacency creation notifications for dlegates
Type: feature Signed-off-by: Neale Ranns <nranns@cisco.com> Change-Id: I3feddfe44dee528b9ca05aa0150e9423306ae49d
This commit is contained in:
@@ -140,6 +140,20 @@ adj_delegate_adj_deleted (ip_adjacency_t *adj)
|
||||
vec_reset_length(adj->ia_delegates);
|
||||
}
|
||||
|
||||
void
|
||||
adj_delegate_adj_created (ip_adjacency_t *adj)
|
||||
{
|
||||
adj_delegate_vft_t *vft;
|
||||
|
||||
vec_foreach(vft, ad_vfts)
|
||||
{
|
||||
if (vft->adv_adj_created)
|
||||
{
|
||||
vft->adv_adj_created(adj_get_index(adj));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u8*
|
||||
adj_delegate_format (u8* s, ip_adjacency_t *adj)
|
||||
{
|
||||
|
||||
@@ -77,12 +77,18 @@ typedef void (*adj_delegate_adj_deleted_t)(adj_delegate_t *aed);
|
||||
*/
|
||||
typedef u8 * (*adj_delegate_format_t)(const adj_delegate_t *aed, u8 *s);
|
||||
|
||||
/**
|
||||
* Notification that an adjacency has been created
|
||||
*/
|
||||
typedef u8 * (*adj_delegate_adj_created_t)(adj_index_t ai);
|
||||
|
||||
/**
|
||||
* An ADJ delegate virtual function table
|
||||
*/
|
||||
typedef struct adj_delegate_vft_t_ {
|
||||
adj_delegate_format_t adv_format;
|
||||
adj_delegate_adj_deleted_t adv_adj_deleted;
|
||||
adj_delegate_adj_created_t adv_adj_created;
|
||||
} adj_delegate_vft_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -91,6 +91,8 @@ adj_glean_add_or_lock (fib_protocol_t proto,
|
||||
adj_lock(adj_get_index(adj));
|
||||
}
|
||||
|
||||
adj_delegate_adj_created(adj);
|
||||
|
||||
return (adj_get_index(adj));
|
||||
}
|
||||
|
||||
|
||||
@@ -136,6 +136,7 @@ extern int adj_bfd_is_up (adj_index_t ai);
|
||||
* Adj delegates
|
||||
*/
|
||||
extern void adj_delegate_adj_deleted(ip_adjacency_t *adj);
|
||||
extern void adj_delegate_adj_created(ip_adjacency_t *adj);
|
||||
extern u8* adj_delegate_format(u8* s, ip_adjacency_t *adj);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -88,6 +88,8 @@ adj_mcast_add_or_lock (fib_protocol_t proto,
|
||||
adj_lock(adj_get_index(adj));
|
||||
}
|
||||
|
||||
adj_delegate_adj_created(adj);
|
||||
|
||||
return (adj_get_index(adj));
|
||||
}
|
||||
|
||||
|
||||
@@ -221,12 +221,12 @@ adj_nbr_add_or_lock (fib_protocol_t nh_proto,
|
||||
u32 sw_if_index)
|
||||
{
|
||||
adj_index_t adj_index;
|
||||
ip_adjacency_t *adj;
|
||||
|
||||
adj_index = adj_nbr_find(nh_proto, link_type, nh_addr, sw_if_index);
|
||||
|
||||
if (ADJ_INDEX_INVALID == adj_index)
|
||||
{
|
||||
ip_adjacency_t *adj;
|
||||
vnet_main_t *vnm;
|
||||
|
||||
vnm = vnet_get_main();
|
||||
@@ -256,6 +256,7 @@ adj_nbr_add_or_lock (fib_protocol_t nh_proto,
|
||||
adj_lock(adj_index);
|
||||
}
|
||||
|
||||
adj_delegate_adj_created(adj_get(adj_index));
|
||||
return (adj_index);
|
||||
}
|
||||
|
||||
@@ -284,6 +285,8 @@ adj_nbr_add_or_lock_w_rewrite (fib_protocol_t nh_proto,
|
||||
ADJ_NBR_REWRITE_FLAG_COMPLETE,
|
||||
rewrite);
|
||||
|
||||
adj_delegate_adj_created(adj_get(adj_index));
|
||||
|
||||
return (adj_index);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user