Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Dec 2012 17:08:50 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r244440 - head/sys/netinet6
Message-ID:  <201212191708.qBJH8o4W044011@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Wed Dec 19 17:08:49 2012
New Revision: 244440
URL: http://svnweb.freebsd.org/changeset/base/244440

Log:
  Make dst_sa initialization only when it is actually needed.
  
  MFC after:	1 week

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==============================================================================
--- head/sys/netinet6/ip6_output.c	Wed Dec 19 17:02:07 2012	(r244439)
+++ head/sys/netinet6/ip6_output.c	Wed Dec 19 17:08:49 2012	(r244440)
@@ -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) {
 		/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212191708.qBJH8o4W044011>