Allow setting the regulatory domain (LP: #1951586) (#281)
Allow setting the regulatory domain, using a new regulatory-domain setting.
It is implemented in two ways:
* country=XX setting in wpa_supplicant.conf (networkd/wpasupplicant only)
* oneshot /run/systemd/system/netplan-regdom.service calling iw reg set XX (works globally)
Example:
network:
version: 2
renderer: networkd
wifis:
wlp2s0b1:
regulatory-domain: "GB"
dhcp4: no
dhcp6: no
addresses: [192.168.0.21/24]
access-points:
"MYSSID":
password: 12345678
COMMITS:
* doc: add 'regulatory-domain' reference
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
* netplan: parse regulatory domain
* networkd: put regulatory-domain into wpa_supplicant.conf
* networkd:apply: set global regulatory-domain
* Update ABI definitions
* test:wifi: basic regdom integration test
The underlying implementation uses the dirtiness infrastructure for
this, as this allows for a rather generic implementation, and shows us
that there are actual parameters touched by the user config, whereas the
explicit boolean `custom_bridging` only tells us that there's a
parameters block, which might very well be empty.
lib: fix dirtiness tracking for generic integer values
It marked the wrong pointer, instead marking the address at the end of
the input string as dirty, which doesn't make much sense (and would be
prone to conflicts down the line as allocations are reused).
lib: move complex_object_is_dirty to utils with better API
Instead of forcing users to cast (which was done through a macro in
netplan.c anyway), we now use the proper type to say "give us a pointer
to whatever, we promise we won't touch its data".
This function will be used to expose a bit of the dirtiness of the bonds
and bridges properties to Python, which in turn will tell us how
revertable a given config is.
Those old functions have been written out in favor of the
user-friendlier State and Parser classes, so we now clean them up.
This means that we now have more code in abi_compat.c that isn't covered
by the test suite. I think that's OK, as they are simple wrappers around
functions that *are* covered.
This change has far reaching impacts, as it changes the fundamental data
types of the class.
V2:
* Split off the matching algorithm evolution which does NOT belong to
this patch.
* Move some small test data changes into their own patch to give it more
context.
* Add a test covering the error path on invalid input, since we now have
some validation.
* Some whitespace fixes in the tests.
* apply.py: rework the whole matching loop to better fit the new data
model
* try.py: fix the missing extra-config application when checking for
revertability.
tests:sriov: add a nocover statement for the fallback in driver_mock_open
I suspect that the fallback is needed because configmanager opens the
netplan conf file in Python, but that won't necessarily be the case when
the parsing is done via libnetplan.
tests: configmanager: Fix inconsistencies in test data
There are a couple of inconsistencies in the test data. The test.yaml
netplan config tries to configure a vlan interface on eth99, which
hasn't been defined, and the merged config tries to add two new links on
patcha and patchb, while they're already in a link together. While the
current code doesn't catch this, parser consolidation will result in
stricter validation, making the merge test fail.