Deleted Added
full compact
in6_ifattach.c (191340) in6_ifattach.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

--- 16 unchanged lines hidden (view full) ---

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $KAME: in6_ifattach.c,v 1.118 2001/05/24 07:44:00 itojun Exp $
30 */
31
32#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

--- 16 unchanged lines hidden (view full) ---

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $KAME: in6_ifattach.c,v 1.118 2001/05/24 07:44:00 itojun Exp $
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/netinet6/in6_ifattach.c 191340 2009-04-20 22:45:21Z rwatson $");
33__FBSDID("$FreeBSD: head/sys/netinet6/in6_ifattach.c 191672 2009-04-29 19:19:13Z bms $");
34
35#include "opt_route.h"
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/malloc.h>
40#include <sys/socket.h>
41#include <sys/sockio.h>

--- 16 unchanged lines hidden (view full) ---

58
59#include <netinet/ip6.h>
60#include <netinet6/ip6_var.h>
61#include <netinet6/in6_var.h>
62#include <netinet6/in6_pcb.h>
63#include <netinet6/in6_ifattach.h>
64#include <netinet6/ip6_var.h>
65#include <netinet6/nd6.h>
34
35#include "opt_route.h"
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/malloc.h>
40#include <sys/socket.h>
41#include <sys/sockio.h>

--- 16 unchanged lines hidden (view full) ---

58
59#include <netinet/ip6.h>
60#include <netinet6/ip6_var.h>
61#include <netinet6/in6_var.h>
62#include <netinet6/in6_pcb.h>
63#include <netinet6/in6_ifattach.h>
64#include <netinet6/ip6_var.h>
65#include <netinet6/nd6.h>
66#include <netinet6/mld6_var.h>
66#include <netinet6/scope6_var.h>
67#include <netinet6/vinet6.h>
68
69#ifdef VIMAGE_GLOBALS
70unsigned long in6_maxmtu;
71int ip6_auto_linklocal;
72struct callout in6_tmpaddrtimer_ch;
73extern struct inpcbinfo ripcbinfo;

--- 839 unchanged lines hidden (view full) ---

913 }
914 }
915
916}
917
918static void
919in6_purgemaddrs(struct ifnet *ifp)
920{
67#include <netinet6/scope6_var.h>
68#include <netinet6/vinet6.h>
69
70#ifdef VIMAGE_GLOBALS
71unsigned long in6_maxmtu;
72int ip6_auto_linklocal;
73struct callout in6_tmpaddrtimer_ch;
74extern struct inpcbinfo ripcbinfo;

--- 839 unchanged lines hidden (view full) ---

914 }
915 }
916
917}
918
919static void
920in6_purgemaddrs(struct ifnet *ifp)
921{
921 struct in6_multi *in6m;
922 struct in6_multi *oin6m;
922 INIT_VNET_INET6(ifp->if_vnet);
923 LIST_HEAD(,in6_multi) purgeinms;
924 struct in6_multi *inm, *tinm;
925 struct ifmultiaddr *ifma;
923
926
924 LIST_FOREACH_SAFE(in6m, &in6_multihead, in6m_entry, oin6m) {
925 if (in6m->in6m_ifp == ifp)
926 in6_delmulti(in6m);
927 LIST_INIT(&purgeinms);
928 IN6_MULTI_LOCK();
929
930 /*
931 * Extract list of in6_multi associated with the detaching ifp
932 * which the PF_INET6 layer is about to release.
933 * We need to do this as IF_ADDR_LOCK() may be re-acquired
934 * by code further down.
935 */
936 IF_ADDR_LOCK(ifp);
937 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
938 if (ifma->ifma_addr->sa_family != AF_INET6 ||
939 ifma->ifma_protospec == NULL)
940 continue;
941 inm = (struct in6_multi *)ifma->ifma_protospec;
942 LIST_INSERT_HEAD(&purgeinms, inm, in6m_entry);
927 }
943 }
944 IF_ADDR_UNLOCK(ifp);
945
946 LIST_FOREACH_SAFE(inm, &purgeinms, in6m_entry, tinm) {
947 LIST_REMOVE(inm, in6m_entry);
948 in6m_release_locked(inm);
949 }
950 mld_ifdetach(ifp);
951
952 IN6_MULTI_UNLOCK();
928}
953}