mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-09 09:47:11 +00:00
zebra: Allow for deletion of rules when the originator goes away
When zebra detects that the originator has dissapeared delete all rules associated with that client. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
46fe6fd557
commit
e69aa08419
@ -133,6 +133,25 @@ void zebra_pbr_del_rule(struct zebra_ns *zns, struct zebra_pbr_rule *rule)
|
||||
__PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
static void zebra_pbr_cleanup_rules(struct hash_backet *b, void *data)
|
||||
{
|
||||
struct zebra_ns *zns = zebra_ns_lookup(NS_DEFAULT);
|
||||
struct zebra_pbr_rule *rule = b->data;
|
||||
int *sock = data;
|
||||
|
||||
if (rule->sock == *sock) {
|
||||
kernel_del_pbr_rule(rule);
|
||||
hash_release(zns->rules_hash, rule);
|
||||
}
|
||||
}
|
||||
|
||||
void zebra_pbr_client_close_cleanup(int sock)
|
||||
{
|
||||
struct zebra_ns *zns = zebra_ns_lookup(NS_DEFAULT);
|
||||
|
||||
hash_iterate(zns->rules_hash, zebra_pbr_cleanup_rules, &sock);
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle success or failure of rule (un)install in the kernel.
|
||||
*/
|
||||
|
@ -132,7 +132,10 @@ extern void kernel_pbr_rule_add_del_status(struct zebra_pbr_rule *rule,
|
||||
*/
|
||||
extern int kernel_pbr_rule_del(struct zebra_pbr_rule *rule);
|
||||
|
||||
extern void zebra_pbr_client_close_cleanup(int sock);
|
||||
|
||||
extern void zebra_pbr_rules_free(void *arg);
|
||||
extern uint32_t zebra_pbr_rules_hash_key(void *arg);
|
||||
extern int zebra_pbr_rules_hash_equal(const void *arg1, const void *arg2);
|
||||
|
||||
#endif /* _ZEBRA_PBR_H */
|
||||
|
@ -2631,6 +2631,9 @@ static void zebra_client_free(struct zserv *client)
|
||||
/* Send client de-registration to BFD */
|
||||
zebra_ptm_bfd_client_deregister(client->proto);
|
||||
|
||||
/* Cleanup any rules installed from this client */
|
||||
zebra_pbr_client_close_cleanup(client->sock);
|
||||
|
||||
/* Cleanup any registered nexthops - across all VRFs. */
|
||||
zebra_client_close_cleanup_rnh(client);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user