libpnet / libpnet/netmap_sys

NIOCGREGIF is invalid

Open
#22 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
28
Forks
11
PR merge metrics
No merged PRs in 30d

Description

The original NIOCGREGIF is defined in netmap_legacy.h as the following:

/*
 * FreeBSD uses the size value embedded in the _IOWR to determine
 * how much to copy in/out. So we need it to match the actual
 * data structure we pass. We put some spares in the structure
 * to ease compatibility with other versions
 */
#define NIOCGINFO	_IOWR('i', 145, struct nmreq) /* return IF info */
#define NIOCREGIF	_IOWR('i', 146, struct nmreq) /* interface register */
#define NIOCCONFIG	_IOWR('i',150, struct nm_ifreq) /* for ext. modules */

The Rust's NIOCREGIF is defined here:

#[cfg(target_os = "linux")]
pub const NIOCREGIF: c_ulong = 3225184658;
#[cfg(target_os = "freebsd")]
pub const NIOCREGIF: c_ulong = 3225184658;

They are different on Linux and libc::ioctl(fd, NIOCREGIF, &mut nmr as *mut nmreq) results in Operation bot supported. Valid NIOCREGIF for Linux is 3225446802, isn't it?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the Rust definitions of NIOCREGIF and compare them with the declarations in netmap_legacy.h and the Linux value reported in the issue. Verify the ioctl call with the platform-specific constant; done means Linux uses the valid value while FreeBSD retains its own definition.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, rust
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.