Merge SVN r295220 (bz) from projects/vnet/

Fix a panic that occurs when a vnet interface is unavailable at the time the
vnet jail referencing said interface is stopped.

Sponsored by:	FIS Global, Inc.
This commit is contained in:
Devin Teske 2016-02-11 17:07:19 +00:00
commit 41c0ec9a16
3 changed files with 19 additions and 2 deletions

View File

@ -353,10 +353,24 @@ rt_table_init(int offset)
return (rh);
}
static int
rt_freeentry(struct radix_node *rn, void *arg)
{
struct radix_head * const rnh = arg;
struct radix_node *x;
x = (struct radix_node *)rn_delete(rn + 2, NULL, rnh);
if (x != NULL)
R_Free(x);
return (0);
}
void
rt_table_destroy(struct rib_head *rh)
{
rn_walktree(&rh->rmhead.head, rt_freeentry, &rh->rmhead.head);
/* Assume table is already empty */
rw_destroy(&rh->rib_lock);
free(rh, M_RTABLE);

View File

@ -133,7 +133,8 @@ int
in_detachhead(void **head, int off)
{
return (rn_detachhead(head));
rt_table_destroy((struct rib_head *)(*head));
return (1);
}
#endif

View File

@ -237,7 +237,9 @@ in6_detachhead(void **head, int off)
{
callout_drain(&V_rtq_mtutimer);
return (rn_detachhead(head));
rt_table_destroy((struct rib_head *)(*head));
return (1);
}
#endif