| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
Otherwise, the logging output is confusing as it's not clear what happened about
the provider detection.
Also, don't return from _provider_detect() unless all pending callbacks
returned. It is ugly to leave callbacks pending, because they will be
later dispatched when the caller iterates the GMainContext further.
Instead, cancel pending operations bug keep running until we processed
all cancellation callbacks.
|
| |
|
|
|
|
|
| |
It's the same code, four times. And once it was messed up.
Move the definition of the function to a macro.
|
|
|
|
|
|
|
|
| |
In production systems, the associate an interface by their permanate MAC address.
For testing and CI, we may want to hook that. That allows for example to run
nm-cloud-setup on a veth interface, which doesn't have a permanent MAC address.
This is only for testing.
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, there was NMCS_ENV_VARIABLE() macro. That macro did nothing,
it merely acted as something to grep for, when searching the source for
which environment variables nm-cloud-setup honors. That is an
interesting thing to know, because nm-cloud-setup is configured via
environment variables.
Change that. Instead add a define for each environment variable. You can
now instead grep for "NMCS_ENV_" to find them all.
|
|
|
|
| |
Fixes: f3404435a9fb ('cloud-setup: configure secondary ip in Aliyun cloud')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
"test-cloud-meta-mock.py" needs to be mocked, so it only replies
to stuff that we tell it to. Except for the API token, that is
pushed by the client.
We need to be able to tell the mock whether it supports that API
or not. By default it does, but by setting "/.nmtest/providers"
we can limit that.
The DEFAULT_RESOURCE are not grouped by provider. If a path is not
explicitly mocked, we may fallback to the DEFAULT_RESOURCE, but only if
the respective "/.nmtest/providers" is enabled and if /.nmtest/allow-default"
indicates so.
|
| |
|
|
|
|
|
| |
Choose a MAC address that is easily recognizable. And where you can
see which is mac1 and mac2.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In constructed(), NMDevice starts watching the D-Bus name owner or
monitoring the unix socket, and so it is always aware if teamd is
running. When it is, NMDevice connects to it and initializes
priv->tdc.
It is not useful to try to connect to teamd in update_connection()
because warnings will be generated by NM and by libteam if teamd is
not running. As explained above the connection is always initialized
when teamd is available, and so we can just check priv->tdc.
Fixes: ab586236e36b ('core: implement update_connection() for Team')
https://bugzilla.redhat.com/show_bug.cgi?id=2182029
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1631
|
| |
|
|\ |
|
| |
| |
| |
| |
| |
| | |
This ABI was backported all the way to 1.42.8 and 1.40.20 and to rhel-8.9.
Move the ABI to a separate symbol version, which we have in all those
versions.
|
|/ |
|
|\
| |
| |
| | |
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1628
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
With the unit test framework, we define special methods, like setUp()
and test_*(). This is documented, but not obvious.
Previously, TestNmClient was the base class for our tests classes, and
it provided some functionality (and state). It was utterly confusing how
pieces fit together.
Instead, move the state to a new class NMTestContext(). That contains
most of the code from TestNmClient. Drop TestNmClient and let the test
classes directly descend from unittest.TestCase.
The difference is, when you now look at a certain test (test_001()), you
can easier understand which code runs when. First, the test class has a
setUp() method which runs, but that method is now trivial without extra
context. Second, there is the @nm_test attribute that wraps the
function. But that's it. It's all at one place, and we delegate instead
of inherit.
|
| |
| |
| |
| |
| |
| | |
The goal is to make the base class TestNmClient smaller because it
contains a lot of state, and with inheritance it's hard to follow what
happens.
|
| |
| |
| |
| |
| |
| |
| | |
Util.cmd_create_{argv,env}()
These two are stateless method, and even not only work for nmcli, but also for
nm-cloud-setup. Move to the Util class, as static methods.
|
| |
| |
| |
| | |
They can both be used as decorators and called plainly.
|
|/
|
|
|
|
|
| |
Util.file_read_expected()
Static, state-less functions are great. Keep them separate from TestNmClient which
has lots of state.
|
|
|
|
|
|
|
| |
container
The bind mount interferes with running certain CI tests that want to
change /etc/hosts.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently if the IPv6 link-local address is removed after it passed
DAD, NetworkManager tries to generate a new link-local address. If
this fails, which is always the case for EUI64, ipv6ll is considered
as failed and the connection can go down (depending on may-fail).
This is particularly bad for virtual interfaces because if somebody
removes the link-local address, the activation can fail and destroy
the interface, breaking all services that require it. Also, it's a
change in behavior introduced in 1.36.0.
It seems that a better approach here is to re-add the address that was
removed externally.
Fixes: aa070fb82190 ('core: add NML3IPv6LL helper')
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1622
|
|\
| |
| |
| |
| | |
https://bugzilla.redhat.com/show_bug.cgi?id=2193422
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1624
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When managing the interface after wake/reenable, the reason determines
whether the device will be sys-iface-state=managed or external.
Commit 5a9a7623c5a4 ('core: set STATE_REASON_CONNECTION_ASSUMED when
waking up') changed the reason from 'now-managed' to
'connection-assumed'; the effect was that devices that were fully
managed before sleeping become external after a wake up. For example:
$ nmcli connection add type ethernet ifname enp1s0
Connection 'ethernet-enp1s0' (47fcd81e-bf00-4c02-b25b-354894f5657e) successfully added.
$ nmcli device | grep enp1s0
enp1s0 ethernet connected ethernet-enp1s0
$ nmcli networking off
$ nmcli device | grep enp1s0
enp1s0 ethernet unmanaged --
$ nmcli networking on
$ nmcli device | grep enp1s0
enp1s0 ethernet unavailable --
Set the correct reason during wake up so that the previous state is
restored.
Fixes: 5a9a7623c5a4 ('core: set STATE_REASON_CONNECTION_ASSUMED when waking up')
https://bugzilla.redhat.com/show_bug.cgi?id=2193422
|
|/ |
|
|\
| |
| |
| | |
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1630
|
| |
| |
| |
| |
| |
| | |
nm_vpn_openconnect_authenticate_helper()
Fixes: 97f2a368f154 ('libnmc-base: add supported options for OpenConnect CLI authentication')
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- use G_N_ELEMENTS() macro instead of having separate defines. The separate
defines mean that when we check g_return_val_if_fail(oc_argc <= OC_ARGS_MAX, FALSE)
that we must double check that OC_ARGS_MAX is really the size of the array
that we want to check.
- replace g_return_val_if_fail() with nm_assert(). In this case, it should be
very clear by review that the buffer is indeed large enough and the assertion
holds. Use nm_assert().
- use unsigned integer for the loop variables. While int theoretically
might exploit undefined behavior of signed overflow, we should instead
use unsigned at places where it's appropriate (for example, those
variables are compared against G_N_ELEMENTS() which gives a size_t type.
- declare auto variables on separate lines.
- make the global variable oc_property_args static and const. The const
means the linker will put it into read-only memory, so we would get
a crash on accidental modification.
|
|/
|
|
|
| |
No explicit unref/free. Resources should be owned by somebody, like an
auto variable with a cleanup attribute.
|
|\
| |
| |
| | |
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1606
|
| |
| |
| |
| | |
Not used for testing, but still might be useful for development.
|
| |
| |
| |
| | |
Not used for testing, but still might be useful for development.
|
| |
| |
| |
| | |
Not used for testing, but still might be useful for development.
|
| | |
|
| |
| |
| |
| |
| | |
A different host can be specified with (undocumented, private)
NM_CLOUD_SETUP_GCP_HOST environment variable.
|
| | |
|
| |
| |
| |
| |
| | |
A different host can be specified with (undocumented, private)
NM_CLOUD_SETUP_AZURE_HOST environment variable.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Don't rely on resources provided by mock metadata server by default,
create the from within the test instead.
This allows for more flexibility, but the locality of the test fixture
relative to the tests makes the test more legible.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This reworks the cloud metadata mock server in a significant way.
Most importantly this makes it possible for the client to add and
modify the resources for later retrieval using the PUT method.
This allows the test to create the fixture for itself.
The default set of resources is still provided, so that the too remains
useful as a development aid. If that is not desirable, the --empty
parameter might be passed to cause the server to start with no
resources.
|
| |
| |
| |
| | |
We're going to reuse the setup for tests of other cloud providers.
|
| |
| |
| |
| |
| | |
We rely on the predictable but random MAC addresses. Hardcode them
instead -- the mock service also hardcodes them.
|
| |
| |
| |
| | |
The pass_fds file descriptor is *after* the dup2. Always 3.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
"tools/test-cloud-meta-mock.py""
This changed the fd passing protocol making it not compatible with
systemd-socket-activate(1).
This reverts commit 342ee618c75b350cf5cccf49f2bade85c5dfa3ea.
|
| |
| |
| |
| | |
Otherwise, the following tests will fail too.
|
| |
| |
| |
| |
| |
| | |
When a pexpect check fails, we want to see the full content of the
buffer, so we can better see where it went wrong. Increase the context
that is printed in the error message.
|
| |
| |
| |
| |
| |
| |
| | |
The routes in iproutes were leaked (and ownership stolen
in _nmc_mangle_connection(), leaving dangling pointers).
Fix that by using a GPtrArray instead.
|
|/
|
|
|
| |
For some reason, nm_ip_route_ref() does not return the referenced instance,
making it cumbersome to use. Add a helper.
|
|\
| |
| |
| | |
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1625
|