Skip to content

net: use libc::c_char for ifreq name arrays#143

Merged
zvonkok merged 1 commit intoNVIDIA:mainfrom
zvonkok:aarch64-fixes
Mar 13, 2026
Merged

net: use libc::c_char for ifreq name arrays#143
zvonkok merged 1 commit intoNVIDIA:mainfrom
zvonkok:aarch64-fixes

Conversation

@zvonkok
Copy link
Collaborator

@zvonkok zvonkok commented Mar 13, 2026

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.

Copilot AI review requested due to automatic review settings March 13, 2026 14:52
@zvonkok zvonkok added the ok-to-test Ok to test label Mar 13, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 match libc::ifreq.ifr_name.
  • Update tests to assert against libc::c_char-typed arrays.
  • Bump the root package version in Cargo.lock from 0.1.1 to 0.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>
@zvonkok zvonkok merged commit b5e7d73 into NVIDIA:main Mar 13, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Ok to test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants