net: use libc::c_char for ifreq name arrays#143
Merged
zvonkok merged 1 commit intoNVIDIA:mainfrom Mar 13, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the loopback interface name constants to use libc::c_char instead of hardcoding i8, fixing cross-compilation issues where c_char signedness differs by target.
Changes:
- Switch
LOOPBACK(and related test literals) from[i8; N]to[libc::c_char; N]to matchlibc::ifreq.ifr_name. - Update tests to assert against
libc::c_char-typed arrays. - Bump the root package version in
Cargo.lockfrom0.1.1to0.1.2.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/net.rs |
Aligns ifr_name byte arrays with libc::c_char for portability across targets. |
Cargo.lock |
Updates the lockfile’s root package version entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
On aarch64 libc::c_char is u8 while on x86_64 it is i8. Hardcoding i8 caused a type mismatch when cross-compiling for aarch64-unknown-linux-musl because ifreq.ifr_name is [c_char; 16]. Use libc::c_char so the constant matches the struct field on every target. Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On aarch64 libc::c_char is u8 while on x86_64 it is i8. Hardcoding i8 caused a type mismatch when cross-compiling for aarch64-unknown-linux-musl because ifreq.ifr_name is [c_char; 16]. Use libc::c_char so the constant matches the struct field on every target.