svn commit: r228532 - head/sys/net

Gleb Smirnoff glebius at FreeBSD.org
Thu Dec 15 12:49:11 UTC 2011


Author: glebius
Date: Thu Dec 15 12:49:10 2011
New Revision: 228532
URL: http://svn.freebsd.org/changeset/base/228532

Log:
  Simplify rtrequest(RTM_ADD): ifa can't be NULL after rt_getifa_fib().

Modified:
  head/sys/net/route.c

Modified: head/sys/net/route.c
==============================================================================
--- head/sys/net/route.c	Thu Dec 15 12:35:03 2011	(r228531)
+++ head/sys/net/route.c	Thu Dec 15 12:49:10 2011	(r228532)
@@ -1128,8 +1128,7 @@ rtrequest1_fib(int req, struct rt_addrin
 		ifa = info->rti_ifa;
 		rt = uma_zalloc(V_rtzone, M_NOWAIT | M_ZERO);
 		if (rt == NULL) {
-			if (ifa != NULL)
-				ifa_free(ifa);
+			ifa_free(ifa);
 			senderr(ENOBUFS);
 		}
 		RT_LOCK_INIT(rt);
@@ -1142,8 +1141,7 @@ rtrequest1_fib(int req, struct rt_addrin
 		RT_LOCK(rt);
 		if ((error = rt_setgate(rt, dst, gateway)) != 0) {
 			RT_LOCK_DESTROY(rt);
-			if (ifa != NULL)
-				ifa_free(ifa);
+			ifa_free(ifa);
 			uma_zfree(V_rtzone, rt);
 			senderr(error);
 		}
@@ -1174,9 +1172,7 @@ rtrequest1_fib(int req, struct rt_addrin
 		/* do not permit exactly the same dst/mask/gw pair */
 		if (rn_mpath_capable(rnh) &&
 			rt_mpath_conflict(rnh, rt, netmask)) {
-			if (rt->rt_ifa) {
-				ifa_free(rt->rt_ifa);
-			}
+			ifa_free(rt->rt_ifa);
 			Free(rt_key(rt));
 			RT_LOCK_DESTROY(rt);
 			uma_zfree(V_rtzone, rt);
@@ -1241,8 +1237,7 @@ rtrequest1_fib(int req, struct rt_addrin
 		 * then un-make it (this should be a function)
 		 */
 		if (rn == NULL) {
-			if (rt->rt_ifa)
-				ifa_free(rt->rt_ifa);
+			ifa_free(rt->rt_ifa);
 			Free(rt_key(rt));
 			RT_LOCK_DESTROY(rt);
 			uma_zfree(V_rtzone, rt);


More information about the svn-src-head mailing list