Releases: wiresock/ndisapi-rs
Release list
0.7.0
This release hardens the Win32 / driver FFI boundary, fixing a number of safety, correctness, and resource-management issues surfaced by a security/code review. It contains breaking changes — see below.
⚠️ Breaking changes
Ndisapino longer implementsClone. It owns the driverHANDLEand closes it onDrop, so cloning risked a double-close (or operating on a reused OS handle). UseArc<Ndisapi>for shared ownership — the async API and the examples already do.Ndisapi::ndis_get_request/ndis_set_requestare nowunsafe fn. The driver reads/writes the genericTas raw bytes, soTmust be plain-old-data. The safeu32wrappers (get_hw_packet_filter/set_hw_packet_filter) are unchanged.
Memory safety / UB
SockAddrStorage: added length-awarefrom_raw_sockaddr, and adapter enumeration now uses it so IPv6 addresses are no longer truncated to a 16-byteSOCKADDR. Allfrom_sockaddr*constructors zero-initialize storage, eliminating reads of uninitialized memory.- Registry getters (
get_mtu_decrement,get_adapters_startup_mode,get_pool_size) no longer write through a pointer derived from a shared reference (undefined behavior); they now validateREG_DWORD/size and close theHKEYvia an RAII guard.
Concurrency (async)
Win32EventStream: fixed a lost-wakeup race (the waker is now registered before the readiness re-check) and a teardown use-after-free / use-after-close (UnregisterWaitEx(.., INVALID_HANDLE_VALUE)waits for in-flight callbacks, and on unregister failure the callback/event are leaked rather than freed).AsyncNdisapiAdapter::newno longer leaks the event handle on partial construction.
Correctness
set_friendly_namenow writes a proper UTF-16REG_SZvalue (was UTF-8) and updates its cached value only after the registry write succeeds.- Centralized IPv4 →
IN_ADDRconversion to network byte order (from_ip_stringpreviously reversed IPv4 octets on little-endian Windows); fixedadd_ndp_entry_ipv4to match. IntermediateBuffer::set_lengthclamps toMAX_ETHER_FRAMEand the data accessors clamp defensively, so a bad length can no longer panic.delete_routes, thereset_*helpers, anddelete_unicast_address_*now accumulate per-entry failures instead of masking them.get_tcpip_bound_adapters_infoclamps the driver-reported adapter count toADAPTER_LIST_SIZEand uses lossy UTF-8 for adapter names.- The async batch-send methods report the number of packets submitted instead of an always-zero success counter.
Pull requests: #39 (safety/correctness hardening), #40 (clippy/CI cleanup for the release).
0.6.6
Version 0.6.6 Release Notes
✨ New Features
Add new NDISAPI functions from upstream wiresock/ndisapi (#37)
This release adds Rust bindings for the new IOCTLs — indexes 30–36 — and corresponding API functions introduced in the upstream wiresock/ndisapi C++ project, enabling per-filter mutation and driver-side cache control without rebuilding the entire filter table.
New Ndisapi Methods
Per-filter mutation
add_packet_filter_front— push a filter to the front of the tableadd_packet_filter_back— append a filter to the back of the tableinsert_packet_filter— insert a filter at a specific positionremove_packet_filter— remove a filter by zero-based index
Packet filter cache
set_packet_filter_cache_stateenable_packet_filter_cachedisable_packet_filter_cache
Packet fragment cache
set_packet_fragment_cache_stateenable_packet_fragment_cachedisable_packet_fragment_cache
New IOCTL Constants
Defined in src/driver/ioctl.rs:
IOCTL_NDISRD_ADD_PACKET_FILTER_FRONT—30IOCTL_NDISRD_ADD_PACKET_FILTER_BACK—31IOCTL_NDISRD_REMOVE_FILTER_BY_INDEX—32IOCTL_NDISRD_GET_ADP_FILTERS_LIST—33; constant only, no wrapper yet, matches upstreamIOCTL_NDISRD_INSERT_FILTER_BY_INDEX—34IOCTL_NDISRD_SET_FILTER_CACHE_STATE—35IOCTL_NDISRD_SET_FRAGMENT_CACHE_STATE—36
New Struct
StaticFilterWithPosition—#[repr(C, packed)]equivalent of_STATIC_FILTER_WITH_POSITION, containing aposition: u32followed by aStaticFilter. Re-exported from the crate root.
🧰 Maintenance
- Bump crate version to
0.6.6. - Update README install snippet.
Example
use ndisapi::{Ndisapi, StaticFilter};
let api = Ndisapi::new("NDISRD")?;
// Add/insert/remove individual filters without rebuilding the whole table
api.add_packet_filter_front(&filter)?;
api.insert_packet_filter(&filter, 2)?;
api.remove_packet_filter(filter_index)?;
// Toggle driver-side caches
api.disable_packet_filter_cache()?;
api.enable_packet_fragment_cache()?;Compatibility
No breaking changes — all additions are purely additive.
The new per-filter methods use the *_packet_filter_* prefix to stay consistent with the existing get_packet_filter_table / set_packet_filter_table API.
0.6.5
Version 0.6.5 Release Notes
🛠 Documentation build fix (docs.rs)
This patch release fixes documentation generation on docs.rs for the Windows-only ndisapi crate.
What changed
- Configured docs.rs to build documentation using the Windows target (
x86_64-pc-windows-msvc) - Prevents docs.rs from attempting to build the crate on Linux, which caused failures in Windows-specific dependencies (
windows,windows-future,windows-threading)
Impact
- No code changes
- No API changes
- No behavior changes at runtime
- Documentation now builds reliably and correctly reflects the Windows-only nature of the crate
Who should update
- Users browsing documentation on docs.rs
- CI / automation that links to docs.rs pages
0.6.4
0.6.3
Version 0.6.3 Release Notes
✨ New Features
Add unicast_address_list_with_prefix method
PR: #30
- Introduced a new API method to retrieve unicast IP addresses along with their actual prefix lengths directly from the Windows API
- Leverages
MIB_UNICASTIPADDRESS_TABLEto obtain accurateOnLinkPrefixLengthvalues - Updated the
listadaptersexample to demonstrate the new functionality
0.6.2
Version 0.6.2 Release Notes
🐛 Bug Fixes
- Fix panic due to Rust bounds checking flexible array members
This release resolves a runtime panic caused by Rust’s bounds checking behavior when handling flexible array members.
Thanks to @pierrehugohpe for the fix! (#28)
Full Changelog: 0.6.0...0.6.2
0.6.0
0.5.6
Version 0.5.6 Release Notes
🚀 Compatibility Update:
- Windows Crate 0.54.0 Migration: ndisapi-rs has been updated to Windows crate version 0.54.0, thanks to the contributions of @dilawar. This ensures alignment with the latest Windows enhancements and provides users with improved compatibility. Upgrade to benefit from the latest features and a seamlessly integrated experience.
A special thanks to @dilawar for their significant contributions, enhancing the ongoing improvement of ndisapi-rs. Your feedback is crucial as we maintain a reliable and up-to-date networking library. Thank you for your continued support! 🚀
0.5.5
Version 0.5.5 Release Notes
🚀 Enhancements:
- Refined Iteration: We've upgraded the
Iteratortoimpl IntoIterator, enhancing usability and flexibility in iteration patterns. Thanks to @kgv for this improvement! (PR #21) - Key Update to ListEntry Structure: A significant update has been made to the
ListEntrystruct by replacing raw pointers withusize. This change, primarily aimed at enabling theIntermediateBufferto implement theSendtrait, addresses the critical issue highlighted in Issue #20.
These updates are part of our ongoing effort to enhance functionality and ensure robust, safe operations. Your feedback is always welcome! 🚀
0.5.4
Version 0.5.4 Release Notes
🚀 Enhancements:
- Improved Asynchronous Demo Performance: Updated the async-packthru example for better high-load performance. Traffic visualization on the console is now handled by a dedicated task, making it more efficient for high-load performance testing.
- Structs and Unions Reexport: Reexported key structs and unions in the filters module, enhancing module usability and integration (@kgv, PR #18).
- StaticFilter Re-exported: Addressed Issue #16 by re-exporting StaticFilter in
ndisapi-rs. This update improves functionality and addresses the missing component reported in the issue (@wiresock, PR #17).