1/*- 2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 47 unchanged lines hidden (view full) --- 56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 * SUCH DAMAGE. 59 * 60 * @(#)in_pcb.c 8.2 (Berkeley) 1/4/94 61 */ 62 63#include <sys/cdefs.h> |
64__FBSDID("$FreeBSD: head/sys/netinet6/in6_pcb.c 191672 2009-04-29 19:19:13Z bms $"); |
65 66#include "opt_inet.h" 67#include "opt_inet6.h" 68#include "opt_ipsec.h" 69#include "opt_mac.h" 70 71#include <sys/param.h> 72#include <sys/systm.h> --- 655 unchanged lines hidden (view full) --- 728 } 729} 730 731void 732in6_pcbpurgeif0(struct inpcbinfo *pcbinfo, struct ifnet *ifp) 733{ 734 struct inpcb *in6p; 735 struct ip6_moptions *im6o; |
736 int i, gap; |
737 738 INP_INFO_RLOCK(pcbinfo); 739 LIST_FOREACH(in6p, pcbinfo->ipi_listhead, inp_list) { 740 INP_WLOCK(in6p); 741 im6o = in6p->in6p_moptions; |
742 if ((in6p->inp_vflag & INP_IPV6) && im6o != NULL) { |
743 /* |
744 * Unselect the outgoing ifp for multicast if it 745 * is being detached. |
746 */ 747 if (im6o->im6o_multicast_ifp == ifp) 748 im6o->im6o_multicast_ifp = NULL; |
749 /* 750 * Drop multicast group membership if we joined 751 * through the interface being detached. |
752 */ |
753 gap = 0; 754 for (i = 0; i < im6o->im6o_num_memberships; i++) { 755 if (im6o->im6o_membership[i]->in6m_ifp == 756 ifp) { 757 in6_mc_leave(im6o->im6o_membership[i], 758 NULL); 759 gap++; 760 } else if (gap != 0) { 761 im6o->im6o_membership[i - gap] = 762 im6o->im6o_membership[i]; |
763 } 764 } |
765 im6o->im6o_num_memberships -= gap; |
766 } 767 INP_WUNLOCK(in6p); 768 } 769 INP_INFO_RUNLOCK(pcbinfo); 770} 771 772/* 773 * Check for alternatives when higher level complains --- 159 unchanged lines hidden --- |