__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.
*/
*/
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 */
/* 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);