Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Jul 2017 03:28:35 +0000 (UTC)
From:      Luiz Otavio O Souza <loos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r321317 - head/sys/dev/netmap
Message-ID:  <201707210328.v6L3SZpm086627@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <v.maffione@gmail.com>
  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 <sys/socket.h> /* sockaddrs */
 #include <sys/selinfo.h>
 #include <net/if.h>
+#include <net/if_types.h>
 #include <net/if_var.h>
 #include <machine/bus.h>        /* 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 */
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707210328.v6L3SZpm086627>