nd6_nbr.c (194760) | nd6_nbr.c (194777) |
---|---|
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: nd6_nbr.c,v 1.86 2002/01/21 02:33:04 jinmei 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: nd6_nbr.c,v 1.86 2002/01/21 02:33:04 jinmei Exp $ 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/netinet6/nd6_nbr.c 194760 2009-06-23 20:19:09Z rwatson $"); | 33__FBSDID("$FreeBSD: head/sys/netinet6/nd6_nbr.c 194777 2009-06-23 22:08:55Z bz $"); |
34 35#include "opt_inet.h" 36#include "opt_inet6.h" 37#include "opt_ipsec.h" 38#include "opt_carp.h" 39#include "opt_mpath.h" 40 41#include <sys/param.h> --- 458 unchanged lines hidden (view full) --- 500 int error; 501 struct sockaddr_in6 dst_sa; 502 503 bzero(&dst_sa, sizeof(dst_sa)); 504 dst_sa.sin6_family = AF_INET6; 505 dst_sa.sin6_len = sizeof(dst_sa); 506 dst_sa.sin6_addr = ip6->ip6_dst; 507 | 34 35#include "opt_inet.h" 36#include "opt_inet6.h" 37#include "opt_ipsec.h" 38#include "opt_carp.h" 39#include "opt_mpath.h" 40 41#include <sys/param.h> --- 458 unchanged lines hidden (view full) --- 500 int error; 501 struct sockaddr_in6 dst_sa; 502 503 bzero(&dst_sa, sizeof(dst_sa)); 504 dst_sa.sin6_family = AF_INET6; 505 dst_sa.sin6_len = sizeof(dst_sa); 506 dst_sa.sin6_addr = ip6->ip6_dst; 507 |
508 src = in6_selectsrc(&dst_sa, NULL, 509 NULL, &ro, NULL, NULL, &error); 510 if (src == NULL) { | 508 error = in6_selectsrc(&dst_sa, NULL, 509 NULL, &ro, NULL, NULL, &src_in); 510 if (error) { |
511 char ip6buf[INET6_ADDRSTRLEN]; 512 nd6log((LOG_DEBUG, 513 "nd6_ns_output: source can't be " 514 "determined: dst=%s, error=%d\n", 515 ip6_sprintf(ip6buf, &dst_sa.sin6_addr), 516 error)); 517 goto bad; 518 } | 511 char ip6buf[INET6_ADDRSTRLEN]; 512 nd6log((LOG_DEBUG, 513 "nd6_ns_output: source can't be " 514 "determined: dst=%s, error=%d\n", 515 ip6_sprintf(ip6buf, &dst_sa.sin6_addr), 516 error)); 517 goto bad; 518 } |
519 src = &src_in; |
|
519 } 520 } else { 521 /* 522 * Source address for DAD packet must always be IPv6 523 * unspecified address. (0::0) 524 * We actually don't have to 0-clear the address (we did it 525 * above), but we do so here explicitly to make the intention 526 * clearer. --- 401 unchanged lines hidden (view full) --- 928 const struct in6_addr *taddr6, u_long flags, int tlladdr, 929 struct sockaddr *sdl0) 930{ 931 INIT_VNET_INET6(ifp->if_vnet); 932 struct mbuf *m; 933 struct ip6_hdr *ip6; 934 struct nd_neighbor_advert *nd_na; 935 struct ip6_moptions im6o; | 520 } 521 } else { 522 /* 523 * Source address for DAD packet must always be IPv6 524 * unspecified address. (0::0) 525 * We actually don't have to 0-clear the address (we did it 526 * above), but we do so here explicitly to make the intention 527 * clearer. --- 401 unchanged lines hidden (view full) --- 929 const struct in6_addr *taddr6, u_long flags, int tlladdr, 930 struct sockaddr *sdl0) 931{ 932 INIT_VNET_INET6(ifp->if_vnet); 933 struct mbuf *m; 934 struct ip6_hdr *ip6; 935 struct nd_neighbor_advert *nd_na; 936 struct ip6_moptions im6o; |
936 struct in6_addr *src, daddr6; | 937 struct in6_addr src, daddr6; |
937 struct sockaddr_in6 dst_sa; 938 int icmp6len, maxlen, error; 939 caddr_t mac = NULL; 940 struct route_in6 ro; 941 942 bzero(&ro, sizeof(ro)); 943 944 daddr6 = *daddr6_0; /* make a local copy for modification */ --- 56 unchanged lines hidden (view full) --- 1001 dst_sa.sin6_family = AF_INET6; 1002 dst_sa.sin6_len = sizeof(struct sockaddr_in6); 1003 dst_sa.sin6_addr = daddr6; 1004 1005 /* 1006 * Select a source whose scope is the same as that of the dest. 1007 */ 1008 bcopy(&dst_sa, &ro.ro_dst, sizeof(dst_sa)); | 938 struct sockaddr_in6 dst_sa; 939 int icmp6len, maxlen, error; 940 caddr_t mac = NULL; 941 struct route_in6 ro; 942 943 bzero(&ro, sizeof(ro)); 944 945 daddr6 = *daddr6_0; /* make a local copy for modification */ --- 56 unchanged lines hidden (view full) --- 1002 dst_sa.sin6_family = AF_INET6; 1003 dst_sa.sin6_len = sizeof(struct sockaddr_in6); 1004 dst_sa.sin6_addr = daddr6; 1005 1006 /* 1007 * Select a source whose scope is the same as that of the dest. 1008 */ 1009 bcopy(&dst_sa, &ro.ro_dst, sizeof(dst_sa)); |
1009 src = in6_selectsrc(&dst_sa, NULL, NULL, &ro, NULL, NULL, &error); 1010 if (src == NULL) { | 1010 error = in6_selectsrc(&dst_sa, NULL, NULL, &ro, NULL, NULL, &src); 1011 if (error) { |
1011 char ip6buf[INET6_ADDRSTRLEN]; 1012 nd6log((LOG_DEBUG, "nd6_na_output: source can't be " 1013 "determined: dst=%s, error=%d\n", 1014 ip6_sprintf(ip6buf, &dst_sa.sin6_addr), error)); 1015 goto bad; 1016 } | 1012 char ip6buf[INET6_ADDRSTRLEN]; 1013 nd6log((LOG_DEBUG, "nd6_na_output: source can't be " 1014 "determined: dst=%s, error=%d\n", 1015 ip6_sprintf(ip6buf, &dst_sa.sin6_addr), error)); 1016 goto bad; 1017 } |
1017 ip6->ip6_src = *src; | 1018 ip6->ip6_src = src; |
1018 nd_na = (struct nd_neighbor_advert *)(ip6 + 1); 1019 nd_na->nd_na_type = ND_NEIGHBOR_ADVERT; 1020 nd_na->nd_na_code = 0; 1021 nd_na->nd_na_target = *taddr6; 1022 in6_clearscope(&nd_na->nd_na_target); /* XXX */ 1023 1024 /* 1025 * "tlladdr" indicates NS's condition for adding tlladdr or not. --- 506 unchanged lines hidden --- | 1019 nd_na = (struct nd_neighbor_advert *)(ip6 + 1); 1020 nd_na->nd_na_type = ND_NEIGHBOR_ADVERT; 1021 nd_na->nd_na_code = 0; 1022 nd_na->nd_na_target = *taddr6; 1023 in6_clearscope(&nd_na->nd_na_target); /* XXX */ 1024 1025 /* 1026 * "tlladdr" indicates NS's condition for adding tlladdr or not. --- 506 unchanged lines hidden --- |