diff options
author | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2015-09-05 14:14:03 +0000 |
---|---|---|
committer | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2015-09-05 14:14:03 +0000 |
commit | 26deb8826cde3c3a30fe5c9b316f40b6400b2a07 (patch) | |
tree | 488542040b263ce7a5ac9c7ae64128f46aa40f67 /sys/netinet6/nd6_nbr.c | |
parent | 7a82f35c9dfb0a731e5bb8d99263c116946a9129 (diff) | |
download | src-test2-26deb8826cde3c3a30fe5c9b316f40b6400b2a07.tar.gz src-test2-26deb8826cde3c3a30fe5c9b316f40b6400b2a07.zip |
Notes
Diffstat (limited to 'sys/netinet6/nd6_nbr.c')
-rw-r--r-- | sys/netinet6/nd6_nbr.c | 48 |
1 files changed, 14 insertions, 34 deletions
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 4d9273ca712d..107fba241cc7 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -95,7 +95,7 @@ static void nd6_dad_na_input(struct ifaddr *); static void nd6_na_output_fib(struct ifnet *, const struct in6_addr *, const struct in6_addr *, u_long, int, struct sockaddr *, u_int); static void nd6_ns_output_fib(struct ifnet *, const struct in6_addr *, - const struct in6_addr *, struct llentry *, uint8_t *, u_int); + const struct in6_addr *, const struct in6_addr *, uint8_t *, u_int); static VNET_DEFINE(int, dad_enhanced) = 1; #define V_dad_enhanced VNET(dad_enhanced) @@ -396,9 +396,9 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) * the value (length is ND_OPT_NONCE_LEN) is used as a random nonce. */ static void -nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *daddr6, - const struct in6_addr *taddr6, struct llentry *ln, uint8_t *nonce, - u_int fibnum) +nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *saddr6, + const struct in6_addr *daddr6, const struct in6_addr *taddr6, + uint8_t *nonce, u_int fibnum) { struct mbuf *m; struct m_tag *mtag; @@ -462,7 +462,7 @@ nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *daddr6, goto bad; } if (nonce == NULL) { - struct ifaddr *ifa; + struct ifaddr *ifa = NULL; /* * RFC2461 7.2.2: @@ -474,35 +474,15 @@ nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *daddr6, * interface should be used." * * We use the source address for the prompting packet - * (saddr6), if: - * - saddr6 is given from the caller (by giving "ln"), and - * - saddr6 belongs to the outgoing interface. + * (saddr6), if saddr6 belongs to the outgoing interface. * Otherwise, we perform the source address selection as usual. */ - struct in6_addr *hsrc; - hsrc = NULL; - if (ln != NULL) { - LLE_RLOCK(ln); - if (ln->la_hold != NULL) { - struct ip6_hdr *hip6; /* hold ip6 */ - - /* - * assuming every packet in la_hold has the same IP - * header - */ - hip6 = mtod(ln->la_hold, struct ip6_hdr *); - /* XXX pullup? */ - if (sizeof(*hip6) < ln->la_hold->m_len) { - ip6->ip6_src = hip6->ip6_src; - hsrc = &hip6->ip6_src; - } - } - LLE_RUNLOCK(ln); - } - if (hsrc && (ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, - hsrc)) != NULL) { + if (saddr6 != NULL) + ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, saddr6); + if (ifa != NULL) { /* ip6_src set already. */ + ip6->ip6_src = *saddr6; ifa_free(ifa); } else { int error; @@ -626,11 +606,11 @@ nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *daddr6, #ifndef BURN_BRIDGES void -nd6_ns_output(struct ifnet *ifp, const struct in6_addr *daddr6, - const struct in6_addr *taddr6, struct llentry *ln, uint8_t *nonce) +nd6_ns_output(struct ifnet *ifp, const struct in6_addr *saddr6, + const struct in6_addr *daddr6, const struct in6_addr *taddr6,uint8_t *nonce) { - nd6_ns_output_fib(ifp, daddr6, taddr6, ln, nonce, RT_DEFAULT_FIB); + nd6_ns_output_fib(ifp, saddr6, daddr6, taddr6, nonce, RT_DEFAULT_FIB); } #endif /* @@ -1581,7 +1561,7 @@ nd6_dad_ns_output(struct dadq *dp, struct ifaddr *ifa) * should work well in almost all cases. */ } - nd6_ns_output(ifp, NULL, &ia->ia_addr.sin6_addr, NULL, + nd6_ns_output(ifp, NULL, NULL, &ia->ia_addr.sin6_addr, (uint8_t *)&dp->dad_nonce[0]); } |