From owner-svn-src-all@FreeBSD.ORG Sun Jun 21 10:10:44 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 948851065670; Sun, 21 Jun 2009 10:10:44 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 825A68FC17; Sun, 21 Jun 2009 10:10:44 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5LAAide002415; Sun, 21 Jun 2009 10:10:44 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5LAAijU002410; Sun, 21 Jun 2009 10:10:44 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906211010.n5LAAijU002410@svn.freebsd.org> From: Robert Watson Date: Sun, 21 Jun 2009 10:10:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194580 - head/sys/netipx X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 10:10:45 -0000 Author: rwatson Date: Sun Jun 21 10:10:44 2009 New Revision: 194580 URL: http://svn.freebsd.org/changeset/base/194580 Log: Remove historical support for capturing IPX packets in the output path using raw IPX sockets. While functional, this support is disabled using a flag that can't be changed from userspace, and google reveals no documentation or use of that flag anywhere. This eliminates a potential lock order reversal and code reentrance issue in which the output path reentered the input path in IPX. An alternative to removal would be to use the netisr, as a comment I added in 2005 suggests. While this change is fairly straight-forward, the lack of any consumers or the easy possibility of consumers (kernel modification and recompile required) suggests that this is simply an unused feature. Update README to remove this TODO, and a TODO regarding IPX/IP encapsulation which was also removed a few years ago. MFC after: 1 week Modified: head/sys/netipx/README head/sys/netipx/ipx_input.c head/sys/netipx/ipx_outputfl.c head/sys/netipx/ipx_var.h Modified: head/sys/netipx/README ============================================================================== --- head/sys/netipx/README Sun Jun 21 09:39:43 2009 (r194579) +++ head/sys/netipx/README Sun Jun 21 10:10:44 2009 (r194580) @@ -39,11 +39,3 @@ Modifications Copyright (c) 2004-2006 Ro but unsent data. As with TCP, it should instead grab its own reference to the socket so that it is not released, as hold onto it until the data transfer is complete. - -(3) Raw socket capture of IPX output intercepts packets in the SPX output - routine in order to feed them back into the raw socket. This results - in recursion into the socket code in the transmit path; instead, - captured packets should be fed into a netisr that reinjects them into - raw sockets from a new (asynchronous) context. - -(4) IPX over IP encapsulation needs work to make it properly MPSAFE. Modified: head/sys/netipx/ipx_input.c ============================================================================== --- head/sys/netipx/ipx_input.c Sun Jun 21 09:39:43 2009 (r194579) +++ head/sys/netipx/ipx_input.c Sun Jun 21 10:10:44 2009 (r194580) @@ -452,53 +452,3 @@ ipx_undo_route(struct route *ro) RTFREE(ro->ro_rt); } } - -/* - * XXXRW: This code should be run in its own netisr dispatch to avoid a call - * back into the socket code from the IPX output path. - */ -void -ipx_watch_output(struct mbuf *m, struct ifnet *ifp) -{ - struct ipxpcb *ipxp; - struct ifaddr *ifa; - struct ipx_ifaddr *ia; - - /* - * Give any raw listeners a crack at the packet - */ - IPX_LIST_LOCK(); - LIST_FOREACH(ipxp, &ipxrawpcb_list, ipxp_list) { - struct mbuf *m0 = m_copy(m, 0, (int)M_COPYALL); - if (m0 != NULL) { - struct ipx *ipx; - - M_PREPEND(m0, sizeof(*ipx), M_DONTWAIT); - if (m0 == NULL) - continue; - ipx = mtod(m0, struct ipx *); - ipx->ipx_sna.x_net = ipx_zeronet; - for (ia = ipx_ifaddr; ia != NULL; ia = ia->ia_next) - if (ifp == ia->ia_ifp) - break; - if (ia == NULL) - ipx->ipx_sna.x_host = ipx_zerohost; - else - ipx->ipx_sna.x_host = - ia->ia_addr.sipx_addr.x_host; - - if (ifp != NULL && (ifp->if_flags & IFF_POINTOPOINT)) - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - if (ifa->ifa_addr->sa_family == AF_IPX) { - ipx->ipx_sna = IA_SIPX(ifa)->sipx_addr; - break; - } - } - ipx->ipx_len = ntohl(m0->m_pkthdr.len); - IPX_LOCK(ipxp); - ipx_input(m0, ipxp); - IPX_UNLOCK(ipxp); - } - } - IPX_LIST_UNLOCK(); -} Modified: head/sys/netipx/ipx_outputfl.c ============================================================================== --- head/sys/netipx/ipx_outputfl.c Sun Jun 21 09:39:43 2009 (r194579) +++ head/sys/netipx/ipx_outputfl.c Sun Jun 21 10:10:44 2009 (r194580) @@ -74,8 +74,6 @@ __FBSDID("$FreeBSD$"); #include #include -static int ipx_copy_output = 0; - int ipx_outputfl(struct mbuf *m0, struct route *ro, int flags) { @@ -150,9 +148,6 @@ gotif: if (htons(ipx->ipx_len) <= ifp->if_mtu) { ipxstat.ipxs_localout++; - if (ipx_copy_output) { - ipx_watch_output(m0, ifp); - } error = (*ifp->if_output)(ifp, m0, (struct sockaddr *)dst, ro); goto done; @@ -161,9 +156,6 @@ gotif: error = EMSGSIZE; } bad: - if (ipx_copy_output) { - ipx_watch_output(m0, ifp); - } m_freem(m0); done: if (ro == &ipxroute && (flags & IPX_ROUTETOIF) == 0 && Modified: head/sys/netipx/ipx_var.h ============================================================================== --- head/sys/netipx/ipx_var.h Sun Jun 21 09:39:43 2009 (r194579) +++ head/sys/netipx/ipx_var.h Sun Jun 21 10:10:44 2009 (r194580) @@ -124,7 +124,6 @@ int ipx_output_type20(struct mbuf *); int ipx_peeraddr(struct socket *so, struct sockaddr **nam); void ipx_printhost(struct ipx_addr *addr); int ipx_sockaddr(struct socket *so, struct sockaddr **nam); -void ipx_watch_output(struct mbuf *m, struct ifnet *ifp); #endif /* _KERNEL */