Skip to content

chore(deps): Bump socketcan from 3.6.2 to 4.0.0 - #20

Open
dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/cargo/socketcan-4.0.0
Open

dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/cargo/socketcan-4.0.0

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Nov 24, 2026

Copy link
Copy Markdown

Bumps socketcan from 3.6.2 to 4.0.0.

Release notes

Sourced from socketcan's releases.

Version 4.0.0

Basics

  • More complete Error support, including multiple causes for an error.
  • Improved CAN dump support
  • Optional serde support for serializing and deserializing frames and other data types.
  • Improved netlink caabilities
  • Bumped the MSRV to 1.89, Edition to 2024, and updated a number of dependencies.
  • Several bug fixes and additional improvements

Details

  • Bumped MSRV to v1.89.0
  • Bumped Rust Edition to 2024
  • Removed direct support for async-std which is no longer maintained.
  • #88 Updated smol to v2.0
  • #99 Update neli and clap
  • Replaced the unmaintained libudev 0.3 dependency with udev 0.9 for interface enumeration (enumerate feature).
    • udev reports errors as io::Error, so the bespoke From<libudev::Error> for Error conversion was removed
  • Updated socket2 to v0.6
    • The From<CanAddr> for SockAddr now fills socket2's new SockAddrStorage wrapper type
  • Updated nix to v0.31 (no API changes required) and dropped the unused process feature (only poll and net are used)
  • Dropped the itertools dependency. Its only use was joining a frame's payload bytes into a hex string when formatting a candump record, which now writes them straight to the formatter, as the Frame hex formatting already did — one allocation per byte fewer, and no dependency
  • Updated the serial_test dev-dependency to v3.5 (no API changes required)
  • Updated the futures-timer dev-dependency to v3.0. Its Delay future now yields () instead of io::Result<()>, so the .await? in the tokio_send/smol_send examples became .await
  • docs.rs builds the documentation with all features again. v3.6.2 pinned it to a subset — features = ["netlink", "dump", "enumerate", "utils", "tokio"] — because building the async-io/async-std/smol features failed on the nightly compiler that docs.rs uses (#102). Direct async-std support is gone in 4.0 and the remaining smol path builds cleanly on current nightly, so all-features = true and the TODO it carried are restored
  • Breaking: removed the API that 3.x deprecated for this release. The free socket::set_socket_option() and set_socket_option_mult() functions (deprecated in 3.4.0) are gone — use the identically-named SocketOptions trait methods; dump::Reader::records() (3.5.0) is gone, along with the CanDumpRecords iterator it was the only way to construct — use Reader's own Iterator impl, which yields a whole CanDumpRecord rather than a (u64, CanAnyFrame) pair; and CanInterface::set_full_ctrlmode() (3.2.0) is gone — use set_ctrlmodes()
  • Breaking: the SOF_TIMESTAMPING_* flags are no longer re-exported from the crate root. They live with the rest of the timestamping API, in socketcan::timestamp, alongside CanTimestamps (which stays at the root as well) and the timespec converters. Import them from there: use socketcan::timestamp::SOF_TIMESTAMPING_RX_SOFTWARE;
  • The SOF_TIMESTAMPING_* values now come from libc rather than being repeated here. libc has carried the full set since 0.2.186; this crate names the subset it documents, re-typed from c_uint to u32 to match SocketOptions::set_timestamping(), and each keeps the note explaining what it selects. The ethtool_ts_info mirror and ETHTOOL_GET_TS_INFO are still absent upstream and stay defined here
  • Breaking: the frame module no longer re-exports the id module's contents (CAN_EFF_FLAG, CAN_MAX_DLEN, IdFlags, FdFlags, id_to_canid_t, …), and socket no longer re-exports CanAddr. Both blocks were marked in the source as "remove on the next major version". Import them from their own modules instead — socketcan::id::FdFlags, socketcan::id::ERR_MASK_ALL — or, for CanAddr, from the crate root, which re-exports it
  • CanRawFrame now derives Debug, like every other frame type. It could not before: the libc frame structs only implement Debug with the extra_traits feature, which this crate now enables
  • SocketOptions::set_error_mask() is now a thin alias for set_error_filter() rather than a second copy of the same setsockopt call. Both names stay, since the mask spelling reads naturally next to ERR_MASK_ALL/ERR_MASK_NONE
  • Breaking: the AsPtr::as_bytes and AsPtr::as_bytes_mut trait methods are now unsafe fn with a documented # Safety contract (reading uninitialised padding through the returned byte slice is UB). This completes the soundness fix begun in 3.6.0 (which marked the free as_bytes/as_bytes_mut helpers unsafe). Callers of these trait methods must wrap calls in unsafe
  • New optional serde feature (non-default) for serializing frames, errors, and interface configuration
    • Frames (CanFrame, CanAnyFrame, CanDataFrame, CanRemoteFrame, CanErrorFrame, CanFdFrame), CanId, IdFlags/FdFlags, CanFilter, CanTimestamps, dump::CanDumpRecord, every error type, and the netlink configuration types (InterfaceDetails, InterfaceCanParams, CanBitTiming, CanCtrlModes, Mtu, CanState, …)
    • The frame types wrap the C can_frame/canfd_frame, which have no serde impls, so they convert through logical repr types (CanDataFrameRepr and friends). The raw C structs are deliberately never serialized: they contain padding and possibly-uninitialised bytes, and their layout is not portable. Deserializing routes back through the normal constructors, so an out-of-range identifier or an over-long payload is rejected rather than producing a malformed frame
    • Frame payloads serialize through serialize_bytes, so formats with a native byte-string type (MessagePack, CBOR, bincode) use it instead of a sequence of integers. JSON, which has no byte-string type, renders a byte array
    • CanError serializes as a flat array of its causes rather than exposing its internal storage, and deserializing an empty array is an error — the non-empty invariant holds across serde
    • IdFlags/FdFlags serialize as flag-name strings ("BRS | FDF") via bitflags' serde support
    • Error::Can round-trips exactly. An io::Error is lossy by necessity, since it implements neither serde trait: it is reduced to an ErrorKind name plus the message. After a round trip raw_os_error() is None, any source() chain is gone, and a kind with no stable name (or one a newer version introduced) arrives as ErrorKind::Other. This applies both to Error::Io and to the Io variant of a dump::ParseError nested in Error::Parser; the parser's other variants round-trip exactly
    • Unset Option fields on the netlink configuration types are omitted rather than written as nulls, and are optional on input, so a config file need only carry the parameters you care about
    • Useful in particular for keeping interface configuration — bitrates, control modes — in a JSON or TOML file
  • candump log format: error frames are now handled in both directions by the dump module. Previously neither worked — the parser rejected an error line outright (the error-class bits sit above CAN_EFF_MASK, so decoding the ID failed), while Display wrote the ID with CAN_ERR_FLAG stripped, so its own output re-parsed as a standard data frame
    • The parser branches on CAN_ERR_FLAG before decoding the identifier. An eight-digit ID field is ambiguous — extended data frame or error frame — and that bit is the only thing distinguishing them, which is how can-utils resolves it too
    • Display now emits the ID with CAN_ERR_FLAG included, so a line round-trips exactly. Confirmed against real candump -L output
    • Parsed error frames flow through the new CanError decoding, so a multi-condition error line decodes fully
    • The dump module docs now state the full grammar, cite the can-utils parse_canframe() comment as the source of truth, and cross-reference doc/CanDumpLogFormat.md
    • Not yet supported: the _len8_dlc suffix (123#1122334455667788_E), which is still rejected with ParseError::InvalidCanFrame
  • Breaking (candump log format): the optional direction field that candump -x appends to each line — R or T, which way the frame went on the interface that logged it — is now parsed and emitted. CanDumpRecord gains a direction: Option<Direction> — breaking for anyone constructing the record as a struct literal — None for a log captured without the flag, and a line carrying the field round-trips with it. Based on #94 by @​isikkema-ornl, re-done against the rewritten dump module
    • A fourth field that is neither spelling is rejected with the new ParseError::InvalidFrameDirection rather than ignored, which is what the parser did with any fourth field before. Lowercase is accepted, although candump writes only uppercase

... (truncated)

Changelog

Sourced from socketcan's changelog.

Version 4.0.0 (2026-09-05)

  • Bumped MSRV to v1.89.0
  • Bumped Rust Edition to 2024
  • Removed direct support for async-std which is no longer maintained.
  • #88 Updated smol to v2.0
  • #99 Update neli and clap
  • Replaced the unmaintained libudev 0.3 dependency with udev 0.9 for interface enumeration (enumerate feature).
    • udev reports errors as io::Error, so the bespoke From<libudev::Error> for Error conversion was removed
  • Updated socket2 to v0.6
    • The From<CanAddr> for SockAddr now fills socket2's new SockAddrStorage wrapper type
  • Updated nix to v0.31 (no API changes required) and dropped the unused process feature (only poll and net are used)
  • Dropped the itertools dependency. Its only use was joining a frame's payload bytes into a hex string when formatting a candump record, which now writes them straight to the formatter, as the Frame hex formatting already did — one allocation per byte fewer, and no dependency
  • Updated the serial_test dev-dependency to v3.5 (no API changes required)
  • Updated the futures-timer dev-dependency to v3.0. Its Delay future now yields () instead of io::Result<()>, so the .await? in the tokio_send/smol_send examples became .await
  • docs.rs builds the documentation with all features again. v3.6.2 pinned it to a subset — features = ["netlink", "dump", "enumerate", "utils", "tokio"] — because building the async-io/async-std/smol features failed on the nightly compiler that docs.rs uses (#102). Direct async-std support is gone in 4.0 and the remaining smol path builds cleanly on current nightly, so all-features = true and the TODO it carried are restored
  • Breaking: removed the API that 3.x deprecated for this release. The free socket::set_socket_option() and set_socket_option_mult() functions (deprecated in 3.4.0) are gone — use the identically-named SocketOptions trait methods; dump::Reader::records() (3.5.0) is gone, along with the CanDumpRecords iterator it was the only way to construct — use Reader's own Iterator impl, which yields a whole CanDumpRecord rather than a (u64, CanAnyFrame) pair; and CanInterface::set_full_ctrlmode() (3.2.0) is gone — use set_ctrlmodes()
  • Breaking: the SOF_TIMESTAMPING_* flags are no longer re-exported from the crate root. They live with the rest of the timestamping API, in socketcan::timestamp, alongside CanTimestamps (which stays at the root as well) and the timespec converters. Import them from there: use socketcan::timestamp::SOF_TIMESTAMPING_RX_SOFTWARE;
  • The SOF_TIMESTAMPING_* values now come from libc rather than being repeated here. libc has carried the full set since 0.2.186; this crate names the subset it documents, re-typed from c_uint to u32 to match SocketOptions::set_timestamping(), and each keeps the note explaining what it selects. The ethtool_ts_info mirror and ETHTOOL_GET_TS_INFO are still absent upstream and stay defined here
  • Breaking: the frame module no longer re-exports the id module's contents (CAN_EFF_FLAG, CAN_MAX_DLEN, IdFlags, FdFlags, id_to_canid_t, …), and socket no longer re-exports CanAddr. Both blocks were marked in the source as "remove on the next major version". Import them from their own modules instead — socketcan::id::FdFlags, socketcan::id::ERR_MASK_ALL — or, for CanAddr, from the crate root, which re-exports it
  • CanRawFrame now derives Debug, like every other frame type. It could not before: the libc frame structs only implement Debug with the extra_traits feature, which this crate now enables
  • SocketOptions::set_error_mask() is now a thin alias for set_error_filter() rather than a second copy of the same setsockopt call. Both names stay, since the mask spelling reads naturally next to ERR_MASK_ALL/ERR_MASK_NONE
  • Breaking: the AsPtr::as_bytes and AsPtr::as_bytes_mut trait methods are now unsafe fn with a documented # Safety contract (reading uninitialised padding through the returned byte slice is UB). This completes the soundness fix begun in 3.6.0 (which marked the free as_bytes/as_bytes_mut helpers unsafe). Callers of these trait methods must wrap calls in unsafe
  • New optional serde feature (non-default) for serializing frames, errors, and interface configuration
    • Frames (CanFrame, CanAnyFrame, CanDataFrame, CanRemoteFrame, CanErrorFrame, CanFdFrame), CanId, IdFlags/FdFlags, CanFilter, CanTimestamps, dump::CanDumpRecord, every error type, and the netlink configuration types (InterfaceDetails, InterfaceCanParams, CanBitTiming, CanCtrlModes, Mtu, CanState, …)
    • The frame types wrap the C can_frame/canfd_frame, which have no serde impls, so they convert through logical repr types (CanDataFrameRepr and friends). The raw C structs are deliberately never serialized: they contain padding and possibly-uninitialised bytes, and their layout is not portable. Deserializing routes back through the normal constructors, so an out-of-range identifier or an over-long payload is rejected rather than producing a malformed frame
    • Frame payloads serialize through serialize_bytes, so formats with a native byte-string type (MessagePack, CBOR, bincode) use it instead of a sequence of integers. JSON, which has no byte-string type, renders a byte array
    • CanError serializes as a flat array of its causes rather than exposing its internal storage, and deserializing an empty array is an error — the non-empty invariant holds across serde
    • IdFlags/FdFlags serialize as flag-name strings ("BRS | FDF") via bitflags' serde support
    • Error::Can round-trips exactly. An io::Error is lossy by necessity, since it implements neither serde trait: it is reduced to an ErrorKind name plus the message. After a round trip raw_os_error() is None, any source() chain is gone, and a kind with no stable name (or one a newer version introduced) arrives as ErrorKind::Other. This applies both to Error::Io and to the Io variant of a dump::ParseError nested in Error::Parser; the parser's other variants round-trip exactly
    • Unset Option fields on the netlink configuration types are omitted rather than written as nulls, and are optional on input, so a config file need only carry the parameters you care about
    • Useful in particular for keeping interface configuration — bitrates, control modes — in a JSON or TOML file
  • candump log format: error frames are now handled in both directions by the dump module. Previously neither worked — the parser rejected an error line outright (the error-class bits sit above CAN_EFF_MASK, so decoding the ID failed), while Display wrote the ID with CAN_ERR_FLAG stripped, so its own output re-parsed as a standard data frame
    • The parser branches on CAN_ERR_FLAG before decoding the identifier. An eight-digit ID field is ambiguous — extended data frame or error frame — and that bit is the only thing distinguishing them, which is how can-utils resolves it too
    • Display now emits the ID with CAN_ERR_FLAG included, so a line round-trips exactly. Confirmed against real candump -L output
    • Parsed error frames flow through the new CanError decoding, so a multi-condition error line decodes fully
    • The dump module docs now state the full grammar, cite the can-utils parse_canframe() comment as the source of truth, and cross-reference doc/CanDumpLogFormat.md
    • Not yet supported: the _len8_dlc suffix (123#1122334455667788_E), which is still rejected with ParseError::InvalidCanFrame
  • Breaking (candump log format): the optional direction field that candump -x appends to each line — R or T, which way the frame went on the interface that logged it — is now parsed and emitted. CanDumpRecord gains a direction: Option<Direction> — breaking for anyone constructing the record as a struct literal — None for a log captured without the flag, and a line carrying the field round-trips with it. Based on #94 by @​isikkema-ornl, re-done against the rewritten dump module
    • A fourth field that is neither spelling is rejected with the new ParseError::InvalidFrameDirection rather than ignored, which is what the parser did with any fourth field before. Lowercase is accepted, although candump writes only uppercase
    • #94 - Reimplemented
      • Direction serializes by name, and the record's field is omitted entirely when it is None
      • Direction implements FromStr and Display, so the field converts both ways on its own, and FromStr reports ParseError::InvalidFrameDirection directly rather than an opaque unit error
    • The grammar in the dump module docs and in doc/CanDumpLogFormat.md gains the field, with a section on what candump writes, examples captured from candump -L -x, and a note that canplayer accepts a line carrying it
  • Breaking: an error frame now decodes into all the conditions it describes, not just one. A single SocketCAN error frame routinely reports several at once, and the old decoder discarded almost all of them
    • New ErrorCause type carrying one condition: TransmitTimeout, LostArbitration(u8), Controller(ControllerProblems), Protocol { types, location }, Transceiver { canh, canl }, NoAck, BusOff, BusError, Restarted, Counters { tx, rx }, DecodingFailure and Unknown(u32). It is #[non_exhaustive], since future kernels may define more error class bits
    • CanError is now the whole decoded frame: one error with a non-empty list of causes, one per class bit set in the frame's CAN ID. It has new(), from_multiple(), from_iter_checked(), first(), last(), len(), is_single(), causes(), contains_kind(), both IntoIterator impls, Display and embedded_can::Error
    • Typed accessors (lost_arbitration(), controller(), protocol(), transceiver(), counters()) and predicates (is_transmit_timeout(), is_no_ack(), is_bus_off(), is_bus_error(), is_restarted(), has_counters()) reach a specific cause without matching over the list by hand
    • Error::Can still carries a CanError, CanErrorFrame::into_error() keeps its name, and From<CanErrorFrame> for CanError still exists — all three now yield every condition the frame reported rather than a single one
    • Previously the decoder matched the entire error-class word against one value, so any frame setting more than one class bit fell through to Unknown(bits) and the whole error was lost. For example an mcp251xfd bus-error frame (CAN_ERR_PROT | CAN_ERR_BUSERROR | CAN_ERR_ACK) decoded to Unknown(0xA8); it now decodes to three causes, the protocol one naming all five violation types it reported

... (truncated)

Commits
  • cfa0d10 Updated version, changelog, and readme for release
  • f5361e2 Added ability for apps to get/set netlink params using byte slices (no neli i...
  • 1f26c75 Implemented some netlink control modes. Added scripts to bring up interfaces.
  • 56fba6f Got rid of some netlink constants that moved to the upstream libs
  • 523debe Moved 'CanState' into nl/mod.rs
  • 9817099 Updates to get/set socket options
  • e1a7ed1 Bumped version to v4.0.0 for release
  • fa1f400 #94: Added frame direction for dump files (reimplemented over latest branch)
  • 9fc462b Added 'can_recvfd' example. Cleaned up examples. Using 'can0' for all the exa...
  • 898b97f Re-exort some more CANbus protocol constantants.
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [socketcan](https://github.com/mbr/socketcan-rs) from 3.6.2 to 4.0.0.
- [Release notes](https://github.com/mbr/socketcan-rs/releases)
- [Changelog](https://github.com/socketcan-rs/socketcan-rs/blob/master/CHANGELOG.md)
- [Commits](socketcan-rs/socketcan-rs@v3.6.2...v4.0.0)

---
updated-dependencies:
- dependency-name: socketcan
  dependency-version: 4.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot added dependencies Pull requests that update a dependency file rust Pull requests that update rust code labels Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants