From ff48ef48acea19ce9d60a7450dcccf8e3c7d16f7 Mon Sep 17 00:00:00 2001 From: Vincenzo Maffione Date: Tue, 18 Aug 2020 08:03:28 +0000 Subject: 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@packetforensics.com Reported by: bpoole@packetforensics.com Reviewed by: giuseppe.lettieri@unipi.it Approved by: vmaffione MFC after: 1 week --- sys/dev/netmap/netmap_legacy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/netmap/netmap_legacy.c b/sys/dev/netmap/netmap_legacy.c index 55b10a54721b..512e1e084910 100644 --- a/sys/dev/netmap/netmap_legacy.c +++ b/sys/dev/netmap/netmap_legacy.c @@ -76,9 +76,9 @@ nmreq_register_from_legacy(struct nmreq *nmr, struct nmreq_header *hdr, /* 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; -- cgit v1.2.3