svn commit: r364341 - head/sys/dev/netmap

Vincenzo Maffione vmaffione at FreeBSD.org
Tue Aug 18 08:03:29 UTC 2020


Author: vmaffione
Date: Tue Aug 18 08:03:28 2020
New Revision: 364341
URL: https://svnweb.freebsd.org/changeset/base/364341

Log:
  netmap: fix parsing of legacy nmr->nr_ringid
  
  Code was checking for NETMAP_{SW,HW}_RING in req->nr_ringid which
  had already been masked by NETMAP_RING_MASK. Therefore, the comparisons
  always failed and set NR_REG_ALL_NIC. Check against the original nmr
  structure.
  
  Submitted by:	bpoole at packetforensics.com
  Reported by:	bpoole at packetforensics.com
  Reviewed by:	giuseppe.lettieri at unipi.it
  Approved by:	vmaffione
  MFC after:	1 week

Modified:
  head/sys/dev/netmap/netmap_legacy.c

Modified: head/sys/dev/netmap/netmap_legacy.c
==============================================================================
--- head/sys/dev/netmap/netmap_legacy.c	Tue Aug 18 07:23:47 2020	(r364340)
+++ head/sys/dev/netmap/netmap_legacy.c	Tue Aug 18 08:03:28 2020	(r364341)
@@ -76,9 +76,9 @@ nmreq_register_from_legacy(struct nmreq *nmr, struct n
 		/* Convert the older nmr->nr_ringid (original
 		 * netmap control API) to nmr->nr_flags. */
 		u_int regmode = NR_REG_DEFAULT;
-		if (req->nr_ringid & NETMAP_SW_RING) {
+		if (nmr->nr_ringid & NETMAP_SW_RING) {
 			regmode = NR_REG_SW;
-		} else if (req->nr_ringid & NETMAP_HW_RING) {
+		} else if (nmr->nr_ringid & NETMAP_HW_RING) {
 			regmode = NR_REG_ONE_NIC;
 		} else {
 			regmode = NR_REG_ALL_NIC;


More information about the svn-src-all mailing list