Commit graph

9 commits

Author SHA1 Message Date
Thomas Haller
4201ee5119
cloud-setup: preserve IPv4 addresses/routes/rules from profile
nm-cloud-setup automatically detects routes, addresses and rules and configures them
on the device using the emphermal Reapply() API. That is, it does not modify the
existing profile (on disk), but changes the runtime configuration only.

As such, it used to wipe otherwise statically configured IP addresses, routes and
rules. That seems unnecessary. Let's keep the configuration from the (persistent)
configuration.

There is of course the problem that nm-cloud-setup doesn't really
understand the existing IP configuration, and it can only hope that
it can be meaningfully combined with what nm-cloud-setup wants to
configure. This should cover most simple cases, for more complex setups,
the user probably should disable nm-cloud-setup and configure the
network explicitly to their liking.

https://bugzilla.redhat.com/show_bug.cgi?id=1971527

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/893
2021-06-30 08:04:39 +02:00
Thomas Haller
21321ac736
clang-format: reformat code with clang 12
The format depends on the version of the tool. Now that Fedora 34 is
released, update to clang 12 (clang-tools-extra-12.0.0-0.3.rc1.fc34.x86_64).
2021-05-04 13:56:26 +02:00
Thomas Haller
c2629f72b0
cloud-setup/azure: fix detecting the gateway address
The code never set "iface_get_config->cidr_addr", despite
setting "cidr_prefix" and "has_cidr". As a result, cloud-setup
would think that the subnet is "0.0.0.0/$PLEN", and calculate
the gateway as "0.0.0.1".

As a result it would add a default route to table 30400 via 0.0.0.1,
which is obviously wrong.

How to detect the right gateway? Let's try obtain the subnet also via
the meta data. That seems mostly correct, except that we only access
subnet at index 0. What if there are multiple ones? I don't know.

https://bugzilla.redhat.com/show_bug.cgi?id=1912236
2021-04-20 17:46:05 +02:00
Thomas Haller
889498c12c
cloud-setup/azure: refactor callback for _get_config_ips_prefix_list_cb() 2021-04-20 17:46:05 +02:00
Thomas Haller
c9fc3f5b03
cloud-setup/azure: cleanup constructing URI in _get_config_ips_prefix_list_cb() 2021-04-20 17:46:05 +02:00
Thomas Haller
89f3267859
cloud-setup/trivial: rename variables in Azure's _get_config_fetch_done_cb()
The previous name seem not very expressive/fitting. Naming is hard, but
I think these are better names.
2021-04-20 17:46:05 +02:00
Thomas Haller
a2fded3cee
cloud-setup: use _nm_utils_ascii_str_to_int64_bin() in Azure's _get_config_fetch_done_cb() 2021-04-20 17:46:04 +02:00
Thomas Haller
d3f07d5ca2
cloud-setup: remove redundant check in Azure's _get_net_ifaces_list_cb()
This condition always true, because there is a check above.
2021-04-20 17:46:04 +02:00
Thomas Haller
71f0511b1f
cloud-setup: move from "clients/cloud-setup/" to "src/nm-cloud-setup/" 2021-03-15 17:10:53 +01:00