From owner-svn-src-head@freebsd.org Fri Jul 21 03:28:36 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6113D7E0EB; Fri, 21 Jul 2017 03:28:36 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 800441A48; Fri, 21 Jul 2017 03:28:36 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6L3SZYm086628; Fri, 21 Jul 2017 03:28:35 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6L3SZpm086627; Fri, 21 Jul 2017 03:28:35 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201707210328.v6L3SZpm086627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Fri, 21 Jul 2017 03:28:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321317 - head/sys/dev/netmap X-SVN-Group: head X-SVN-Commit-Author: loos X-SVN-Commit-Paths: head/sys/dev/netmap X-SVN-Commit-Revision: 321317 X-SVN-Commit-Repository: base 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.23 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: Fri, 21 Jul 2017 03:28:36 -0000 Author: loos Date: Fri Jul 21 03:28:35 2017 New Revision: 321317 URL: https://svnweb.freebsd.org/changeset/base/321317 Log: Do not allow the use of the loopback interface in netmap. The generic support in netmap send the packets using if_transmit() and the loopback do not support packets coming from if_transmit()/if_start(). This avoids the use of the loopback interface and the subsequent crash that happens when the application send packets to the loopback interface. Details in: https://github.com/luigirizzo/netmap/issues/322 Reported by: Vincenzo Maffione Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/dev/netmap/netmap_generic.c Modified: head/sys/dev/netmap/netmap_generic.c ============================================================================== --- head/sys/dev/netmap/netmap_generic.c Fri Jul 21 03:04:55 2017 (r321316) +++ head/sys/dev/netmap/netmap_generic.c Fri Jul 21 03:28:35 2017 (r321317) @@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$"); #include /* sockaddrs */ #include #include +#include #include #include /* bus_dmamap_* in netmap_kern.h */ @@ -1197,6 +1198,13 @@ generic_netmap_attach(struct ifnet *ifp) struct netmap_generic_adapter *gna; int retval; u_int num_tx_desc, num_rx_desc; + +#ifdef __FreeBSD__ + if (ifp->if_type == IFT_LOOP) { + D("if_loop is not supported by %s", __func__); + return EINVAL; + } +#endif num_tx_desc = num_rx_desc = netmap_generic_ringsize; /* starting point */