Deleted Added
full compact
64c64
< __FBSDID("$FreeBSD: head/sys/netinet6/in6_pcb.c 189848 2009-03-15 09:58:31Z rwatson $");
---
> __FBSDID("$FreeBSD: head/sys/netinet6/in6_pcb.c 191672 2009-04-29 19:19:13Z bms $");
736c736
< struct in6_multi_mship *imm, *nimm;
---
> int i, gap;
742,743c742
< if ((in6p->inp_vflag & INP_IPV6) &&
< im6o) {
---
> if ((in6p->inp_vflag & INP_IPV6) && im6o != NULL) {
745,746c744,745
< * Unselect the outgoing interface if it is being
< * detached.
---
> * Unselect the outgoing ifp for multicast if it
> * is being detached.
750d748
<
754,755d751
< * XXX controversial - is it really legal for kernel
< * to force this?
757,763c753,762
< for (imm = im6o->im6o_memberships.lh_first;
< imm != NULL; imm = nimm) {
< nimm = imm->i6mm_chain.le_next;
< if (imm->i6mm_maddr->in6m_ifp == ifp) {
< LIST_REMOVE(imm, i6mm_chain);
< in6_delmulti(imm->i6mm_maddr);
< free(imm, M_IP6MADDR);
---
> gap = 0;
> for (i = 0; i < im6o->im6o_num_memberships; i++) {
> if (im6o->im6o_membership[i]->in6m_ifp ==
> ifp) {
> in6_mc_leave(im6o->im6o_membership[i],
> NULL);
> gap++;
> } else if (gap != 0) {
> im6o->im6o_membership[i - gap] =
> im6o->im6o_membership[i];
765a765
> im6o->im6o_num_memberships -= gap;