mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
netlink: unregister groups along with family
Differential Revision: https://reviews.freebsd.org/D37308 Reviewed by: melifaro
This commit is contained in:
parent
b935e867af
commit
1edc3b6e56
|
@ -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