From owner-svn-src-head@FreeBSD.ORG Sun Apr 27 10:20:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8B42B445; Sun, 27 Apr 2014 10:20:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 762DD38A; Sun, 27 Apr 2014 10:20:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3RAKckk073168; Sun, 27 Apr 2014 10:20:38 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3RAKc9R073142; Sun, 27 Apr 2014 10:20:38 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201404271020.s3RAKc9R073142@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Sun, 27 Apr 2014 10:20:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r265010 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Apr 2014 10:20:38 -0000 Author: melifaro Date: Sun Apr 27 10:20:37 2014 New Revision: 265010 URL: http://svnweb.freebsd.org/changeset/base/265010 Log: Cleanup route_output() a bit. MFC after: 1 month Modified: head/sys/net/rtsock.c Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Sun Apr 27 09:49:35 2014 (r265009) +++ head/sys/net/rtsock.c Sun Apr 27 10:20:37 2014 (r265010) @@ -530,6 +530,7 @@ route_output(struct mbuf *m, struct sock struct ifnet *ifp = NULL; union sockaddr_union saun; sa_family_t saf = AF_UNSPEC; + struct rawcb *rp = NULL; fibnum = so->so_fibnum; @@ -819,22 +820,14 @@ report: } flush: - if (rtm) { - if (error) - rtm->rtm_errno = error; - else - rtm->rtm_flags |= RTF_DONE; - } - if (rt) /* XXX can this be true? */ + if (rt != NULL) RTFREE(rt); - { - struct rawcb *rp = NULL; /* * Check to see if we don't want our own messages. */ if ((so->so_options & SO_USELOOPBACK) == 0) { if (V_route_cb.any_count <= 1) { - if (rtm) + if (rtm != NULL) Free(rtm); m_freem(m); return (error); @@ -842,6 +835,7 @@ flush: /* There is another listener, so construct message */ rp = sotorawcb(so); } + if (rtm != NULL) { #ifdef INET6 if (rti_need_deembed) { @@ -859,6 +853,11 @@ flush: } } #endif + if (error != 0) + rtm->rtm_errno = error; + else + rtm->rtm_flags |= RTF_DONE; + m_copyback(m, 0, rtm->rtm_msglen, (caddr_t)rtm); if (m->m_pkthdr.len < rtm->rtm_msglen) { m_freem(m); @@ -867,7 +866,7 @@ flush: m_adj(m, rtm->rtm_msglen - m->m_pkthdr.len); Free(rtm); } - if (m) { + if (m != NULL) { M_SETFIB(m, fibnum); m->m_flags |= RTS_FILTER_FIB; if (rp) { @@ -882,7 +881,7 @@ flush: } else rt_dispatch(m, saf); } - } + return (error); }