mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-16 08:32:45 +00:00
Merge pull request #9107 from donaldsharp/label_destruction
zebra: On client shutdown cleanup any vrf labels associated with it
This commit is contained in:
commit
631fce38ff
@ -3107,6 +3107,8 @@ static void zread_vrf_label(ZAPI_HANDLER_ARGS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
zvrf->label[afi] = nlabel;
|
zvrf->label[afi] = nlabel;
|
||||||
|
zvrf->label_proto[afi] = client->proto;
|
||||||
|
|
||||||
stream_failure:
|
stream_failure:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3931,6 +3931,40 @@ void zebra_mpls_cleanup_tables(struct zebra_vrf *zvrf)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When a vrf label is assigned and the client goes away
|
||||||
|
* we should cleanup the vrf labels associated with
|
||||||
|
* that zclient.
|
||||||
|
*/
|
||||||
|
void zebra_mpls_client_cleanup_vrf_label(uint8_t proto)
|
||||||
|
{
|
||||||
|
struct vrf *vrf;
|
||||||
|
struct zebra_vrf *def_zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
|
||||||
|
|
||||||
|
if (def_zvrf == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
|
||||||
|
struct zebra_vrf *zvrf = vrf->info;
|
||||||
|
afi_t afi;
|
||||||
|
|
||||||
|
if (!zvrf)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (afi = AFI_IP; afi < AFI_MAX; afi++) {
|
||||||
|
if (zvrf->label_proto[afi] == proto
|
||||||
|
&& zvrf->label[afi] != MPLS_LABEL_NONE)
|
||||||
|
lsp_uninstall(def_zvrf, zvrf->label[afi]);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Cleanup data structures by fiat
|
||||||
|
*/
|
||||||
|
zvrf->label_proto[afi] = 0;
|
||||||
|
zvrf->label[afi] = MPLS_LABEL_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called upon process exiting, need to delete LSP forwarding
|
* Called upon process exiting, need to delete LSP forwarding
|
||||||
* entries from the kernel.
|
* entries from the kernel.
|
||||||
|
@ -416,6 +416,12 @@ void zebra_mpls_init(void);
|
|||||||
*/
|
*/
|
||||||
void zebra_mpls_vty_init(void);
|
void zebra_mpls_vty_init(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When cleaning up a client connection ensure that there are no
|
||||||
|
* vrf labels that need cleaning up too
|
||||||
|
*/
|
||||||
|
void zebra_mpls_client_cleanup_vrf_label(uint8_t proto);
|
||||||
|
|
||||||
/* Inline functions. */
|
/* Inline functions. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -105,6 +105,7 @@ struct zebra_vrf {
|
|||||||
|
|
||||||
/* MPLS Label to handle L3VPN <-> vrf popping */
|
/* MPLS Label to handle L3VPN <-> vrf popping */
|
||||||
mpls_label_t label[AFI_MAX];
|
mpls_label_t label[AFI_MAX];
|
||||||
|
uint8_t label_proto[AFI_MAX];
|
||||||
|
|
||||||
/* MPLS static LSP config table */
|
/* MPLS static LSP config table */
|
||||||
struct hash *slsp_table;
|
struct hash *slsp_table;
|
||||||
|
@ -595,6 +595,8 @@ static void zserv_client_free(struct zserv *client)
|
|||||||
close(client->sock);
|
close(client->sock);
|
||||||
|
|
||||||
if (DYNAMIC_CLIENT_GR_DISABLED(client)) {
|
if (DYNAMIC_CLIENT_GR_DISABLED(client)) {
|
||||||
|
zebra_mpls_client_cleanup_vrf_label(client->proto);
|
||||||
|
|
||||||
nroutes = rib_score_proto(client->proto,
|
nroutes = rib_score_proto(client->proto,
|
||||||
client->instance);
|
client->instance);
|
||||||
zlog_notice(
|
zlog_notice(
|
||||||
|
Loading…
Reference in New Issue
Block a user