in6.c (196871) | in6.c (197138) |
---|---|
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.c 8.2 (Berkeley) 11/15/93 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.c 8.2 (Berkeley) 11/15/93 61 */ 62 63#include <sys/cdefs.h> |
64__FBSDID("$FreeBSD: head/sys/netinet6/in6.c 196871 2009-09-05 20:24:37Z qingli $"); | 64__FBSDID("$FreeBSD: head/sys/netinet6/in6.c 197138 2009-09-12 22:08:20Z hrs $"); |
65 66#include "opt_inet.h" 67#include "opt_inet6.h" 68 69#include <sys/param.h> 70#include <sys/errno.h> 71#include <sys/jail.h> 72#include <sys/malloc.h> --- 839 unchanged lines hidden (view full) --- 912 * Make the address tentative before joining multicast addresses, 913 * so that corresponding MLD responses would not have a tentative 914 * source address. 915 */ 916 ia->ia6_flags &= ~IN6_IFF_DUPLICATED; /* safety */ 917 if (hostIsNew && in6if_do_dad(ifp)) 918 ia->ia6_flags |= IN6_IFF_TENTATIVE; 919 | 65 66#include "opt_inet.h" 67#include "opt_inet6.h" 68 69#include <sys/param.h> 70#include <sys/errno.h> 71#include <sys/jail.h> 72#include <sys/malloc.h> --- 839 unchanged lines hidden (view full) --- 912 * Make the address tentative before joining multicast addresses, 913 * so that corresponding MLD responses would not have a tentative 914 * source address. 915 */ 916 ia->ia6_flags &= ~IN6_IFF_DUPLICATED; /* safety */ 917 if (hostIsNew && in6if_do_dad(ifp)) 918 ia->ia6_flags |= IN6_IFF_TENTATIVE; 919 |
920 /* DAD should be performed after ND6_IFF_IFDISABLED is cleared. */ 921 if (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) 922 ia->ia6_flags |= IN6_IFF_TENTATIVE; 923 |
|
920 /* 921 * We are done if we have simply modified an existing address. 922 */ 923 if (!hostIsNew) 924 return (error); 925 926 /* 927 * Beyond this point, we should call in6_purgeaddr upon an error, --- 21 unchanged lines hidden (view full) --- 949 } 950 delay = 0; 951 if ((flags & IN6_IFAUPDATE_DADDELAY)) { 952 /* 953 * We need a random delay for DAD on the address 954 * being configured. It also means delaying 955 * transmission of the corresponding MLD report to 956 * avoid report collision. | 924 /* 925 * We are done if we have simply modified an existing address. 926 */ 927 if (!hostIsNew) 928 return (error); 929 930 /* 931 * Beyond this point, we should call in6_purgeaddr upon an error, --- 21 unchanged lines hidden (view full) --- 953 } 954 delay = 0; 955 if ((flags & IN6_IFAUPDATE_DADDELAY)) { 956 /* 957 * We need a random delay for DAD on the address 958 * being configured. It also means delaying 959 * transmission of the corresponding MLD report to 960 * avoid report collision. |
957 * [draft-ietf-ipv6-rfc2462bis-02.txt] | 961 * [RFC 4861, Section 6.3.7] |
958 */ 959 delay = arc4random() % 960 (MAX_RTR_SOLICITATION_DELAY * hz); 961 } 962 imm = in6_joingroup(ifp, &llsol, &error, delay); 963 if (imm == NULL) { 964 nd6log((LOG_WARNING, 965 "in6_update_ifa: addmulti failed for " --- 1226 unchanged lines hidden (view full) --- 2192} 2193 2194int 2195in6if_do_dad(struct ifnet *ifp) 2196{ 2197 if ((ifp->if_flags & IFF_LOOPBACK) != 0) 2198 return (0); 2199 | 962 */ 963 delay = arc4random() % 964 (MAX_RTR_SOLICITATION_DELAY * hz); 965 } 966 imm = in6_joingroup(ifp, &llsol, &error, delay); 967 if (imm == NULL) { 968 nd6log((LOG_WARNING, 969 "in6_update_ifa: addmulti failed for " --- 1226 unchanged lines hidden (view full) --- 2196} 2197 2198int 2199in6if_do_dad(struct ifnet *ifp) 2200{ 2201 if ((ifp->if_flags & IFF_LOOPBACK) != 0) 2202 return (0); 2203 |
2204 if (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) 2205 return (0); 2206 |
|
2200 switch (ifp->if_type) { 2201#ifdef IFT_DUMMY 2202 case IFT_DUMMY: 2203#endif 2204 case IFT_FAITH: 2205 /* 2206 * These interfaces do not have the IFF_LOOPBACK flag, 2207 * but loop packets back. We do not have to do DAD on such --- 457 unchanged lines hidden --- | 2207 switch (ifp->if_type) { 2208#ifdef IFT_DUMMY 2209 case IFT_DUMMY: 2210#endif 2211 case IFT_FAITH: 2212 /* 2213 * These interfaces do not have the IFF_LOOPBACK flag, 2214 * but loop packets back. We do not have to do DAD on such --- 457 unchanged lines hidden --- |