in6_ifattach.c (194602) | in6_ifattach.c (194760) |
---|---|
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 194602 2009-06-21 19:30:33Z rwatson $"); | 33__FBSDID("$FreeBSD: head/sys/netinet6/in6_ifattach.c 194760 2009-06-23 20:19:09Z rwatson $"); |
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> --- 206 unchanged lines hidden (view full) --- 248 249 goto found; 250 } 251 IF_ADDR_UNLOCK(ifp); 252 253 return -1; 254 255found: | 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> --- 206 unchanged lines hidden (view full) --- 248 249 goto found; 250 } 251 IF_ADDR_UNLOCK(ifp); 252 253 return -1; 254 255found: |
256 IF_ADDR_LOCK_ASSERT(ifp); |
|
256 addr = LLADDR(sdl); 257 addrlen = sdl->sdl_alen; 258 259 /* get EUI64 */ 260 switch (ifp->if_type) { 261 case IFT_ETHER: 262 case IFT_FDDI: 263 case IFT_ISO88025: --- 244 unchanged lines hidden (view full) --- 508 509 ia = in6ifa_ifpforlinklocal(ifp, 0); /* ia must not be NULL */ 510#ifdef DIAGNOSTIC 511 if (!ia) { 512 panic("ia == NULL in in6_ifattach_linklocal"); 513 /* NOTREACHED */ 514 } 515#endif | 257 addr = LLADDR(sdl); 258 addrlen = sdl->sdl_alen; 259 260 /* get EUI64 */ 261 switch (ifp->if_type) { 262 case IFT_ETHER: 263 case IFT_FDDI: 264 case IFT_ISO88025: --- 244 unchanged lines hidden (view full) --- 509 510 ia = in6ifa_ifpforlinklocal(ifp, 0); /* ia must not be NULL */ 511#ifdef DIAGNOSTIC 512 if (!ia) { 513 panic("ia == NULL in in6_ifattach_linklocal"); 514 /* NOTREACHED */ 515 } 516#endif |
517 ifa_free(&ia->ia_ifa); |
|
516 517 /* 518 * Make the link-local prefix (fe80::%link/64) as on-link. 519 * Since we'd like to manage prefixes separately from addresses, 520 * we make an ND6 prefix structure for the link-local prefix, 521 * and add it to the prefix list as a never-expire prefix. 522 * XXX: this change might affect some existing code base... 523 */ --- 208 unchanged lines hidden (view full) --- 732 return; 733 } 734 735 /* 736 * assign loopback address for loopback interface. 737 * XXX multiple loopback interface case. 738 */ 739 if ((ifp->if_flags & IFF_LOOPBACK) != 0) { | 518 519 /* 520 * Make the link-local prefix (fe80::%link/64) as on-link. 521 * Since we'd like to manage prefixes separately from addresses, 522 * we make an ND6 prefix structure for the link-local prefix, 523 * and add it to the prefix list as a never-expire prefix. 524 * XXX: this change might affect some existing code base... 525 */ --- 208 unchanged lines hidden (view full) --- 734 return; 735 } 736 737 /* 738 * assign loopback address for loopback interface. 739 * XXX multiple loopback interface case. 740 */ 741 if ((ifp->if_flags & IFF_LOOPBACK) != 0) { |
742 struct ifaddr *ifa; 743 |
|
740 in6 = in6addr_loopback; | 744 in6 = in6addr_loopback; |
741 if (in6ifa_ifpwithaddr(ifp, &in6) == NULL) { | 745 ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &in6); 746 if (ifa == NULL) { |
742 if (in6_ifattach_loopback(ifp) != 0) 743 return; | 747 if (in6_ifattach_loopback(ifp) != 0) 748 return; |
744 } | 749 } else 750 ifa_free(ifa); |
745 } 746 747 /* 748 * assign a link-local address, if there's none. 749 */ 750 if (V_ip6_auto_linklocal && ifp->if_type != IFT_BRIDGE) { 751 ia = in6ifa_ifpforlinklocal(ifp, 0); 752 if (ia == NULL) { 753 if (in6_ifattach_linklocal(ifp, altifp) == 0) { 754 /* linklocal address assigned */ 755 } else { 756 /* failed to assign linklocal address. bark? */ 757 } | 751 } 752 753 /* 754 * assign a link-local address, if there's none. 755 */ 756 if (V_ip6_auto_linklocal && ifp->if_type != IFT_BRIDGE) { 757 ia = in6ifa_ifpforlinklocal(ifp, 0); 758 if (ia == NULL) { 759 if (in6_ifattach_linklocal(ifp, altifp) == 0) { 760 /* linklocal address assigned */ 761 } else { 762 /* failed to assign linklocal address. bark? */ 763 } |
758 } | 764 } else 765 ifa_free(&ia->ia_ifa); |
759 } 760 761#ifdef IFT_STF /* XXX */ 762statinit: 763#endif 764 765 /* update dynamically. */ 766 if (V_in6_maxmtu < ifp->if_mtu) --- 211 unchanged lines hidden --- | 766 } 767 768#ifdef IFT_STF /* XXX */ 769statinit: 770#endif 771 772 /* update dynamically. */ 773 if (V_in6_maxmtu < ifp->if_mtu) --- 211 unchanged lines hidden --- |