|
|
|
@ -2,11 +2,11 @@ use std::{collections::HashMap, ffi::CStr, io, mem, os::unix::io::RawFd, ptr, sl
|
|
|
|
|
use thiserror::Error;
|
|
|
|
|
|
|
|
|
|
use libc::{
|
|
|
|
|
c_int, close, getsockname, nlattr, nlmsgerr, nlmsghdr, recv, send, setsockopt, sockaddr_nl,
|
|
|
|
|
socket, AF_NETLINK, AF_UNSPEC, ETH_P_ALL, IFLA_XDP, NETLINK_ROUTE, NLA_ALIGNTO, NLA_F_NESTED,
|
|
|
|
|
NLA_TYPE_MASK, NLMSG_DONE, NLMSG_ERROR, NLM_F_ACK, NLM_F_CREATE, NLM_F_DUMP, NLM_F_ECHO,
|
|
|
|
|
NLM_F_EXCL, NLM_F_MULTI, NLM_F_REQUEST, RTM_DELTFILTER, RTM_GETTFILTER, RTM_NEWQDISC,
|
|
|
|
|
RTM_NEWTFILTER, RTM_SETLINK, SOCK_RAW, SOL_NETLINK,
|
|
|
|
|
close, getsockname, nlattr, nlmsgerr, nlmsghdr, recv, send, setsockopt, sockaddr_nl, socket,
|
|
|
|
|
AF_NETLINK, AF_UNSPEC, ETH_P_ALL, IFLA_XDP, NETLINK_EXT_ACK, NETLINK_ROUTE, NLA_ALIGNTO,
|
|
|
|
|
NLA_F_NESTED, NLA_TYPE_MASK, NLMSG_DONE, NLMSG_ERROR, NLM_F_ACK, NLM_F_CREATE, NLM_F_DUMP,
|
|
|
|
|
NLM_F_ECHO, NLM_F_EXCL, NLM_F_MULTI, NLM_F_REQUEST, RTM_DELTFILTER, RTM_GETTFILTER,
|
|
|
|
|
RTM_NEWQDISC, RTM_NEWTFILTER, RTM_SETLINK, SOCK_RAW, SOL_NETLINK,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
use crate::{
|
|
|
|
@ -20,7 +20,6 @@ use crate::{
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const NLA_HDR_LEN: usize = align_to(mem::size_of::<nlattr>(), NLA_ALIGNTO as usize);
|
|
|
|
|
const NETLINK_EXT_ACK: c_int = 11;
|
|
|
|
|
|
|
|
|
|
// Safety: marking this as unsafe overall because of all the pointer math required to comply with
|
|
|
|
|
// netlink alignments
|
|
|
|
|