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: bpo...@packetforensics.com
  Reported by:  bpo...@packetforensics.com
  Reviewed by:  giuseppe.letti...@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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to