diff options
author | ume <ume@FreeBSD.org> | 2001-08-04 17:10:14 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2001-08-04 17:10:14 +0000 |
commit | 215c0c107efbdc79c1fc7eb07321d5285fc338d2 (patch) | |
tree | 7b7ce4133ecd9652e3448fa7d662f6e27859de96 /sys/netinet/in_pcb.c | |
parent | edba6eee5eb38b18947df183e9a90212979525ed (diff) | |
download | FreeBSD-src-215c0c107efbdc79c1fc7eb07321d5285fc338d2.zip FreeBSD-src-215c0c107efbdc79c1fc7eb07321d5285fc338d2.tar.gz |
When running aplication joined multicast address,
removing network card, and kill aplication.
imo_membership[].inm_ifp refer interface pointer
after removing interface.
When kill aplication, release socket,and imo_membership.
imo_membership use already not exist interface pointer.
Then, kernel panic.
PR: 29345
Submitted by: Inoue Yuichi <inoue@nd.net.fujitsu.co.jp>
Obtained from: KAME
MFC after: 3 days
Diffstat (limited to 'sys/netinet/in_pcb.c')
-rw-r--r-- | sys/netinet/in_pcb.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 2d31c30..c967851 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -689,6 +689,44 @@ in_pcbnotifyall(head, faddr, errno, notify) splx(s); } +void +in_pcbpurgeif0(head, ifp) + struct inpcb *head; + struct ifnet *ifp; +{ + struct inpcb *inp; + struct ip_moptions *imo; + int i, gap; + + for (inp = head; inp != NULL; inp = LIST_NEXT(inp, inp_list)) { + imo = inp->inp_moptions; + if ((inp->inp_vflag & INP_IPV4) && + imo != NULL) { + /* + * Unselect the outgoing interface if it is being + * detached. + */ + if (imo->imo_multicast_ifp == ifp) + imo->imo_multicast_ifp = NULL; + + /* + * Drop multicast group membership if we joined + * through the interface being detached. + */ + for (i = 0, gap = 0; i < imo->imo_num_memberships; + i++) { + if (imo->imo_membership[i]->inm_ifp == ifp) { + in_delmulti(imo->imo_membership[i]); + gap++; + } else if (gap != 0) + imo->imo_membership[i - gap] = + imo->imo_membership[i]; + } + imo->imo_num_memberships -= gap; + } + } +} + /* * Check for alternatives when higher level complains * about service problems. For now, invalidate cached |