FromBytes
andFromBytesWithInput
have had the lifetime parameter removed. This removes the ability to borrow data from the buffer written to by therecv()
syscall. This is intentional as it provides more ergonomic support forNlRouter
to send messages across threads. A new trait,FromBytesWithInputBorrowed
, has been added to support the use case of borrowing payloads from attributes as&str
or&[u8]
.- The
async
feature API has been completely redesigned to more closely resemble it's corresponding synchronous API. - All
new()
methods and public fields on data structures used to construct packets have been replaced by the builder pattern.
sync
has been added as a Cargo feature. If a user is only interested in asynchronous functionality,sync
can be disabled to disable the higher level synchronous API and reduce the number of required dependencies.
- Extended ACK support. Sockets now support parsing and enabling entended ACKs for more information in error cases.
- New router infrastructure allowing ACK handling, seq management, and PID validation for requests sent in parallel.
- Builder pattern defined for all data structures used to construct netlink packets.
- syn
- libc
- If you were previously using
new()
methods defined on structs representing packet data, all packet data structures have been migrated over to a builder pattern. - Flags in packets have been migrated from a custom data structure to
bitflags
. For example&[Nlm::Request, Nlm::Ack]
is nowNlmF::REQUEST | NlmF::ACK
. - Because of previous errors around multicast groups, there is a new data structure
to handle group management that allows either converting from group numbers or a
bitmask. If you previously passed in 0 for groups, you will now use
Groups::empty()
. - If you were previously using convenience methods like
NlSocketHandle::iter()
orNlSocketHandle::resolve_genl_family
, this functionality has been migrated to the newNlRouter
functionality.NlSocketHandle
has been repurposed for a slightly lower level API providing iteration over all messages in a singlerecv()
buffer.NlRouter
provides a safer, parallelization-capable version of the functionality previously provided byNlSocketHandle
. See the documentation in theneli::router
module for a more detailed explanation of the problem this was meant to solve. - If you were previously using
Attr::get_payload_as_with_len()
with a&[u8]
or&str
type, you should change this toAttr::get_payload_as_with_len_borrowed()
. NlError
has been removed and replaced bySocketError
forNlSocketHandle
operations andRouterError
forNlRouter
operations. The appropriate conversions between errors usingFrom
should be implemented.Genlmsghdr::get_attr_handle()
has been removed in favor ofgenl.attrs().get_attr_handle()
.
- Fixed bug in error intepretation for Nlmsgerr.
- Add
FromBytes
/ToBytes
implementations foru128
.
Thanks to the upstream contributors who provided the code for this release!
- Fixed memory bug in
NlSocket::drop_mcast_membership()
unsafe code found using valgrind
- CI and clippy maintenance
- Added support for option user header in netlink protocol for generic netlink
- Added method to get socket PID
- Added support for converting to a
FlagBuffer
from a bitmask
- Fixed up
examples
directory to compile successfully withcargo build --examples
- Removed unnecessary features and dependencies (PR from MaxVerevkin)
- CI and clippy maintenance
- Bug fix for
RtBuffer
andGenlBuffer
size calculation - Bug fix for
Rtattr
size calculation - Bug fixes in tokio usage
- Bug fix where padding at the end of an empty netlink packet caused errors
- Better debug logging
See all pull requests and issues that went into this release here!
- Fixed problem where
Tcmsg
could not be created due to padding. - Fixed problem with listing multicast groups.
- Addition of
neli-proc-macros
crate to handle most of trait generation. - More testing!
- Changed the core traits from
Nl
to a number of different, more granular traits. - Consolidated
iter()
anditer2()
. - Major changes to async module.
- Changes to how bit flag sets are handled.
- Bug fix for
Ifinfomsg.ifi_change
being serialized twice. - Bug fix for
Ndmsg
where it could not be constructed due to private padding fields. - Bug fix for
Ifinfomsg.ifi_change
. This should be of typeIffFlags
, notIff
. - Fixed assumption in
NlSocketHandle::recv()
where this method never expected an ACK to be returned with no data.- The behavior of
NlSocketHandle::recv()
has changed slightly. It will now return ACKs and only returnsNone
when nonblocking. UseNlSocketHandle::iter()
for handling of streams of messages.
- The behavior of
- Fixed bug for deserialization of errors returned at the application level.
- Fixed bug in subscription to multicast groups.
- The API has been changed and
U32Bitmask
has been replaced byNetlinkBitArray
.
- The API has been changed and
- More constants in
Arphrd
. - More constants in
Ifla
. - Addition of
NlSocketHandle::iter2()
that does not restrict users to theNlWrapperType
type for packet parsing. - Addition of convenience methods on
RtBuffer
andGenlBuffer
types to make parsing nested attributes easier.
- Update to tokio 1.0.
- Fixed bug in
Ifaddrmsg
serialization and deserialization. Thanks,@joshtriplett
!
- Fixed bug in ACK handling.
- This change makes
NlSocketHandle
exclusively responsible for handling ACKs.
- This change makes
- Change from
buffering
structs for serialization to regular slices to allow buffer size tracking for each layer of serialization and deserialization and easy slicing into smaller, sized pieces. - Change
stream
feature toasync
for clarity with higher level API. - Remove
seq
andpid
tracking. This will eventually be added to higher level APIs. - Make
NlSocket::send
/::recv
take an immutable reference due to the case made for message vs. stream based sockets. - Remove universal exports of constants from the
consts
module. - Update to tokio 0.3.
- Split lower level and higher level synchronous netlink socket calls
across two structs,
NlSocket
andNlSocketHandle
. - Factor out parsing code so that it can be used across multiple socket types.
- Add nested netlink attribute parsing for routing netlink attributes.
- Changes to the
Nlmsg
struct to support handling application errors returned by the kernel. Previously, there was no easy way to handle application errors returned inside of anNlmsg
packet. - Added the ability to define the visibility for constants defined by
the
consts
macros.
- Add genetlink ID to family name/multicast group name lookup.
- Add
Index
type for nested attributes returned as a numbered list. NlSocket
functions to leave/list multicast groups.- Macro infrastructure for generating
serialize
anddeserialize
methods safely. attr
module for shared attribute code.- Debug logging enabled through the
logging
feature.
Nlattr.get_nested_attributes()
in favor of.get_attr_handle()
NlSocket.set_mcast_groups()
in favor of.add_multicast_membership()
- Bug fixes for rtnetlink
- Updates to the documentation.
- More examples.
- Links to the referenced data structures.
- Feature flagged NFLOG support, in the
netfilter
module.
- Resolved issue relating to allowing documentation annotations in macros for enum variants representing netlink constants.
- Change
Nlattr.add_nested_attribute()
to take a reference
- Support
RTM_*
constants inconsts.rs
- Fix length calculation errors
- Add methods to Nl trait with default implementations - does not break API
- Additional tests for padding
- Add design decision documentation for new padding handling
- Deprecate
.size()
usage forVec<Nlattr>
- use.asize()
instead
consts.rs
is nowconsts/
with a corresponding submodule for each category of constant - not a breaking change- Start enforcing rustfmt in CI and use cargo fmt to switch over to new formatting
- Merge PR fixing rtnetlink support
- Update buffering to 0.3.4 minimum to force stable channel support for neli
- Revert to builder pattern for creating/parsing generic netlink messages with attributes
- Particular notable changes for nested attribute handling
- Rework API in a number of places:
- Tokio support for sockets
- Many socket functions
- Generic netlink
- Support for rtnetlink
- Iterative message parsing from
NlSocket
- Support parsing multiple netlink messages returned in the same socket read buffer
- Missing documentation added
- Fix alignment bugs when serializing netlink attributes
- Migration to buffering crate for buffer operations - this does change the API
For record keeping it should be noted that semantic versioning was misused here. 0.3.0-r1 and 0.3.0-r2 should have been 0.3.1 and 0.3.2 respectively.
- Fix documentation bug
- After looking at tokio's
File
implementation, the file descriptor should block for theStream
implementation
- Type signature of
bind
andconnect
calls'groups
parameter was changed to be aVec<u32>
which will allow specifying a list of IDs and the group bitmask will be calculated for the user. poll
implementation of forNlSocket
fortokio::prelude::Stream
trait will now returnio::ErrorKind::InvalidData
if the socket file descriptor is not set to non-blocking before polling. This is intentional as Tokio docs rely on polls being non-blocking and my implementation requires a read that either returns anio::ErrorKind::WouldBlock
value or the desired data.- There is now an
nlattr
module to group together all of the netlink attribute code.
- A function
block
was added to allow reversingnonblock
function onNlSocket
. is_blocking
was added and returns abool
indicating whether reads will block on this socket.
get_payload_as
was deprecated in favor ofget_payload_with
.
None