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

Reply via email to