aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml2
-rw-r--r--macros/src/lib.rs2
-rw-r--r--src/error.rs2
-rw-r--r--src/expr/mod.rs2
-rw-r--r--src/nlmsg.rs2
-rw-r--r--src/parser.rs6
-rw-r--r--src/parser_impls.rs2
7 files changed, 9 insertions, 9 deletions
diff --git a/Cargo.toml b/Cargo.toml
index c6caf47..471b885 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -26,5 +26,5 @@ rustables-macros = { path = "macros", version = "0.1.1-alpha1" }
env_logger = "0.9"
[build-dependencies]
-bindgen = "0.53.1"
+bindgen = "0.68.1"
regex = "1.5.4"
diff --git a/macros/src/lib.rs b/macros/src/lib.rs
index af90dab..cd53b10 100644
--- a/macros/src/lib.rs
+++ b/macros/src/lib.rs
@@ -364,7 +364,7 @@ pub fn nfnetlink_struct(attrs: TokenStream, item: TokenStream) -> TokenStream {
quote!(
impl crate::nlmsg::AttributeDecoder for #name {
#[allow(dead_code)]
- fn decode_attribute(&mut self, attr_type: u16, buf: &[u8]) -> Result<(), crate::error::DecodeError> {
+ fn decode_attribute(&mut self, attr_type: u32, buf: &[u8]) -> Result<(), crate::error::DecodeError> {
use crate::nlmsg::NfNetlinkDeserializable;
debug!("Decoding attribute {} in type {}", attr_type, std::any::type_name::<#name>());
match attr_type {
diff --git a/src/error.rs b/src/error.rs
index b7ae17b..b2aff3a 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -110,7 +110,7 @@ pub enum DecodeError {
MissingExpressionName,
#[error("Unsupported attribute type")]
- UnsupportedAttributeType(u16),
+ UnsupportedAttributeType(u32),
#[error("Unexpected message type")]
UnexpectedType(u16),
diff --git a/src/expr/mod.rs b/src/expr/mod.rs
index f8fd67d..f72dcb6 100644
--- a/src/expr/mod.rs
+++ b/src/expr/mod.rs
@@ -130,7 +130,7 @@ macro_rules! create_expr_variant {
impl $crate::nlmsg::AttributeDecoder for RawExpression {
fn decode_attribute(
&mut self,
- attr_type: u16,
+ attr_type: u32,
buf: &[u8],
) -> Result<(), $crate::error::DecodeError> {
debug!("Decoding attribute {} in an expression", attr_type);
diff --git a/src/nlmsg.rs b/src/nlmsg.rs
index b8fa857..5f0e554 100644
--- a/src/nlmsg.rs
+++ b/src/nlmsg.rs
@@ -113,7 +113,7 @@ impl<'a> NfNetlinkWriter<'a> {
}
}
-pub type NetlinkType = u16;
+pub type NetlinkType = u32;
pub trait AttributeDecoder {
fn decode_attribute(&mut self, attr_type: NetlinkType, buf: &[u8]) -> Result<(), DecodeError>;
diff --git a/src/parser.rs b/src/parser.rs
index 82dd27e..fd71fdd 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -112,9 +112,9 @@ pub fn write_attribute<'a>(ty: NetlinkType, obj: &impl NfNetlinkAttribute, mut b
// nla_len contains the header size + the unpadded attribute length
nla_len: (header_len + obj.get_size() as usize) as u16,
nla_type: if obj.is_nested() {
- ty | NLA_F_NESTED as u16
+ (ty | NLA_F_NESTED) as u16
} else {
- ty
+ ty as u16
},
};
@@ -138,7 +138,7 @@ pub(crate) fn read_attributes<T: AttributeDecoder + Default>(buf: &[u8]) -> Resu
while remaining_size > pad_netlink_object::<nlattr>() {
let nlattr = unsafe { *transmute::<*const u8, *const nlattr>(buf[pos..].as_ptr()) };
// ignore the byteorder and nested attributes
- let nla_type = nlattr.nla_type & NLA_TYPE_MASK as u16;
+ let nla_type: u32 = (nlattr.nla_type & NLA_TYPE_MASK as u16).into();
pos += pad_netlink_object::<nlattr>();
let attr_remaining_size = nlattr.nla_len as usize - pad_netlink_object::<nlattr>();
diff --git a/src/parser_impls.rs b/src/parser_impls.rs
index c49c876..28ef8de 100644
--- a/src/parser_impls.rs
+++ b/src/parser_impls.rs
@@ -193,7 +193,7 @@ where
while buf.len() - pos > pad_netlink_object::<nlattr>() {
let nlattr = unsafe { *transmute::<*const u8, *const nlattr>(buf[pos..].as_ptr()) };
// ignore the byteorder and nested attributes
- let nla_type = nlattr.nla_type & NLA_TYPE_MASK as u16;
+ let nla_type: u32 = (nlattr.nla_type & NLA_TYPE_MASK as u16).into();
if nla_type != NFTA_LIST_ELEM {
return Err(DecodeError::UnsupportedAttributeType(nla_type));