-
Notifications
You must be signed in to change notification settings - Fork 201
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
Allow setting the regulatory domain (LP: #1951586) #281
Conversation
Codecov Report
@@ Coverage Diff @@
## main #281 +/- ##
==========================================
- Coverage 99.19% 99.08% -0.12%
==========================================
Files 61 61
Lines 11206 11267 +61
==========================================
+ Hits 11116 11164 +48
- Misses 90 103 +13
Continue to review full report at Codecov.
|
80aa57c
to
f2e5d42
Compare
A test build for this is available in ppa:slyon/testing: https://launchpad.net/~slyon/+archive/ubuntu/netplan/+sourcepub/13655747/+listing-archive-extra |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Customized an ubuntu 22.04 server arm64 image for pi with the packages from @slyon's PPA and it worked very nicely out of the box with regulatory-domain
set in the network-config
YAML on the boot partition (which becomes the netplan configuration via cloud-init).
The wpa-supplicant configuration wound up with country=GB
within it, wifi came up happily on first boot, and an iw reg get
after logging in confirmed that the regulatory domain was set correctly. Checking the boot logs showed that wpa-supplicant had set the regulatory domain prior to bringing up the interface and associating with the pre-configured AP.
All looks good to me!
(should add I also tested the reboot case: no issues to report) |
doc/netplan.md
Outdated
|
||
: This can be used to define the radio's regulatory domain, to make use of | ||
additional WiFi channels outside the `00` "world domain". Takes an ISO / | ||
IEC 3166 country code, such as `GB`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are all possible country codes supported as a value for the regulatory domain?
In terms of the schema, this looks fine. Expressing this in terms of country codes is sensible as that's what the backend uses and regulatory domains map to geopolitical entities. And the name 'regulatory-domain' is also sensible. If there are limits on which country codes are recognized, we should provide a pointer for that. (For my part, I wasn't able to even locate the database file described by regulatory.bin(5) on my system.)
Would we support '00' as a domain, to override a previous declaration and reset to the default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! There are 273 IEC 3166 country codes officially assigned (according to Wikipedia). wireless-regdb lists only 173 (+ "00") domains. So it's not all possible country code. I've added a reference to wireless-regdb in the documentation.
g_string_append(s, "After=network.target\n"); | ||
g_string_append(s, "ConditionFileIsExecutable="SBINDIR"/iw\n"); | ||
g_string_append(s, "\n[Service]\nType=oneshot\n"); | ||
g_string_append_printf(s, "ExecStart="SBINDIR"/iw reg set %s\n", def->regulatory_domain); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do the changes to this source file show both a change to the output to the wpa supplicant config, and the addition of a systemd unit that invokes iw? (If we need iw, that appears to be a new runtime dependency; not ideal.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, this was implemented in two ways:
- wpa supplicant config (basic case): works only on the sd-networkd backend; works without a new
iw
runtime dependency - systemd service unit calling
iw
directly (extended case): works on all backends (incl NetworkManager); requiresiw
as a new runtime dependency
=> iw
will be added as a Suggests:
dependency. We don't need it necessarily, as the basic case (sd-systemd/wpa_supplicant) works as-is and the new systemd service will fail gracefully if iw
is not available (ConditionFileIsExecutable=SBINDIR/iw
).
I've updated the documentation accordingly.
The ppa was actually slyon/netplan not slyon/testing. |
V2: add reference to wireless-regdb for available values: https://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git/tree/db.txt V3: mention `iw` dependency, if used outside of sd-networkd backend
Brian confirmed out-of-band that using Thank you for testing, Brian! This is all looking good and expected. |
Seems to have been added to netplan: canonical/netplan#281
Description
Allow setting the regulatory domain, using a new
regulatory-domain
setting.It is implemented in two ways:
country=XX
setting inwpa_supplicant.conf
(networkd/wpasupplicant only)/run/systemd/system/netplan-regdom.service
callingiw reg set XX
(works globally)Example:
Checklist
make check
successfully.make check-coverage
).