mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
netlink: unregister groups along with family
Differential Revision: https://reviews.freebsd.org/D37308
Reviewed by: melifaro
(cherry picked from commit 1edc3b6e56)
This commit is contained in:
parent
286b49d4ea
commit
da988f4052
1 changed files with 17 additions and 0 deletions
|
|
@ -133,6 +133,22 @@ free_family(struct genl_family *gf)
|
|||
free(gf->family_cmds, M_NETLINK);
|
||||
}
|
||||
|
||||
/*
|
||||
* unregister groups of a given family
|
||||
*/
|
||||
static void
|
||||
unregister_groups(const struct genl_family *gf)
|
||||
{
|
||||
|
||||
for (int i = 0; i < MAX_GROUPS; i++) {
|
||||
struct genl_group *gg = &groups[i];
|
||||
if (gg->group_family == gf && gg->group_name != NULL) {
|
||||
gg->group_family = NULL;
|
||||
gg->group_name = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Can sleep, I guess
|
||||
*/
|
||||
|
|
@ -148,6 +164,7 @@ genl_unregister_family(const char *family_name)
|
|||
|
||||
if (gf != NULL) {
|
||||
found = true;
|
||||
unregister_groups(gf);
|
||||
/* TODO: zero pointer first */
|
||||
free_family(gf);
|
||||
bzero(gf, sizeof(*gf));
|
||||
|
|
|
|||
Loading…
Reference in a new issue