nd6_nbr.c (139826) | nd6_nbr.c (142215) |
---|---|
1/* $FreeBSD: head/sys/netinet6/nd6_nbr.c 139826 2005-01-07 02:30:35Z imp $ */ | 1/* $FreeBSD: head/sys/netinet6/nd6_nbr.c 142215 2005-02-22 13:04:05Z glebius $ */ |
2/* $KAME: nd6_nbr.c,v 1.86 2002/01/21 02:33:04 jinmei Exp $ */ 3 4/*- 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 17 unchanged lines hidden (view full) --- 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 */ 32 33#include "opt_inet.h" 34#include "opt_inet6.h" | 2/* $KAME: nd6_nbr.c,v 1.86 2002/01/21 02:33:04 jinmei Exp $ */ 3 4/*- 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 17 unchanged lines hidden (view full) --- 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 */ 32 33#include "opt_inet.h" 34#include "opt_inet6.h" |
35#include "opt_ipsec.h" 36#include "opt_carp.h" |
|
35 36#include <sys/param.h> 37#include <sys/systm.h> 38#include <sys/malloc.h> 39#include <sys/mbuf.h> 40#include <sys/socket.h> 41#include <sys/sockio.h> 42#include <sys/time.h> --- 11 unchanged lines hidden (view full) --- 54#include <netinet/in.h> 55#include <netinet/in_var.h> 56#include <netinet6/in6_var.h> 57#include <netinet/ip6.h> 58#include <netinet6/ip6_var.h> 59#include <netinet6/nd6.h> 60#include <netinet/icmp6.h> 61 | 37 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/malloc.h> 41#include <sys/mbuf.h> 42#include <sys/socket.h> 43#include <sys/sockio.h> 44#include <sys/time.h> --- 11 unchanged lines hidden (view full) --- 56#include <netinet/in.h> 57#include <netinet/in_var.h> 58#include <netinet6/in6_var.h> 59#include <netinet/ip6.h> 60#include <netinet6/ip6_var.h> 61#include <netinet6/nd6.h> 62#include <netinet/icmp6.h> 63 |
64#ifdef DEV_CARP 65#include <netinet/ip_carp.h> 66#endif 67 |
|
62#include <net/net_osdep.h> 63 64#define SDL(s) ((struct sockaddr_dl *)s) 65 66struct dadq; 67static struct dadq *nd6_dad_find __P((struct ifaddr *)); 68static void nd6_dad_starttimer __P((struct dadq *, int)); 69static void nd6_dad_stoptimer __P((struct dadq *)); --- 19 unchanged lines hidden (view full) --- 89 struct ifnet *ifp = m->m_pkthdr.rcvif; 90 struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); 91 struct nd_neighbor_solicit *nd_ns; 92 struct in6_addr saddr6 = ip6->ip6_src; 93 struct in6_addr daddr6 = ip6->ip6_dst; 94 struct in6_addr taddr6; 95 struct in6_addr myaddr6; 96 char *lladdr = NULL; | 68#include <net/net_osdep.h> 69 70#define SDL(s) ((struct sockaddr_dl *)s) 71 72struct dadq; 73static struct dadq *nd6_dad_find __P((struct ifaddr *)); 74static void nd6_dad_starttimer __P((struct dadq *, int)); 75static void nd6_dad_stoptimer __P((struct dadq *)); --- 19 unchanged lines hidden (view full) --- 95 struct ifnet *ifp = m->m_pkthdr.rcvif; 96 struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); 97 struct nd_neighbor_solicit *nd_ns; 98 struct in6_addr saddr6 = ip6->ip6_src; 99 struct in6_addr daddr6 = ip6->ip6_dst; 100 struct in6_addr taddr6; 101 struct in6_addr myaddr6; 102 char *lladdr = NULL; |
97 struct ifaddr *ifa; | 103 struct ifaddr *ifa = NULL; |
98 int lladdrlen = 0; 99 int anycast = 0, proxy = 0, tentative = 0; 100 int tlladdr; 101 union nd_opts ndopts; 102 struct sockaddr_dl *proxydl = NULL; 103 104#ifndef PULLDOWN_TEST 105 IP6_EXTHDR_CHECK(m, off, icmp6len,); --- 82 unchanged lines hidden (view full) --- 188 189 /* 190 * Target address (taddr6) must be either: 191 * (1) Valid unicast/anycast address for my receiving interface, 192 * (2) Unicast address for which I'm offering proxy service, or 193 * (3) "tentative" address on which DAD is being performed. 194 */ 195 /* (1) and (3) check. */ | 104 int lladdrlen = 0; 105 int anycast = 0, proxy = 0, tentative = 0; 106 int tlladdr; 107 union nd_opts ndopts; 108 struct sockaddr_dl *proxydl = NULL; 109 110#ifndef PULLDOWN_TEST 111 IP6_EXTHDR_CHECK(m, off, icmp6len,); --- 82 unchanged lines hidden (view full) --- 194 195 /* 196 * Target address (taddr6) must be either: 197 * (1) Valid unicast/anycast address for my receiving interface, 198 * (2) Unicast address for which I'm offering proxy service, or 199 * (3) "tentative" address on which DAD is being performed. 200 */ 201 /* (1) and (3) check. */ |
202#ifdef DEV_CARP 203 if (ifp->if_carp) 204 ifa = carp_iamatch6(ifp->if_carp, &taddr6); 205 if (!ifa) 206 ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &taddr6); 207#else |
|
196 ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &taddr6); | 208 ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &taddr6); |
209#endif |
|
197 198 /* (2) check. */ 199 if (!ifa) { 200 struct rtentry *rt; 201 struct sockaddr_in6 tsin6; 202 int need_proxy; 203 204 bzero(&tsin6, sizeof tsin6); --- 678 unchanged lines hidden (view full) --- 883 * target lladdr option SHOULD NOT be included. 884 */ 885 if (tlladdr) { 886 /* 887 * sdl0 != NULL indicates proxy NA. If we do proxy, use 888 * lladdr in sdl0. If we are not proxying (sending NA for 889 * my address) use lladdr configured for the interface. 890 */ | 210 211 /* (2) check. */ 212 if (!ifa) { 213 struct rtentry *rt; 214 struct sockaddr_in6 tsin6; 215 int need_proxy; 216 217 bzero(&tsin6, sizeof tsin6); --- 678 unchanged lines hidden (view full) --- 896 * target lladdr option SHOULD NOT be included. 897 */ 898 if (tlladdr) { 899 /* 900 * sdl0 != NULL indicates proxy NA. If we do proxy, use 901 * lladdr in sdl0. If we are not proxying (sending NA for 902 * my address) use lladdr configured for the interface. 903 */ |
891 if (sdl0 == NULL) | 904 if (sdl0 == NULL) { 905#ifdef DEV_CARP 906 if (ifp->if_carp) 907 mac = carp_macmatch6(ifp->if_carp, m, taddr6); 908 if (mac == NULL) 909 mac = nd6_ifptomac(ifp); 910#else |
892 mac = nd6_ifptomac(ifp); | 911 mac = nd6_ifptomac(ifp); |
893 else if (sdl0->sa_family == AF_LINK) { | 912#endif 913 } else if (sdl0->sa_family == AF_LINK) { |
894 struct sockaddr_dl *sdl; 895 sdl = (struct sockaddr_dl *)sdl0; 896 if (sdl->sdl_alen == ifp->if_addrlen) 897 mac = LLADDR(sdl); 898 } 899 } 900 if (tlladdr && mac) { 901 int optlen = sizeof(struct nd_opt_hdr) + ifp->if_addrlen; --- 36 unchanged lines hidden (view full) --- 938 case IFT_FDDI: 939 case IFT_IEEE1394: 940#ifdef IFT_L2VLAN 941 case IFT_L2VLAN: 942#endif 943#ifdef IFT_IEEE80211 944 case IFT_IEEE80211: 945#endif | 914 struct sockaddr_dl *sdl; 915 sdl = (struct sockaddr_dl *)sdl0; 916 if (sdl->sdl_alen == ifp->if_addrlen) 917 mac = LLADDR(sdl); 918 } 919 } 920 if (tlladdr && mac) { 921 int optlen = sizeof(struct nd_opt_hdr) + ifp->if_addrlen; --- 36 unchanged lines hidden (view full) --- 958 case IFT_FDDI: 959 case IFT_IEEE1394: 960#ifdef IFT_L2VLAN 961 case IFT_L2VLAN: 962#endif 963#ifdef IFT_IEEE80211 964 case IFT_IEEE80211: 965#endif |
966#ifdef IFT_CARP 967 case IFT_CARP: 968#endif |
|
946 case IFT_ISO88025: 947 return ((caddr_t)(ifp + 1)); 948 default: 949 return NULL; 950 } 951} 952 953TAILQ_HEAD(dadq_head, dadq); --- 416 unchanged lines hidden --- | 969 case IFT_ISO88025: 970 return ((caddr_t)(ifp + 1)); 971 default: 972 return NULL; 973 } 974} 975 976TAILQ_HEAD(dadq_head, dadq); --- 416 unchanged lines hidden --- |