From owner-p4-projects@FreeBSD.ORG Sun Aug 16 19:32:28 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 233C5106568E; Sun, 16 Aug 2009 19:32:28 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBEA6106568B for ; Sun, 16 Aug 2009 19:32:27 +0000 (UTC) (envelope-from bz@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B19888FC15 for ; Sun, 16 Aug 2009 19:32:27 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n7GJWRda011759 for ; Sun, 16 Aug 2009 19:32:27 GMT (envelope-from bz@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n7GJWRaB011757 for perforce@freebsd.org; Sun, 16 Aug 2009 19:32:27 GMT (envelope-from bz@freebsd.org) Date: Sun, 16 Aug 2009 19:32:27 GMT Message-Id: <200908161932.n7GJWRaB011757@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bz@freebsd.org using -f From: "Bjoern A. Zeeb" To: Perforce Change Reviews Cc: Subject: PERFORCE change 167411 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2009 19:32:28 -0000 http://perforce.freebsd.org/chv.cgi?CH=167411 Change 167411 by bz@bz_zoo on 2009/08/16 19:32:08 - Rather than returning directly make a copy of the mbuf and leave the original for the routing socket to possibly loop it back to other listeners. - Only adjust our local copy that we send to send_output_hook, which will be responsible to make sure the mbuf will be freed. Affected files ... .. //depot/projects/soc2009/anchie_send/src/sys/net/rtsock.c#16 edit Differences ... ==== //depot/projects/soc2009/anchie_send/src/sys/net/rtsock.c#16 (text+ko) ==== @@ -526,26 +526,41 @@ printf("RTM_SND!\n"); switch (rtm->rtm_seq) { + struct mbuf *n; + case RTM_SND_IN: ifp = ifnet_byindex(rtm->rtm_index); - if (ifp) { - m_adj(m, sizeof (struct rt_msghdr)); - printf("rtm->rtm_index = %d\n", rtm->rtm_index); - send_output_hook(m, ifp, SND_IN); - } else { - printf("route_output: ifp == NULL"); + if (!ifp) { + printf("%s: RTM_SND_IN ifp == NULL", __func__); + senderr(EINVAL); + } + if ((n = m_dup(m, M_DONTWAIT)) == NULL) { + printf("%s: RTM_SND_IN n == NULL", __func__); + senderr(ENOBUFS); } - return (0); + m_adj(n, sizeof(struct rt_msghdr)); + printf("%s: RTM_SND_IN ifp=%p(%s), mbuf=%p\n", + __func__, ifp, ifp->if_xname, n); + error = send_output_hook(n, ifp, SND_IN); + if (error) + senderr(error); break; case RTM_SND_OUT: ifp = ifnet_byindex(rtm->rtm_index); - if (ifp) { - m_adj(m, sizeof (struct rt_msghdr)); - printf("if_index = %u\n", ifp->if_index); - send_output_hook(m, ifp, SND_OUT); - } else - printf("route_output: ifp == NULL"); - return (0); + if (!ifp) { + printf("%s: RTM_SND_OUT ifp == NULL", __func__); + senderr(EINVAL); + } + if ((n = m_dup(m, M_DONTWAIT)) == NULL) { + printf("%s: RTM_SND_OUT n == NULL", __func__); + senderr(ENOBUFS); + } + m_adj(n, sizeof(struct rt_msghdr)); + printf("%s: RTM_SND_OUT ifp=%p(%s), mbuf=%p\n", + __func__, ifp, ifp->if_xname, n); + error = send_output_hook(n, ifp, SND_OUT); + if (error) + senderr(error); break; }