svn commit: r219783 - head/sys/net

Dmitry Chagin dchagin at FreeBSD.org
Sat Mar 19 19:50:37 UTC 2011


Author: dchagin
Date: Sat Mar 19 19:50:36 2011
New Revision: 219783
URL: http://svn.freebsd.org/changeset/base/219783

Log:
  A bit rearranged rtalloc1_fib() code.
  Initialize a variable when it is really needed.
  To avoid code duplication move the miss label to line up and jump on it.
  
  MFC after:	1 Week

Modified:
  head/sys/net/route.c

Modified: head/sys/net/route.c
==============================================================================
--- head/sys/net/route.c	Sat Mar 19 19:39:05 2011	(r219782)
+++ head/sys/net/route.c	Sat Mar 19 19:50:36 2011	(r219783)
@@ -348,14 +348,13 @@ rtalloc1_fib(struct sockaddr *dst, int r
 	if (dst->sa_family != AF_INET)	/* Only INET supports > 1 fib now */
 		fibnum = 0;
 	rnh = rt_tables_get_rnh(fibnum, dst->sa_family);
-	newrt = NULL;
+	if (rnh == NULL)
+		goto miss;
+
 	/*
 	 * Look up the address in the table for that Address Family
 	 */
-	if (rnh == NULL) {
-		V_rtstat.rts_unreach++;
-		goto miss;
-	}
+	newrt = NULL;
 	needlock = !(ignflags & RTF_RNH_LOCKED);
 	if (needlock)
 		RADIX_NODE_HEAD_RLOCK(rnh);
@@ -380,8 +379,9 @@ rtalloc1_fib(struct sockaddr *dst, int r
 	 * Which basically means
 	 * "caint get there frm here"
 	 */
-	V_rtstat.rts_unreach++;
 miss:
+	V_rtstat.rts_unreach++;
+
 	if (report) {
 		/*
 		 * If required, report the failure to the supervising


More information about the svn-src-head mailing list