Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Feb 2012 11:20:11 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r230939 - projects/multi-fibv6/head/sys/net
Message-ID:  <201202031120.q13BKBF2084991@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bz
Date: Fri Feb  3 11:20:11 2012
New Revision: 230939
URL: http://svn.freebsd.org/changeset/base/230939

Log:
  Minor optimization doing input validation with a possible early return
  before doing further work.
  
  Sponsored by:	Cisco Systems, Inc.

Modified:
  projects/multi-fibv6/head/sys/net/route.c

Modified: projects/multi-fibv6/head/sys/net/route.c
==============================================================================
--- projects/multi-fibv6/head/sys/net/route.c	Fri Feb  3 11:00:53 2012	(r230938)
+++ projects/multi-fibv6/head/sys/net/route.c	Fri Feb  3 11:20:11 2012	(r230939)
@@ -1406,6 +1406,8 @@ rtinit1(struct ifaddr *ifa, int cmd, int
 		dst = ifa->ifa_addr;
 		netmask = ifa->ifa_netmask;
 	}
+	if (dst->sa_len == 0)
+		return(EINVAL);
 	switch (dst->sa_family) {
 	case AF_INET6:
 	case AF_INET:
@@ -1427,8 +1429,6 @@ rtinit1(struct ifaddr *ifa, int cmd, int
 		startfib = fibnum;
 		endfib = fibnum;
 	}
-	if (dst->sa_len == 0)
-		return(EINVAL);
 
 	/*
 	 * If it's a delete, check that if it exists,



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