Deleted Added
full compact
in6_pcb.c (189848) in6_pcb.c (191672)
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>
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 189848 2009-03-15 09:58:31Z rwatson $");
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;
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 struct in6_multi_mship *imm, *nimm;
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;
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) &&
743 im6o) {
742 if ((in6p->inp_vflag & INP_IPV6) && im6o != NULL) {
744 /*
743 /*
745 * Unselect the outgoing interface if it is being
746 * detached.
744 * Unselect the outgoing ifp for multicast if it
745 * is being detached.
747 */
748 if (im6o->im6o_multicast_ifp == ifp)
749 im6o->im6o_multicast_ifp = NULL;
746 */
747 if (im6o->im6o_multicast_ifp == ifp)
748 im6o->im6o_multicast_ifp = NULL;
750
751 /*
752 * Drop multicast group membership if we joined
753 * through the interface being detached.
749 /*
750 * Drop multicast group membership if we joined
751 * through the interface being detached.
754 * XXX controversial - is it really legal for kernel
755 * to force this?
756 */
752 */
757 for (imm = im6o->im6o_memberships.lh_first;
758 imm != NULL; imm = nimm) {
759 nimm = imm->i6mm_chain.le_next;
760 if (imm->i6mm_maddr->in6m_ifp == ifp) {
761 LIST_REMOVE(imm, i6mm_chain);
762 in6_delmulti(imm->i6mm_maddr);
763 free(imm, M_IP6MADDR);
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];
764 }
765 }
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 ---
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 ---