Remove ifa_ref()/ifa_free(), which are atomic(9), from ip_output().

The ifaddr is already referenced by the rtentry, and we are holding
reference on the rtentry throughout the function execution.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
This commit is contained in:
Gleb Smirnoff 2014-03-04 19:49:41 +00:00
parent 05acaa9f85
commit 2a7da7299d

View File

@ -293,7 +293,6 @@ again:
goto bad; goto bad;
} }
ia = ifatoia(rte->rt_ifa); ia = ifatoia(rte->rt_ifa);
ifa_ref(&ia->ia_ifa);
ifp = rte->rt_ifp; ifp = rte->rt_ifp;
rte->rt_rmx.rmx_pksent++; rte->rt_rmx.rmx_pksent++;
if (rte->rt_flags & RTF_GATEWAY) if (rte->rt_flags & RTF_GATEWAY)
@ -550,11 +549,8 @@ sendit:
#endif #endif
error = netisr_queue(NETISR_IP, m); error = netisr_queue(NETISR_IP, m);
goto done; goto done;
} else { } else
if (ia != NULL)
ifa_free(&ia->ia_ifa);
goto again; /* Redo the routing table lookup. */ goto again; /* Redo the routing table lookup. */
}
} }
/* See if local, if yes, send it to netisr with IP_FASTFWD_OURS. */ /* See if local, if yes, send it to netisr with IP_FASTFWD_OURS. */
@ -583,8 +579,6 @@ sendit:
m->m_flags |= M_SKIP_FIREWALL; m->m_flags |= M_SKIP_FIREWALL;
m->m_flags &= ~M_IP_NEXTHOP; m->m_flags &= ~M_IP_NEXTHOP;
m_tag_delete(m, fwd_tag); m_tag_delete(m, fwd_tag);
if (ia != NULL)
ifa_free(&ia->ia_ifa);
goto again; goto again;
} }
@ -697,8 +691,6 @@ passout:
done: done:
if (ro == &iproute) if (ro == &iproute)
RO_RTFREE(ro); RO_RTFREE(ro);
if (ia != NULL)
ifa_free(&ia->ia_ifa);
return (error); return (error);
bad: bad:
m_freem(m); m_freem(m);