netmap_sys icon indicating copy to clipboard operation
netmap_sys copied to clipboard

NIOCGREGIF is invalid

Open Hirrolot opened this issue 4 years ago • 1 comments

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?

Hirrolot avatar Aug 23 '19 17:08 Hirrolot