Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
payload::{NLMSG_DONE, NLMSG_ERROR, NLMSG_NOOP, NLMSG_OVERRUN},
DecodeError, DoneBuffer, DoneMessage, Emitable, ErrorBuffer, ErrorContext,
ErrorMessage, NetlinkBuffer, NetlinkDeserializable, NetlinkHeader,
NetlinkPayload, NetlinkSerializable, Parseable,
NetlinkPayload, NetlinkSerializable, Parseable, NLM_F_MULTIPART,
};

/// Represent a netlink message.
Expand Down Expand Up @@ -103,7 +103,8 @@ where
Error(msg)
}
NLMSG_NOOP => Noop,
NLMSG_DONE => {
// message without NLM_F_MULTIPART shouldn't be parsed to DoneMessage
NLMSG_DONE if header.flags & NLM_F_MULTIPART != 0 => {
// Linux kernel allows zero sized of NLMSG_DONE
let msg = if bytes.is_empty() {
DoneBuffer::new_checked(&[0u8; DONE_HEADER_LEN])
Expand Down Expand Up @@ -214,7 +215,8 @@ mod tests {

#[test]
fn test_done() {
let header = NetlinkHeader::default();
let mut header = NetlinkHeader::default();
header.flags |= NLM_F_MULTIPART;
let done_msg = DoneMessage {
code: 0,
extended_ack: vec![6, 7, 8, 9],
Expand Down