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
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to