purge rti structure (in igmp.c) for removed ifp on if_detach().

This commit is contained in:
itojun 2003-06-26 03:11:08 +00:00
parent b659db9760
commit bef80abb93
3 changed files with 33 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: igmp.c,v 1.33 2003/06/15 02:49:32 matt Exp $ */
/* $NetBSD: igmp.c,v 1.34 2003/06/26 03:11:08 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.33 2003/06/15 02:49:32 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.34 2003/06/26 03:11:08 itojun Exp $");
#include "opt_mrouting.h"
@ -72,7 +72,8 @@ static LIST_HEAD(, router_info) rti_head = LIST_HEAD_INITIALIZER(rti_head);
void igmp_sendpkt __P((struct in_multi *, int));
static int rti_fill __P((struct in_multi *));
static struct router_info * rti_find __P((struct ifnet *));
static struct router_info *rti_find __P((struct ifnet *));
static void rti_delete(struct ifnet *);
void
igmp_init()
@ -128,6 +129,21 @@ rti_find(ifp)
return (rti);
}
static void
rti_delete(ifp)
struct ifnet *ifp;
{
struct router_info *rti;
LIST_FOREACH(rti, &rti_head, rti_link) {
if (rti->rti_ifp == ifp) {
LIST_REMOVE(rti, rti_link);
pool_put(&igmp_rti_pool, rti);
return;
}
}
}
void
#if __STDC__
igmp_input(struct mbuf *m, ...)
@ -573,3 +589,11 @@ igmp_sendpkt(inm, type)
++igmpstat.igps_snd_reports;
}
void
igmp_purgeif(ifp)
struct ifnet *ifp;
{
rti_delete(ifp);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: igmp_var.h,v 1.15 2003/06/15 02:49:32 matt Exp $ */
/* $NetBSD: igmp_var.h,v 1.16 2003/06/26 03:11:08 itojun Exp $ */
/*
* Copyright (c) 1988 Stephen Deering.
@ -87,6 +87,7 @@ int igmp_joingroup __P((struct in_multi *));
void igmp_leavegroup __P((struct in_multi *));
void igmp_fasttimo __P((void));
void igmp_slowtimo __P((void));
extern void igmp_purgeif(struct ifnet *);
#endif
#endif /* _NETINET_IGMP_VAR_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: in.c,v 1.86 2003/06/26 00:43:31 itojun Exp $ */
/* $NetBSD: in.c,v 1.87 2003/06/26 03:11:08 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -102,7 +102,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.86 2003/06/26 00:43:31 itojun Exp $");
__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.87 2003/06/26 03:11:08 itojun Exp $");
#include "opt_inet.h"
#include "opt_inet_conf.h"
@ -601,6 +601,8 @@ in_purgeif(ifp)
continue;
in_purgeaddr(ifa, ifp);
}
igmp_purgeif(ifp);
}
/*