aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet6/nd6_nbr.c
diff options
context:
space:
mode:
authorAlexander V. Chernikov <melifaro@FreeBSD.org>2016-01-03 10:43:23 +0000
committerAlexander V. Chernikov <melifaro@FreeBSD.org>2016-01-03 10:43:23 +0000
commit357ce739b9507e7e05fb4b3fd0e74c0c8bb44117 (patch)
tree8748af7180bc58ee451c248c5cffb7e199c52f9a /sys/netinet6/nd6_nbr.c
parent92d95dfd76b9a53dcfc12de3806a2b772490ac29 (diff)
downloadsrc-357ce739b9507e7e05fb4b3fd0e74c0c8bb44117.tar.gz
src-357ce739b9507e7e05fb4b3fd0e74c0c8bb44117.zip
Remove 'struct route_int6' argument from in6_selectsrc() and
in6_selectif(). The main task of in6_selectsrc() is to return IPv6 SAS (along with output interface used for scope checks). No data-path code uses route argument for caching. The only users are icmp6 (reflect code), ND6 ns/na generation code. All this fucntions are control-plane, so there is no reason to try to 'optimize' something by passing cached route into to ip6_output(). Given that, simplify code by eliminating in6_selectsrc() 'struct route_in6' argument. Since in6_selectif() is used only by in6_selectsrc(), eliminate its 'struct route_in6' argument, too. While here, reshape rte-related code inside in6_selectif() to free lookup result immediately after saving all the needed fields.
Notes
Notes: svn path=/head/; revision=293101
Diffstat (limited to 'sys/netinet6/nd6_nbr.c')
-rw-r--r--sys/netinet6/nd6_nbr.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index 80a5cd3ee972..407c6e51b40b 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -408,7 +408,6 @@ nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *saddr6,
int icmp6len;
int maxlen;
caddr_t mac;
- struct route_in6 ro;
if (IN6_IS_ADDR_MULTICAST(taddr6))
return;
@@ -428,8 +427,6 @@ nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *saddr6,
return;
M_SETFIB(m, fibnum);
- bzero(&ro, sizeof(ro));
-
if (daddr6 == NULL || IN6_IS_ADDR_MULTICAST(daddr6)) {
m->m_flags |= M_MCAST;
im6o.im6o_multicast_ifp = ifp;
@@ -497,7 +494,7 @@ nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *saddr6,
oifp = ifp;
error = in6_selectsrc(&dst_sa, NULL,
- NULL, &ro, NULL, &oifp, &src_in);
+ NULL, NULL, &oifp, &src_in);
if (error) {
char ip6buf[INET6_ADDRSTRLEN];
nd6log((LOG_DEBUG, "%s: source can't be "
@@ -585,21 +582,15 @@ nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *saddr6,
m_tag_prepend(m, mtag);
}
- ip6_output(m, NULL, &ro, (nonce != NULL) ? IPV6_UNSPECSRC : 0,
+ ip6_output(m, NULL, NULL, (nonce != NULL) ? IPV6_UNSPECSRC : 0,
&im6o, NULL, NULL);
icmp6_ifstat_inc(ifp, ifs6_out_msg);
icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit);
ICMP6STAT_INC(icp6s_outhist[ND_NEIGHBOR_SOLICIT]);
- /* We don't cache this route. */
- RO_RTFREE(&ro);
-
return;
bad:
- if (ro.ro_rt) {
- RTFREE(ro.ro_rt);
- }
m_freem(m);
return;
}
@@ -960,9 +951,6 @@ nd6_na_output_fib(struct ifnet *ifp, const struct in6_addr *daddr6_0,
struct sockaddr_in6 dst_sa;
int icmp6len, maxlen, error;
caddr_t mac = NULL;
- struct route_in6 ro;
-
- bzero(&ro, sizeof(ro));
daddr6 = *daddr6_0; /* make a local copy for modification */
@@ -1020,9 +1008,8 @@ nd6_na_output_fib(struct ifnet *ifp, const struct in6_addr *daddr6_0,
/*
* Select a source whose scope is the same as that of the dest.
*/
- bcopy(&dst_sa, &ro.ro_dst, sizeof(dst_sa));
oifp = ifp;
- error = in6_selectsrc(&dst_sa, NULL, NULL, &ro, NULL, &oifp, &src);
+ error = in6_selectsrc(&dst_sa, NULL, NULL, NULL, &oifp, &src);
if (error) {
char ip6buf[INET6_ADDRSTRLEN];
nd6log((LOG_DEBUG, "nd6_na_output: source can't be "
@@ -1093,20 +1080,14 @@ nd6_na_output_fib(struct ifnet *ifp, const struct in6_addr *daddr6_0,
m_tag_prepend(m, mtag);
}
- ip6_output(m, NULL, &ro, 0, &im6o, NULL, NULL);
+ ip6_output(m, NULL, NULL, 0, &im6o, NULL, NULL);
icmp6_ifstat_inc(ifp, ifs6_out_msg);
icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert);
ICMP6STAT_INC(icp6s_outhist[ND_NEIGHBOR_ADVERT]);
- /* We don't cache this route. */
- RO_RTFREE(&ro);
-
return;
bad:
- if (ro.ro_rt) {
- RTFREE(ro.ro_rt);
- }
m_freem(m);
return;
}