in6_ifattach.c (297192) | in6_ifattach.c (302054) |
---|---|
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 297192 2016-03-22 15:43:47Z bz $"); | 33__FBSDID("$FreeBSD: head/sys/netinet6/in6_ifattach.c 302054 2016-06-21 13:48:49Z bz $"); |
34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/malloc.h> 38#include <sys/socket.h> 39#include <sys/sockio.h> 40#include <sys/jail.h> 41#include <sys/kernel.h> --- 714 unchanged lines hidden (view full) --- 756 757 /* update dynamically. */ 758 if (V_in6_maxmtu < ifp->if_mtu) 759 V_in6_maxmtu = ifp->if_mtu; 760} 761 762/* 763 * NOTE: in6_ifdetach() does not support loopback if at this moment. | 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/malloc.h> 38#include <sys/socket.h> 39#include <sys/sockio.h> 40#include <sys/jail.h> 41#include <sys/kernel.h> --- 714 unchanged lines hidden (view full) --- 756 757 /* update dynamically. */ 758 if (V_in6_maxmtu < ifp->if_mtu) 759 V_in6_maxmtu = ifp->if_mtu; 760} 761 762/* 763 * NOTE: in6_ifdetach() does not support loopback if at this moment. |
764 * We don't need this function in bsdi, because interfaces are never removed 765 * from the ifnet list in bsdi. | 764 * 765 * When shutting down a VNET we clean up layers top-down. In that case 766 * upper layer protocols (ulp) are cleaned up already and locks are destroyed 767 * and we must not call into these cleanup functions anymore, thus purgeulp 768 * is set to 0 in that case by in6_ifdetach_destroy(). 769 * The normal case of destroying a (cloned) interface still needs to cleanup 770 * everything related to the interface and will have purgeulp set to 1. |
766 */ | 771 */ |
767void 768in6_ifdetach(struct ifnet *ifp) | 772static void 773_in6_ifdetach(struct ifnet *ifp, int purgeulp) |
769{ 770 struct ifaddr *ifa, *next; 771 772 if (ifp->if_afdata[AF_INET6] == NULL) 773 return; 774 | 774{ 775 struct ifaddr *ifa, *next; 776 777 if (ifp->if_afdata[AF_INET6] == NULL) 778 return; 779 |
775 /* remove neighbor management table */ 776 nd6_purge(ifp); | 780 /* 781 * Remove neighbor management table. 782 * Enabling the nd6_purge will panic on vmove for interfaces on VNET 783 * teardown as the IPv6 layer is cleaned up already and the locks 784 * are destroyed. 785 */ 786 if (purgeulp) 787 nd6_purge(ifp); |
777 778 /* 779 * nuke any of IPv6 addresses we have 780 * XXX: all addresses should be already removed 781 */ 782 TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, next) { 783 if (ifa->ifa_addr->sa_family != AF_INET6) 784 continue; 785 in6_purgeaddr(ifa); 786 } | 788 789 /* 790 * nuke any of IPv6 addresses we have 791 * XXX: all addresses should be already removed 792 */ 793 TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, next) { 794 if (ifa->ifa_addr->sa_family != AF_INET6) 795 continue; 796 in6_purgeaddr(ifa); 797 } |
787 in6_pcbpurgeif0(&V_udbinfo, ifp); 788 in6_pcbpurgeif0(&V_ulitecbinfo, ifp); 789 in6_pcbpurgeif0(&V_ripcbinfo, ifp); | 798 if (purgeulp) { 799 in6_pcbpurgeif0(&V_udbinfo, ifp); 800 in6_pcbpurgeif0(&V_ulitecbinfo, ifp); 801 in6_pcbpurgeif0(&V_ripcbinfo, ifp); 802 } |
790 /* leave from all multicast groups joined */ 791 in6_purgemaddrs(ifp); 792 793 /* 794 * remove neighbor management table. we call it twice just to make 795 * sure we nuke everything. maybe we need just one call. 796 * XXX: since the first call did not release addresses, some prefixes 797 * might remain. We should call nd6_purge() again to release the 798 * prefixes after removing all addresses above. 799 * (Or can we just delay calling nd6_purge until at this point?) 800 */ | 803 /* leave from all multicast groups joined */ 804 in6_purgemaddrs(ifp); 805 806 /* 807 * remove neighbor management table. we call it twice just to make 808 * sure we nuke everything. maybe we need just one call. 809 * XXX: since the first call did not release addresses, some prefixes 810 * might remain. We should call nd6_purge() again to release the 811 * prefixes after removing all addresses above. 812 * (Or can we just delay calling nd6_purge until at this point?) 813 */ |
801 nd6_purge(ifp); | 814 if (purgeulp) 815 nd6_purge(ifp); |
802} 803 | 816} 817 |
818void 819in6_ifdetach(struct ifnet *ifp) 820{ 821 822 _in6_ifdetach(ifp, 1); 823} 824 825void 826in6_ifdetach_destroy(struct ifnet *ifp) 827{ 828 829 _in6_ifdetach(ifp, 0); 830} 831 |
|
804int 805in6_get_tmpifid(struct ifnet *ifp, u_int8_t *retbuf, 806 const u_int8_t *baseid, int generate) 807{ 808 u_int8_t nullbuf[8]; 809 struct nd_ifinfo *ndi = ND_IFINFO(ifp); 810 811 bzero(nullbuf, sizeof(nullbuf)); --- 107 unchanged lines hidden --- | 832int 833in6_get_tmpifid(struct ifnet *ifp, u_int8_t *retbuf, 834 const u_int8_t *baseid, int generate) 835{ 836 u_int8_t nullbuf[8]; 837 struct nd_ifinfo *ndi = ND_IFINFO(ifp); 838 839 bzero(nullbuf, sizeof(nullbuf)); --- 107 unchanged lines hidden --- |