diff options
author | ae <ae@FreeBSD.org> | 2012-12-19 17:08:49 +0000 |
---|---|---|
committer | ae <ae@FreeBSD.org> | 2012-12-19 17:08:49 +0000 |
commit | ddb9833615a7acab609c0b3596e04aa987b3e1c5 (patch) | |
tree | 934a257ce8c810cc253505ff4f646350725086ec /sys/netinet6 | |
parent | e0bd011045b66385a32feff04598a9123fa3d3d2 (diff) | |
download | FreeBSD-src-ddb9833615a7acab609c0b3596e04aa987b3e1c5.zip FreeBSD-src-ddb9833615a7acab609c0b3596e04aa987b3e1c5.tar.gz |
Make dst_sa initialization only when it is actually needed.
MFC after: 1 week
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/ip6_output.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index a76bfed..2e0c9b6 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -636,18 +636,21 @@ again: /* adjust pointer */ ip6 = mtod(m, struct ip6_hdr *); - bzero(&dst_sa, sizeof(dst_sa)); - dst_sa.sin6_family = AF_INET6; - dst_sa.sin6_len = sizeof(dst_sa); - dst_sa.sin6_addr = ip6->ip6_dst; if (ro->ro_rt) { rt = ro->ro_rt; ifp = ro->ro_rt->rt_ifp; - } else if ((error = in6_selectroute_fib(&dst_sa, opt, im6o, ro, - &ifp, &rt, inp ? inp->inp_inc.inc_fibnum : M_GETFIB(m))) != 0) { - if (ifp != NULL) - in6_ifstat_inc(ifp, ifs6_out_discard); - goto bad; + } else { + bzero(&dst_sa, sizeof(dst_sa)); + dst_sa.sin6_family = AF_INET6; + dst_sa.sin6_len = sizeof(dst_sa); + dst_sa.sin6_addr = ip6->ip6_dst; + error = in6_selectroute_fib(&dst_sa, opt, im6o, ro, &ifp, + &rt, inp ? inp->inp_inc.inc_fibnum : M_GETFIB(m)); + if (error != 0) { + if (ifp != NULL) + in6_ifstat_inc(ifp, ifs6_out_discard); + goto bad; + } } if (rt == NULL) { /* |