Skip to content

Add some constants for Linux nl80211 #4546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

a-gavin
Copy link

@a-gavin a-gavin commented Jul 13, 2025

Description

Add some of the many nl80211 constants required for WiFi configuration using the Netlink kernel interface.

Includes the following enums:

  • nl80211_commands
  • nl80211_attrs
  • nl80211_iftype
  • nl80211_mesh_setup_params
  • nl80211_channel_type
  • nl80211_chan_width
  • nl80211_bss
  • nl80211_auth_type
  • nl80211_scan_flags

Includes '#define'ed commands or attrs defined for legacy compatibility but does not include those defined for programs to '#ifdef'

Sources

To the best of my knowledge, these constants are accurate to the linux-wireless tree at tag 'wireless-next-2025-06-25' available here. Almost all of these are available in Linus' upstream tree (and those that aren't will be as of 6.16 when it is released).

Checklist

  • [Y] Relevant tests in libc-test/semver have been updated
  • [Y] No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • [Y] Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@a-gavin
Copy link
Author

a-gavin commented Jul 13, 2025

It's not clear to me why, but CI fails on style check for aarch64-apple-darwin target here, which prevents the CI from continuing any further. This doesn't appear related to my changes that I understand.

Manually patching this failure to get the CI to run the remaining jobs shows that the semver file isn't sorted. However, even when checking out the latest project main branch (with none of my changes), I manually see the sort -C libc-test/semver/linux.txt command return non-zero (indicating it's not sorted).

Happy to make any changes requested. Manually verified locally with cd libc-test; cargo test --target x86_64-unknown-linux-gnu

@a-gavin
Copy link
Author

a-gavin commented Jul 16, 2025

I understand now that this project pulls in linting from nightly, so once the PR to fix the style check failure lands (here), I'll rebase my changes to re-run the CI suite.

@tgross35
Copy link
Contributor

tgross35 commented Jul 16, 2025

We are trying to cut back a bit on what UAPI we provide in libc because it's expansive and difficult to keep in sync with manual bindings. This is also a bit of a niche API that's huge. Once the next kernel version releases, could https://docs.rs/linux-raw-sys/latest/linux_raw_sys/ cover your usecase?

Manually patching this failure to get the CI to run the remaining jobs shows that the semver file isn't sorted. However, even when checking out the latest project main branch (with none of my changes), I manually see the sort -C libc-test/semver/linux.txt command return non-zero (indicating it's not sorted).

This might jsut need LC_ALL=C

@a-gavin
Copy link
Author

a-gavin commented Jul 16, 2025

We are trying to cut back a bit on what UAPI we provide in libc because it's expansive and difficult to keep in sync with manual bindings. This is also a bit of a niche API that's huge. Once the next kernel version releases, could https://docs.rs/linux-raw-sys/latest/linux_raw_sys/ cover your usecase?

Apologies, I should've included this in the PR, but the main goal of this PR is to eventually include support for nl80211 in the neli Netlink crate. I can start a thread with the maintainer to determine their goals and if the linux_raw_sys crate would be suitable for new (and possibly existing) Netlink specifications. At this time it relies directly on constants defined in this crate (example here). However, I can understand the goal to limit scope of UAPI.

Manually patching this failure to get the CI to run the remaining jobs shows that the semver file isn't sorted. However, even when checking out the latest project main branch (with none of my changes), I manually see the sort -C libc-test/semver/linux.txt command return non-zero (indicating it's not sorted).

This might jsut need LC_ALL=C

Thanks for the pointer. Let me see on this.

Including other constants, add the following enums:
- nl80211_commands
- nl80211_attrs
- nl80211_iftype
- nl80211_mesh_setup_params
- nl80211_channel_type
- nl80211_chan_width
- nl80211_bss
- nl80211_auth_type
- nl80211_scan_flags

Includes '#define'ed commands or attrs defined for legacy
compatibility but does not include those defined for programs
to '#ifdef'

To the best of my knowledge, these constants are accurate to
the linux-wireless tree at tag 'wireless-next-2025-06-25'
available here:
https://web.git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants