From 2136f0546161adb55947c1a3ad002b236106b737 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 3 Nov 2021 09:46:52 +0100 Subject: [PATCH] aya: netlink: use NETLINK_EXT_ACK from libc crate NETLINK_EXT_ACK is available since libc crate version 0.2.105, see https://github.com/rust-lang/libc/releases/tag/0.2.105 --- aya/Cargo.toml | 2 +- aya/src/sys/netlink.rs | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/aya/Cargo.toml b/aya/Cargo.toml index 7c1dfc4b..df826920 100644 --- a/aya/Cargo.toml +++ b/aya/Cargo.toml @@ -11,7 +11,7 @@ documentation = "https://docs.rs/aya" edition = "2018" [dependencies] -libc = { version = "0.2" } +libc = { version = "0.2.105" } thiserror = "1" object = { version = "0.27", default-features = false, features = ["std", "read_core", "elf"] } bitflags = "1.2.1" diff --git a/aya/src/sys/netlink.rs b/aya/src/sys/netlink.rs index 2c6639c1..f9e4af40 100644 --- a/aya/src/sys/netlink.rs +++ b/aya/src/sys/netlink.rs @@ -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::(), 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