Commit Graph

27617 Commits

Author SHA1 Message Date
Thomas Haller
18cd6ef832 shared/c-siphash: reimport
git subtree pull --prefix shared/c-siphash git@github.com:c-util/c-siphash.git master --squash
2021-01-15 11:17:32 +01:00
Thomas Haller
a275cfe43b Squashed 'shared/c-siphash/' changes from d8b3a7a8f40e..4918c33b65d0
4918c33b65d0 build: update submodules

git-subtree-dir: shared/c-siphash
git-subtree-split: 4918c33b65d01a9478faface8b4c89f91c390092
2021-01-15 11:17:17 +01:00
Thomas Haller
3f6a2588cd shared/c-rbtree: reimport
git subtree pull --prefix shared/c-rbtree git@github.com:c-util/c-rbtree.git master --squash
2021-01-15 11:16:25 +01:00
Thomas Haller
afdcf971bd Squashed 'shared/c-rbtree/' changes from 3162c5c04574..a3b1f80548d1
a3b1f80548d1 build: update submodules

git-subtree-dir: shared/c-rbtree
git-subtree-split: a3b1f80548d1c736208c55e9251c49ada649dd62
2021-01-15 11:14:16 +01:00
Thomas Haller
d86b5d07a9 shared: merge branch 'th/enum-from-str-fix-signed'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/728
2021-01-15 09:39:32 +01:00
Thomas Haller
726a82c79d shared: fix _nm_utils_enum_from_str_full() for negative enum values
Enums can also be negative (contrary to Flags). Fix the parsing.

  $ nmcli connection modify "$PROFILE" connection.llmnr -1
  Error: failed to modify connection.llmnr: invalid option '-1', use one of [default,no,resolve,yes].
2021-01-15 09:36:30 +01:00
Thomas Haller
88a7ec8b14 shared: avoid heap allocation in _nm_utils_enum_from_str_full()
In the vast majority of cases is the string for _nm_utils_enum_from_str_full()
short. As we duplicate it for stripping, prefer to clone it on the stack
with nm_strdup_maybe_a().
2021-01-15 09:36:30 +01:00
Thomas Haller
e884ef39ed shared: add nm_strdup_maybe_a() helper macro 2021-01-15 09:36:30 +01:00
Jonathan Lebon
a1d9a79228 contrib/rpm: don't trigger udev if socket doesn't exist
On rpm-ostree systems, we don't want scriptlets to affect the running
system because a major part of the value is "background updates".
Scriptlets are run in a containerized environment where e.g. udev is not
available.

Add a check for the udev socket before triggering it to handle this.
This also helps the container use case.

This doesn't break rpm-ostree strictly, because it uses `|| :`, but it
still spams error messages during the compose. I kept the `|| :` to be
safe, but it's likely fine to remove them now.

See-also: https://bugzilla.redhat.com/show_bug.cgi?id=1352154
See-also: https://src.fedoraproject.org/rpms/udisks2/pull-request/3
See-also: https://github.com/coreos/fedora-coreos-tracker/issues/703

https://src.fedoraproject.org/rpms/NetworkManager/pull-request/6
2021-01-14 22:46:35 +01:00
Thomas Haller
9ba8c32dac contrib/rpm: add "BuildRequires: make" to SPEC file
https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot
2021-01-14 22:17:34 +01:00
Beniamino Galvani
07ee187cb5 initrd: fix leak in test
Fixes: 6069ef4b8b ('initrd: accept a zero-byte prefix for BOOTIF')
2021-01-14 21:48:16 +01:00
Beniamino Galvani
6069ef4b8b initrd: accept a zero-byte prefix for BOOTIF
The BOOTIF MAC address can be prefixed with a hardware address
type. Typically it is 01 (for ethernet), but the legacy network module
accepts (and strips) any byte value.

It seems wrong to take any address type without validation. In
addition to "01", also accept a zero type which, according to the
bugzilla below, is used in some configurations to mean "undefined".

While at it, also accept ':' as separator for the first byte.

https://bugzilla.redhat.com/show_bug.cgi?id=1904099
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/713
2021-01-14 19:14:01 +01:00
Thomas Haller
584e8f92f5 release: bump version to 1.29.8 (development) 2021-01-14 18:56:21 +01:00
Thomas Haller
55c5c57d1e devices/tests: improve assert for ioctl() in _test_recv_fixture_setup()
This assert sometimes fails during copr builds. But the way
the assert was, it was hard to see what the actual problem
was.

Restructure the assert (again) to get the errno in the
test logs.
2021-01-14 18:24:38 +01:00
Yuri Chornoivan
b2ff18692f po: update Ukrainian (uk) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/727
2021-01-14 18:09:24 +01:00
Thomas Haller
010ad9eeb8 ndisc: merge branch 'th/ndisc-dns-lifetimes'
https://bugzilla.redhat.com/show_bug.cgi?id=1874743

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/725
2021-01-14 13:08:26 +01:00
Thomas Haller
68528f7af5 ndisc: don't artificially extend the lifetime of DNSSL/RDNSS options
RFCs actually expect to honor the lifetime. See for example [1].

This is just not right, and totally arbitrary. It was added
when our libndp based implementation was added, but unclear
why this was done (beyond the code comment).

[1] page 204, v6LC.2.2.25: Processing Router Advertisement DNS (Host
    only) at https://ipv6ready.org/docs/Core_Conformance_5_0_0.pdf
2021-01-14 11:48:52 +01:00
Thomas Haller
872f265859 ndisc: fix encoding DNS Search List Option in RA
The format is different than what was implemented.

Read [1] or see systemd's implementation ([2]).

[1] https://tools.ietf.org/html/rfc8106#section-5.2
[2] 65ab27211c/src/libsystemd-network/sd-radv.c (L791)

Fixes: 6387856602 ('ndisc/lndp: add ability to announce the managed IPv6 configuration')
2021-01-14 11:48:51 +01:00
Thomas Haller
8d9662e16f ndisc: minor cleanup in send_ra()
- use size_t variable for memory sizes and guint for iterating
  over GArray.
2021-01-14 10:38:52 +01:00
Thomas Haller
e3c464b56c ndisc: pack structs for lndp options
There is no actual change in behavior, because "struct nd_opt_hdr"
as two uint8_t, so in practice this struct was always packed already.

But make it explicit, because it's clear that we use these structs
to set the binary message and they need a well defined (packed) memory
layout.
2021-01-14 10:38:52 +01:00
Thomas Haller
96d7ddc865 ndisc: add comment and static assert for struct sizes for ndisc packet layout
Obviously, there is no change in behavior. It's just an assertion.
2021-01-14 10:38:52 +01:00
Thomas Haller
5a213541ea shared: add nm_str_buf_append_{dirty,c_len}() helpers 2021-01-14 10:38:52 +01:00
Thomas Haller
cc8706f815 wireguard: delay activation while resolving DNS names for WireGuard peers to avoid race
The endpoints of WireGuard peers can be configured as DNS name, which
NetworkManager will resolve.

Since activating a profile might affect now names get resolved, we must
first resolve names before completing the activation of the WireGuard
device (and before reconfiguring DNS accordingly).

For example, if you configure exclusive DNS resolution via the WireGuard
device, and if the peer needs to be resolved via DNS, then resolving the
peer name must happen before the reconfiguration of DNS. Otherwise the
new DNS configuration will be broken due to being unable to reach the
WireGuard peer.

Fix that by waiting.

There is still an unfixed problem. If resolving any peers fails,
activation silently proceeds -- again possibly breaking the network
setup. Of course, NetworkManager will repeatedly try to re-resolve
the name, but that may never succeed if DNS would be resolved via
the VPN itself.

That is different from `wg set` which resolves hostnames and fails.
Consequently `wg-quick up` would also fail. But these are both one shot
applications, they are not around and basically let the user handle the
error (by reading the log and invoking the command again). NetworkManager
can do something different and proceed activation (as it will also
periodically re-resolve the hostnames again). Note that it's also valid
to activate a WireGuard device without any peers (and to modify the
activated device later with Reapply()). As such, having no peers (or
being unable to resolve a hostname) may be a valid configuration.

I think we should add an option/flag that when enabled will cause
the activation to fail of names cannot be resolved.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/535
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/616

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/721
2021-01-14 10:23:45 +01:00
Thomas Haller
86107b6a52 core: avoid "-Wmaybe-uninitalized" warning in link_negotiation_set()
With LTO and gcc-10.2.1-9.fc33.s390x we get:

    src/platform/nm-platform.c:3325:1: error: link_duplex may be used uninitialized in this function [-Werror=maybe-uninitialized]
     3325 | NM_UTILS_LOOKUP_STR_DEFINE(nm_platform_link_duplex_type_to_string,
          | ^
    src/devices/nm-device-ethernet.c:899: note: link_duplex was declared here
      899 |     NMPlatformLinkDuplexType link_duplex;
          |
2021-01-14 10:11:14 +01:00
Beniamino Galvani
8180b0180b device: clean up dispatcher calls when canceling an activation
Ensure the callback for dispatcher calls is not executed, or it will
resume the activation chain we want to interrupt.

https://bugzilla.redhat.com/show_bug.cgi?id=1888348
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/723
2021-01-14 09:06:17 +01:00
Thomas Haller
8e735a51b8 contrib: handle no files in "nm-code-format.sh"
Calling `clang-format` with no files means to read
stdin, it thus hangs:

   $ ./contrib/scripts/nm-code-format.sh .git

Also, the following does not work:

   $ ./contrib/scripts/nm-code-format.sh src/platform/

hangs. Seems there is a bug in `git ls-files` to not list all files:

   podman run -ti alpine:latest \
      sh -c '
         apk add git &&
         git clone https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git &&
         cd NetworkManager &&
         git checkout -B tmp cd754680a6 &&
         echo ">>>>>>BAD1: $PWD" &&
         git ls-files -- src/platform/ ":(exclude)shared/n-acd"
         echo ">>>>>>GOOD1: $PWD" &&
         git ls-files -- src/platform/ ":(exclude)shared/c-list"
         echo ">>>>>>GOOD2: $PWD" &&
         git ls-files -- src/platform ":(exclude)shared/n-acd"
         echo ">>>>>>GOOD3: $PWD" &&
         git ls-files -- src/vpn/ ":(exclude)shared/n-acd"
      '

Fixes: 9bef4ece92 ('contrib: improve nm-code-format.sh script')
2021-01-13 16:49:09 +01:00
Thomas Haller
cd754680a6 src/tests: avoid "-Wmaybe-uninitialized" warning in nmtstp_acd_defender_new()
With gcc-10.2.1-9.fc33.s390x we get a (false positive) warning:

    src/platform/tests/test-common.c: In function nmtstp_acd_defender_new:
    src/platform/tests/test-common.c:2688:15: error: probe may be used uninitialized in this function [-Werror=maybe-uninitialized]
     2688 |     *defender = (NMTstpAcdDefender){
          |               ^
    src/platform/tests/test-common.c:2656:56: note: probe was declared here
     2656 |     NAcdProbe *                                        probe;
          |                                                        ^
2021-01-13 13:23:12 +01:00
Thomas Haller
9bef4ece92 contrib: improve nm-code-format.sh script
- accept directory names in the command line. In that case,
  still honor the excluded files. That is a major improvement
  for me, because I usually only want to reformat a directory
  that I know has changed and it is fast to only process some
  directories.

- pass all files at once to clang-format. For me that gives
  a significant speed improvement (about 3 times faster), although
  clang-format is only single threaded. Possibly clang-format could
  even be faster by checking files in parallel.
  In case of a style error, the script still falls back to
  iterate over all files to find the first bad file and print
  the full diff. But that is considered an unusual case.

- make it correctly work from calling it from a subdirectory.
  In that case, we only check files inside that directory --
  but still correctly honor the excluded files.
2021-01-13 12:57:48 +01:00
Thomas Haller
46da6eae6e core: replace g_return_if_fail() with nm_assert() in nm_ip_config_iter_ip[46]_(address,route)_init()
With LTO, the compiler can see that some code paths return without
initializing the variable. But it fails to see that those are code
paths after an assertion fail. Still that can lead to
"-Wmaybe-uninitialized" warnings in the caller.

Avoid that by not using g_return_if_fail() but nm_assert().

    src/nm-ip6-config.c: In function '_nmtst_ip6_config_get_address':
    ./shared/nm-glib-aux/nm-dedup-multi.h:337:8: error: 'iter._next' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      337 |     if (!iter->_next)
          |        ^
    src/nm-ip6-config.c:1622:33: note: 'iter._next' was declared here
     1622 |     NMDedupMultiIter            iter;
          |                                 ^
    ./shared/nm-glib-aux/nm-dedup-multi.h:343:8: error: 'iter._head' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      343 |     if (iter->_next->next == iter->_head)
          |        ^
    src/nm-ip6-config.c:1622:33: note: 'iter._head' was declared here
     1622 |     NMDedupMultiIter            iter;
          |                                 ^

and more.
2021-01-13 09:46:59 +01:00
Thomas Haller
828e47f632 device: set out-argument to nm_device_get_permanent_hw_address_full() in assertion case
When compiling with LTO, the compiler can think that an
assertion failure (g_return*()) is regular code path, and
thus that the output variable is not set.

This can lead to "-Wmaybe-uninitialized" warnings in the
caller, despite this not happening in non-bug case.

Work aound that by setting the out argument.

Warning with LTO enabled and gcc-10.2.1-9.fc33.s390x:

    src/nm-config-data.c: In function nm_config_data_get_device_config:
    src/devices/nm-device.c:17454:9: error: is_fake may be used uninitialized in this function [-Werror=maybe-uninitialized]
    17454 |     m = nm_match_spec_device(specs,
          |         ^
    src/devices/nm-device.c:17444:26: note: is_fake was declared here
    17444 |     gboolean             is_fake;
          |                          ^
    src/nm-config-data.c: In function nm_config_data_get_connection_default:
    src/devices/nm-device.c:17454:9: error: is_fake may be used uninitialized in this function [-Werror=maybe-uninitialized]
    17454 |     m = nm_match_spec_device(specs,
          |         ^
    src/devices/nm-device.c:17444:26: note: is_fake was declared here
    17444 |     gboolean             is_fake;
          |                          ^
    src/devices/nm-device.c: In function nm_device_check_unrealized_device_managed:
    src/devices/nm-device.c:17454:9: error: is_fake may be used uninitialized in this function [-Werror=maybe-uninitialized]
    17454 |     m = nm_match_spec_device(specs,
          |         ^
2021-01-13 08:35:22 +01:00
Thomas Haller
54feadd2c1 lldp/tests: make assertion in _test_recv_fixture_setup() clearer
... to print the errno value on failure.
2021-01-12 21:49:31 +01:00
Thomas Haller
d21bb697ad core: avoid "-Wmaybe-uninitialized" warning in lldp_neighbor_get_raw()
src/devices/nm-lldp-listener.c: In function 'lldp_neighbor_to_variant':
  ./shared/nm-glib-aux/nm-shared-utils.h:1271:5: error: 'raw_len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   1271 |     g_variant_builder_add(builder,
        |     ^
  src/devices/nm-lldp-listener.c:107:19: note: 'raw_len' was declared here
    107 |     gsize         raw_len;
        |                   ^
  ./shared/nm-glib-aux/nm-shared-utils.h:1271:5: error: 'raw_data' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   1271 |     g_variant_builder_add(builder,
        |     ^
  src/devices/nm-lldp-listener.c:106:19: note: 'raw_data' was declared here
    106 |     gconstpointer raw_data;
        |                   ^
2021-01-12 21:49:21 +01:00
Thomas Haller
f16f428b31 NEWS: update 2021-01-12 16:41:31 +01:00
Thomas Haller
63a33b3542 libnm: avoid "-Wmaybe-uninitialized" warning in nm_setting_ethtool_get_optnames()
With LTO build on s390x (Fedora 33) we get a compiler warning:

    libnm-core/nm-setting-ethtool.c: In function 'nm_setting_ethtool_get_optnames':
    libnm-core/nm-setting-ethtool.c:263:60: error: 'len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      263 |     return len > 0 ? nm_memdup(names, sizeof(names[0]) * (((gsize) len) + 1u)) : NULL;
          |                                                            ^
    libnm-core/nm-setting-ethtool.c:257:24: note: 'len' was declared here
      257 |     guint              len;
          |                        ^
    libnm-core/nm-setting-ethtool.c: In function 'nm_setting_ethtool_get_optnames':
    libnm-core/nm-setting-ethtool.c:263:60: error: 'len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      263 |     return len > 0 ? nm_memdup(names, sizeof(names[0]) * (((gsize) len) + 1u)) : NULL;
          |                                                            ^
    libnm-core/nm-setting-ethtool.c:257:24: note: 'len' was declared here
      257 |     guint              len;
          |                        ^
2021-01-12 16:32:59 +01:00
Thomas Haller
d26fa1cd52 contrib: fix "contrib/scripts/nm-copr-build.sh" script 2021-01-12 14:53:00 +01:00
Thomas Haller
1277e4c882 contrib: add "contrib/scripts/nm-copr-build.sh" script
This will be the script used by our copr repositories ([1]) for building
the SRPM of NetworkManger from git.

[1] https://copr.fedorainfracloud.org/coprs/networkmanager/
2021-01-12 14:28:23 +01:00
Thomas Haller
55e4b0ea9c contrib: add "contrib/scripts/nm-copr-build-nm-git-bundle.sh" script 2021-01-12 13:16:17 +01:00
Thomas Haller
478d5bdafe shared: fix unit tests for nm_utils_get_next_realloc_size()
The change broke unit tests on 32 bit systems.

Change the code again to make it more similar to what it was
before. Now only on 64 bit systems there is any difference compared
to before. That makes it easier about reasoning for how the unit test
should be (in most cases, it is unchanged).

Fixes: 040c86f15c ('shared: avoid compiler warning for nm_utils_get_next_realloc_size() returning huge sizes')
2021-01-12 09:56:43 +01:00
Thomas Haller
4686e9baef n-dhcp4: work around compiler warning in n_dhcp4_socket_packet_send()
With LTO enabled, the compiler might think that "len" is not initialized.
That is even a correct assumption, if the compiler does not understand the
API of sendmsg() and that sendmsg() is supposed to set a negative errno.

Work around by initializing the variable.

    shared/n-dhcp4/src/n-dhcp4-c-connection.c: In function n_dhcp4_c_connection_send_request:
    shared/n-dhcp4/src/n-dhcp4-socket.c:368:19: error: len may be used uninitialized in this function [-Werror=maybe-uninitialized]
             } else if (len != n_buf) {
                       ^
    shared/n-dhcp4/src/n-dhcp4-socket.c:351:23: note: len was declared here
             size_t n_buf, len;
                           ^
2021-01-11 19:03:28 +01:00
Thomas Haller
040c86f15c shared: avoid compiler warning for nm_utils_get_next_realloc_size() returning huge sizes
On s390x (gcc-8.3.1-5.1.el8.s390x) the compiler warns that we don't
pass size larger than 2^63-1 to malloc. With LTO enabled, it is also
quite adamant in detecting that with nm_utils_get_next_realloc_size().

Optimally, we would disable this useless warning with "-Wno-alloc-size-larger-than",
but that seems not to work. So add a workaround in code :(

It's hard to actually workaround the warning while handling all kinds of
sizes. The only simple solution is to no handle such huge cases and only
assert.

    In function 'nm_secret_mem_realloc',
        inlined from '_nm_str_buf_ensure_size' at shared/nm-glib-aux/nm-shared-utils.c:5316:31:
    shared/nm-glib-aux/nm-secret-utils.h:180:17: error: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=]
             m_new = g_malloc(new_len);
                     ^
    shared/nm-glib-aux/nm-secret-utils.h: In function '_nm_str_buf_ensure_size':
    /usr/include/glib-2.0/glib/gmem.h:78:10: note: in a call to allocation function 'g_malloc' declared here
     gpointer g_malloc         (gsize  n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
              ^
    lto1: all warnings being treated as errors
2021-01-11 19:03:28 +01:00
Thomas Haller
800e226334 device: add "ipv4.dhcp-client-id=ipv6-duid" property for RFC4361
RFC4361 intends to set the same IAID/DUID for both DHCPv4 and DHCPv6.
Previously, we didn't have a mode for that.

Of course, you could always set "ipv4.dhcp-client-id" and
"ipv6.dhcp-duid" to (the same) hex string, but there was no
automatic mode. Instead we had:

- "ipv4.dhcp-client-id=duid" which sets the client ID to a stable,
  generated DUID. However, there was no option so that the same
  DUID/IAID would be automatically used for DHCPv6.

- there are various special values for "ipv6.dhcp-duid" which generate
  a stable DUIDs. However, those values did not work for
  "ipv4.dhcp-client-id".

Solve that by adding "ipv4.dhcp-client-id=ipv6-duid" which indicates to use
the DUID from DHCPv6's "ipv6.dhcp-duid" setting. As IAID it will prefer "ipv4.dhcp-iaid"
(if set), but fallback to "ipv6.dhcp-iaid".

https://tools.ietf.org/html/rfc4361

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/618

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/718
2021-01-11 18:59:01 +01:00
Antonio Cardace
6914e19e80 wifi: merge branch 'ac/wpa3_pmf_fix'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/722
2021-01-11 15:49:14 +01:00
Antonio Cardace
fa14406dc7 wifi: always require PMF when using WPA-EAP-SUITE-B-192
The default value is `optional' so the current check in place is
actually wrong and blocks NM from connecting to WPA3 networks.

Overall the check is not that useful as WPA3 Enterprise always
requires PMF to be 'required' so let's always force it instead.

Signed-off-by: Antonio Cardace <acardace@redhat.com>
Fixes: e874ccc917 ('wifi: add WPA-EAP-SUITE-B-192 support')
2021-01-11 15:48:51 +01:00
Thomas Haller
0f8e1ca0af n-dhcp4: revert "all: remove unnecessary <netinet/ether.h> includes"
This file has no relevance for NetworkManager. And we should not deviate
from upstream n-dhcp4 which we include via git-subtree. Revert the
change.

This partly reverts commit 7f4a7bf433.
2021-01-11 10:06:17 +01:00
Yuri Chornoivan
919133e319 po: update Ukrainian (uk) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/720
2021-01-11 08:23:35 +01:00
Thomas Haller
7c6adf8032 clients: fix compiler warning in _do_test_parse_passwd_file()
Since "_i" is int type and G_N_ELEMENTS() is size_t, the compiler
can warn

    error: comparison of unsigned expression in '< 0' is always false [-Werror=type-limits]

Avoid the warning by casting.
2021-01-08 19:06:44 +01:00
Thomas Haller
395273d20d cloud-setup: merge branch 'th/cloud-setup-man'
https://bugzilla.redhat.com/show_bug.cgi?id=1867997
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/600

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/719
2021-01-08 16:38:24 +01:00
Thomas Haller
f0c4b3b287 man: improve "nm-cloud-setup" manual page
It's questionable whether the manual page should explain
exactly what it does.

However, it's a good exercise writing this up (to review
what happens). Also, a manual page that simply says "it configures
the network automatically" without going into how exactly, is
not very useful either.
2021-01-08 16:34:53 +01:00
Thomas Haller
8128f791c9 cloud-setup: assign incremental iface_idx for Azure,GCP get_config() result
We use the iface_idx for example to determine the routing table,
by using table 30400+iface_idx.

While the HTTP API for Azure has a index, it does not mean that we
should use that index as-is for our purpose.

Instead, treat those indexes separately and ensure that the
iface_idx that we return is numbering the interfaces starting
from zero.
2021-01-08 16:32:50 +01:00
Thomas Haller
e81b442d8b cloud-setup: fail get_config() for Azure on invalid prefix
While it's not clear whether we should be strict or forgiving
when fetching the HTTP meta data, we should be consistent.

On a parse error of the IP addresses we fail. Hence also
fail on a parse error for the subnet.
2021-01-08 16:32:49 +01:00