1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-12 09:58:36 +00:00

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
This commit is contained in:
Vincenzo Maffione 2020-08-18 08:03:28 +00:00
parent f5f5f1e7d6
commit ff48ef48ac
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=364341

View File

@ -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;