Commit Graph

27030 Commits

Author SHA1 Message Date
Thomas Haller
6c6a00eae5 contrib: use new "find-backports" script in "release.sh" 2020-08-05 00:24:40 +02:00
Beniamino Galvani
dee5ce0a52 systemd: merge branch systemd into master 2020-08-04 17:20:21 +02:00
Beniamino Galvani
5747fb11a8 systemd: update code from upstream (2020-08-04)
This is a direct dump from systemd git.

======

SYSTEMD_DIR=../systemd
COMMIT=f01da474d165cbcb7c1edb6c2b5bdef4a49cd0ca

(
  cd "$SYSTEMD_DIR"
  git checkout "$COMMIT"
  git reset --hard
  git clean -fdx
)

git ls-files -z :/src/systemd/src/ \
                :/shared/systemd/src/ \
                :/shared/nm-std-aux/unaligned.h | \
  xargs -0 rm -f

nm_copy_sd_shared() {
    mkdir -p "./shared/systemd/$(dirname "$1")"
    cp "$SYSTEMD_DIR/$1" "./shared/systemd/$1"
}

nm_copy_sd_core() {
    mkdir -p "./src/systemd/$(dirname "$1")"
    cp "$SYSTEMD_DIR/$1" "./src/systemd/$1"
}

nm_copy_sd_stdaux() {
    mkdir -p "./shared/nm-std-aux/"
    cp "$SYSTEMD_DIR/$1" "./shared/nm-std-aux/${1##*/}"
}

nm_copy_sd_core "src/libsystemd-network/arp-util.c"
nm_copy_sd_core "src/libsystemd-network/arp-util.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-lease-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-network.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-option.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-packet.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-protocol.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-lease-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-network.c"
nm_copy_sd_core "src/libsystemd-network/dhcp6-option.c"
nm_copy_sd_core "src/libsystemd-network/dhcp6-protocol.h"
nm_copy_sd_core "src/libsystemd-network/lldp-internal.h"
nm_copy_sd_core "src/libsystemd-network/lldp-neighbor.c"
nm_copy_sd_core "src/libsystemd-network/lldp-neighbor.h"
nm_copy_sd_core "src/libsystemd-network/lldp-network.c"
nm_copy_sd_core "src/libsystemd-network/lldp-network.h"
nm_copy_sd_core "src/libsystemd-network/network-internal.c"
nm_copy_sd_core "src/libsystemd-network/network-internal.h"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp-client.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp-lease.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-client.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-lease.c"
nm_copy_sd_core "src/libsystemd-network/sd-ipv4acd.c"
nm_copy_sd_core "src/libsystemd-network/sd-ipv4ll.c"
nm_copy_sd_core "src/libsystemd-network/sd-lldp.c"
nm_copy_sd_core "src/libsystemd/sd-event/event-source.h"
nm_copy_sd_core "src/libsystemd/sd-event/event-util.c"
nm_copy_sd_core "src/libsystemd/sd-event/event-util.h"
nm_copy_sd_core "src/libsystemd/sd-event/sd-event.c"
nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.c"
nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.h"
nm_copy_sd_core "src/libsystemd/sd-id128/sd-id128.c"
nm_copy_sd_core "src/systemd/_sd-common.h"
nm_copy_sd_core "src/systemd/sd-dhcp-client.h"
nm_copy_sd_core "src/systemd/sd-dhcp-lease.h"
nm_copy_sd_core "src/systemd/sd-dhcp-option.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-client.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-lease.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-option.h"
nm_copy_sd_core "src/systemd/sd-event.h"
nm_copy_sd_core "src/systemd/sd-id128.h"
nm_copy_sd_core "src/systemd/sd-ipv4acd.h"
nm_copy_sd_core "src/systemd/sd-ipv4ll.h"
nm_copy_sd_core "src/systemd/sd-lldp.h"
nm_copy_sd_core "src/systemd/sd-ndisc.h"
nm_copy_sd_shared "src/basic/alloc-util.c"
nm_copy_sd_shared "src/basic/alloc-util.h"
nm_copy_sd_shared "src/basic/async.h"
nm_copy_sd_shared "src/basic/cgroup-util.h"
nm_copy_sd_shared "src/basic/env-file.c"
nm_copy_sd_shared "src/basic/env-file.h"
nm_copy_sd_shared "src/basic/env-util.c"
nm_copy_sd_shared "src/basic/env-util.h"
nm_copy_sd_shared "src/basic/errno-util.h"
nm_copy_sd_shared "src/basic/escape.c"
nm_copy_sd_shared "src/basic/escape.h"
nm_copy_sd_shared "src/basic/ether-addr-util.c"
nm_copy_sd_shared "src/basic/ether-addr-util.h"
nm_copy_sd_shared "src/basic/extract-word.c"
nm_copy_sd_shared "src/basic/extract-word.h"
nm_copy_sd_shared "src/basic/fd-util.c"
nm_copy_sd_shared "src/basic/fd-util.h"
nm_copy_sd_shared "src/basic/fileio.c"
nm_copy_sd_shared "src/basic/fileio.h"
nm_copy_sd_shared "src/basic/format-util.c"
nm_copy_sd_shared "src/basic/format-util.h"
nm_copy_sd_shared "src/basic/fs-util.c"
nm_copy_sd_shared "src/basic/fs-util.h"
nm_copy_sd_shared "src/basic/hash-funcs.c"
nm_copy_sd_shared "src/basic/hash-funcs.h"
nm_copy_sd_shared "src/basic/hashmap.c"
nm_copy_sd_shared "src/basic/hashmap.h"
nm_copy_sd_shared "src/basic/hexdecoct.c"
nm_copy_sd_shared "src/basic/hexdecoct.h"
nm_copy_sd_shared "src/basic/hostname-util.c"
nm_copy_sd_shared "src/basic/hostname-util.h"
nm_copy_sd_shared "src/basic/in-addr-util.c"
nm_copy_sd_shared "src/basic/in-addr-util.h"
nm_copy_sd_shared "src/basic/io-util.c"
nm_copy_sd_shared "src/basic/io-util.h"
nm_copy_sd_shared "src/basic/list.h"
nm_copy_sd_shared "src/basic/log.h"
nm_copy_sd_shared "src/basic/macro.h"
nm_copy_sd_shared "src/basic/memory-util.c"
nm_copy_sd_shared "src/basic/memory-util.h"
nm_copy_sd_shared "src/basic/mempool.c"
nm_copy_sd_shared "src/basic/mempool.h"
nm_copy_sd_shared "src/basic/missing_fcntl.h"
nm_copy_sd_shared "src/basic/missing_random.h"
nm_copy_sd_shared "src/basic/missing_socket.h"
nm_copy_sd_shared "src/basic/missing_stat.h"
nm_copy_sd_shared "src/basic/missing_syscall.h"
nm_copy_sd_shared "src/basic/missing_type.h"
nm_copy_sd_shared "src/basic/parse-util.c"
nm_copy_sd_shared "src/basic/parse-util.h"
nm_copy_sd_shared "src/basic/path-util.c"
nm_copy_sd_shared "src/basic/path-util.h"
nm_copy_sd_shared "src/basic/prioq.c"
nm_copy_sd_shared "src/basic/prioq.h"
nm_copy_sd_shared "src/basic/process-util.c"
nm_copy_sd_shared "src/basic/process-util.h"
nm_copy_sd_shared "src/basic/random-util.c"
nm_copy_sd_shared "src/basic/random-util.h"
nm_copy_sd_shared "src/basic/set.h"
nm_copy_sd_shared "src/basic/signal-util.c"
nm_copy_sd_shared "src/basic/signal-util.h"
nm_copy_sd_shared "src/basic/siphash24.h"
nm_copy_sd_shared "src/basic/socket-util.c"
nm_copy_sd_shared "src/basic/socket-util.h"
nm_copy_sd_shared "src/basic/sort-util.h"
nm_copy_sd_shared "src/basic/sparse-endian.h"
nm_copy_sd_shared "src/basic/stat-util.c"
nm_copy_sd_shared "src/basic/stat-util.h"
nm_copy_sd_shared "src/basic/stdio-util.h"
nm_copy_sd_shared "src/basic/string-table.c"
nm_copy_sd_shared "src/basic/string-table.h"
nm_copy_sd_shared "src/basic/string-util.c"
nm_copy_sd_shared "src/basic/string-util.h"
nm_copy_sd_shared "src/basic/strv.c"
nm_copy_sd_shared "src/basic/strv.h"
nm_copy_sd_shared "src/basic/strxcpyx.c"
nm_copy_sd_shared "src/basic/strxcpyx.h"
nm_copy_sd_shared "src/basic/time-util.c"
nm_copy_sd_shared "src/basic/time-util.h"
nm_copy_sd_shared "src/basic/tmpfile-util.c"
nm_copy_sd_shared "src/basic/tmpfile-util.h"
nm_copy_sd_shared "src/basic/umask-util.h"
nm_copy_sd_shared "src/basic/user-util.h"
nm_copy_sd_shared "src/basic/utf8.c"
nm_copy_sd_shared "src/basic/utf8.h"
nm_copy_sd_shared "src/basic/util.c"
nm_copy_sd_shared "src/basic/util.h"
nm_copy_sd_shared "src/shared/dns-domain.c"
nm_copy_sd_shared "src/shared/dns-domain.h"
nm_copy_sd_shared "src/shared/web-util.c"
nm_copy_sd_shared "src/shared/web-util.h"
nm_copy_sd_stdaux "src/basic/unaligned.h"
2020-08-04 17:07:31 +02:00
Beniamino Galvani
0024cef238 n-dhcp4: fix BPF filter endianness issue
The BPF filter takes the byte containing IP Flags and performs a
bitwise AND with "ntohs(IP_MF | IP_OFFMASK)".

On little-endian architectures the IP_MF flag (0x20) is ANDed with
0xFF3F and so the presence of the flag is correctly detected ignoring
other flags as IP_DF (0x40) or IP_RF (0x80).

On big-endian, "ntohs(IP_MF | IP_OFFMASK)" is 0x3FFF and so the filter
wrongly checks the presence of *any* flags. Therefore, a packet with
the DF flag set is dropped.

Instead, take the two bytes containing flags and offset:

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |Version|  IHL  |Type of Service|          Total Length         |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |         Identification        |Flags|      Fragment Offset    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

and verify that IP_MF and the offset are zero.

Fixes: e43b1791a3 ('Merge commit 'e23b3c9c3ac86b065eef002fa5c4321cc4a87df2' as 'shared/n-dhcp4'')

https://bugzilla.redhat.com/show_bug.cgi?id=1861488
https://github.com/nettools/n-dhcp4/pull/19
(cherry picked from commit 03d38e83e558802a82cb0e4847cb1f1ef75ccd16)
2020-08-04 16:10:02 +02:00
Sayed Shah
7baf615eaa all: changes from python 2 syntax to python3 and removing dead code
There were python 2 methods that are not used anymore so now
it's in python 3. Added helper fuctions so that the code is more clear

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/540
2020-08-03 18:37:43 +02:00
Thomas Haller
4d878d7012 wifi: avoid crash due to incomplete Wi-Fi API info
In this case, GetAll failed with "Timeout was reached". We still
create a dummy BSS info, because we kept track of the object to
start with. That way, we don't simply want to ignore the failure,
because NMDeviceWifi might track this NMWifiAP already, and we may
need an update (even if we failed to fetch the requested information).

However, that later leads to a crash, because NMDeviceWifi expect the BSSID
present then.

Avoid that, by don't processing such APs.

    #0  g_logv (log_domain=0x7f2ac10a60a9 "NetworkManager", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=<optimized out>) at ../glib/gmessages.c:1377
    #1  0x00007f2acf152233 in g_log
        (log_domain=log_domain@entry=0x7f2ac10a60a9 "NetworkManager", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0x7f2acf1a46ff "%s: assertion '%s' failed")
        at ../glib/gmessages.c:1415
    #2  0x00007f2acf152a2d in g_return_if_fail_warning
        (log_domain=log_domain@entry=0x7f2ac10a60a9 "NetworkManager", pretty_function=pretty_function@entry=0x7f2ac10a9e70 <__func__.50> "try_fill_ssid_for_hidden_ap", expression=expression@entry=0x7f2ac10a86d0 "bssid") at ../glib/gmessages.c:2771
    #3  0x00007f2ac108a402 in try_fill_ssid_for_hidden_ap (ap=0x5569978b61c0 [NMWifiAP], self=0x55699786ea00 [NMDeviceWifi]) at src/devices/wifi/nm-device-wifi.c:1883
    #4  supplicant_iface_bss_changed_cb (iface=0x556997777260 [NMSupplicantInterface], bss_info=0x7f2ab4028f00, is_present=1, self=0x55699786ea00 [NMDeviceWifi])
        at src/devices/wifi/nm-device-wifi.c:1946
    #5  0x00007f2ace246af0 in ffi_call_unix64 () at ../src/x86/unix64.S:76
    #6  0x00007f2ace2462ab in ffi_call (cif=cif@entry=0x7ffd9c107c90, fn=fn@entry=0x7f2ac1089e80 <supplicant_iface_bss_changed_cb>, rvalue=<optimized out>, avalue=avalue@entry=0x7ffd9c107ba0)
        at ../src/x86/ffi64.c:525
    #7  0x00007f2acf23e87a in g_cclosure_marshal_generic_va
        (closure=<optimized out>, return_value=<optimized out>, instance=<optimized out>, args_list=<optimized out>, marshal_data=<optimized out>, n_params=<optimized out>, param_types=<optimized out>) at ../gobject/gclosure.c:1614
    #8  0x00007f2acf23dae6 in _g_closure_invoke_va
        (closure=closure@entry=0x5569978a0cc0, return_value=return_value@entry=0x0, instance=instance@entry=0x556997777260, args=args@entry=0x7ffd9c107f00, n_params=2, param_types=0x55699775b990) at ../gobject/gclosure.c:873
    #9  0x00007f2acf2566e9 in g_signal_emit_valist (instance=0x556997777260, signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7ffd9c107f00) at ../gobject/gsignal.c:3407
    #10 0x00007f2acf256c63 in g_signal_emit (instance=instance@entry=0x556997777260, signal_id=<optimized out>, detail=detail@entry=0) at ../gobject/gsignal.c:3554
    #11 0x00005569972ece61 in _bss_info_changed_emit (self=self@entry=0x556997777260 [NMSupplicantInterface], bss_info=bss_info@entry=0x7f2ab4028f00, is_present=is_present@entry=1)
        at src/supplicant/nm-supplicant-interface.c:555
    #12 0x00005569972ed3a0 in _bss_info_properties_changed (self=0x556997777260 [NMSupplicantInterface], bss_info=0x7f2ab4028f00, properties=<optimized out>, initial=<optimized out>)
        at src/supplicant/nm-supplicant-interface.c:758
    #13 0x00005569972f756b in _bss_info_get_all_cb (result=0x0, error=<optimized out>, user_data=0x7f2ab4028f00) at src/supplicant/nm-supplicant-interface.c:784
    #14 0x0000556997217bc1 in _nm_dbus_connection_call_default_cb (source=0x5569977480c0 [GDBusConnection], res=<optimized out>, user_data=user_data@entry=0x556997855d50)
        at shared/nm-glib-aux/nm-dbus-aux.c:74
    #15 0x00007f2acf339e4a in g_task_return_now (task=task@entry=0x7f2ab4003f00 [GTask]) at ../gio/gtask.c:1214
    #16 0x00007f2acf33aa3d in g_task_return (task=0x7f2ab4003f00 [GTask], type=<optimized out>) at ../gio/gtask.c:1283
    #17 0x00007f2acf33b4fe in g_task_return (type=G_TASK_RETURN_ERROR, task=<optimized out>) at ../gio/gtask.c:1861
    #18 g_task_return_error (task=<optimized out>, error=<optimized out>) at ../gio/gtask.c:1867
    #19 0x0000556997893f40 in  ()
    #20 0x3a85d39adfae7f00 in  ()
    #21 0x00007f2ab4003cc0 in  ()
    #22 0x00007f2acf396460 in g_dbus_connection_call_done () at ../gio/gdbusconnection.c:2059
    #23 0x00007f2ab4003f00 in  ()
    #24 0x0000000000000086 in  ()
    #25 0x0000000000000018 in  ()
    #26 0x00007f2acf339e4a in g_task_return_now (task=0x7f2ab4003f00 [GTask], task@entry=0x7f2ab4003cc0 [GTask]) at ../gio/gtask.c:1214
    #27 0x00007f2acf33aa3d in g_task_return (task=0x7f2ab4003cc0 [GTask], type=<optimized out>) at ../gio/gtask.c:1283
    #28 0x00007f2acf33b4fe in g_task_return (type=G_TASK_RETURN_ERROR, task=<optimized out>) at ../gio/gtask.c:1861
    #29 g_task_return_error (task=<optimized out>, error=<optimized out>) at ../gio/gtask.c:1867
    #30 0x0000003000000028 in  ()
    #31 0x00007ffd9c108290 in  ()

Fixes: b83f07916a ('supplicant: large rework of wpa_supplicant handling')
2020-08-03 10:16:28 +02:00
Thomas Haller
e95b400d04 l3cfg: merge branch 'th/l3cfg-3'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/591
2020-07-31 08:56:58 +02:00
Thomas Haller
e50597559b l3cfg: track externally removed addresses/routes
We want to allow the user to externally remove IP addresses
and routes, and NetworkManager not re-adding them until a full reapply
happens. For that, we need to keep track of IP addresses that were
present, but no longer are.
2020-07-31 08:53:07 +02:00
Thomas Haller
3ac668bc1a l3cfg: add support for tracking routes that are currently unavailable
It doesn't yet do anything. More is needed. In particular, we need to
keep track of routes that were externally deleted, then we can merge
that with routes that are known to be currently unavailable.
2020-07-31 08:53:07 +02:00
Thomas Haller
c3798fbf4e l3cfg: add nm_l3cfg_platform_commit() 2020-07-31 08:53:07 +02:00
Thomas Haller
1867746e6c l3cfg: track route-table sync mode in NML3ConfigData
Currently, we track the route table sync mode outside of the settings.
But as it depends on configuration, we should track it in NML3ConfigData.
2020-07-31 08:53:06 +02:00
Thomas Haller
695ce608ba l3cfg: add nm_l3_config_data_add_dependent_routes() 2020-07-31 08:53:06 +02:00
Thomas Haller
81cf493b96 l3cfg: support tracking NML3ConfigData in NML3Cfg
NML3Cfg is supposed to manage an interface (by ifindex).

As such, it later will itself implement DHCP and similar addressing
methods.

However, in various cases we get additional IP configuration from
external (e.g. from a VPN connection). To support that, let NML3Cfg
track any number of NML3ConfigData instances.
2020-07-31 08:53:06 +02:00
Thomas Haller
297eb4d169 l3cfg: support more properties in NML3ConfigData 2020-07-31 08:53:06 +02:00
Thomas Haller
bfc77c89d1 l3cfg: add flags for affecting how add-object works for NML3ConfigData
We need a way to say don't touch the existing object during add.
Add flags for that.
2020-07-31 08:53:06 +02:00
Thomas Haller
98e311899d l3cfg: add nm_l3_config_data_cmp()/nm_l3_config_data_equal() 2020-07-31 08:53:06 +02:00
Thomas Haller
e3e60bf87d l3cfg: add NM_IS_L3_CONFIG_DATA() for asserting valid NML3ConfigData instances 2020-07-31 08:53:06 +02:00
Thomas Haller
5ccfa38565 platform: move full-sync parameter away from nm_platform_ip_address_sync()
This parameter really affects whether a candidate in @addresses_prune will be
considered or not. Since we already construct the prune list separately, this
parameter is at the wrong place.

This requires us to re-implement nm_platform_lookup_clone(). While the
function has a predicate callback that we could use for this purpose,
I will later add a separate predicate argument to
nm_platform_ip_address_get_prune_list(). When that happens, it would
be cumbersome to chain the two function pointers. Instead, reimplement
nm_platform_lookup_clone().
2020-07-31 08:53:06 +02:00
Thomas Haller
dadfc3abd5 platform: allow injecting the list of addresses to prune
Follow the pattern of nm_platform_ip_route_sync(), which also accepts
the list of addresses that are potential candidates for removal.

This allows the caller to carefully construct the list of addresses
which are possibly removed, so that sync (possibly) only adds new
addresses.
2020-07-31 08:53:05 +02:00
Thomas Haller
0acb577320 platform: minor cleanup in nm_platform_ip_address_sync()
The known address must not have a zero lifetime,
because we filter those addresses out first.
2020-07-31 08:53:05 +02:00
Thomas Haller
dca62c06fd platform: merge nm_platform_ip_address_sync() implementations
It is beneficial to have both address families side by side.

A lot of operations are exactly the same, so it's preferable to see
that. Especially in the cases where they differ, it's preferable to see
how they differ (and why).
2020-07-31 08:53:05 +02:00
Thomas Haller
30a8b1c713 platform: add NMP_OBJECT_TYPE_TO_ADDR_FAMILY() helper 2020-07-31 08:53:05 +02:00
Thomas Haller
ba9c150286 core: inline _add_local_route_from_addr[46] helper function
In this case, the functions are only called once. Having a helper
function that has no clear, unique purpose does not necessarily make the
code simpler.

Also, NMIP[46]Config is going to change completely. It will thereby move
this code (and change it). Doing that is simpler, if we see all the
relevant parts in one place.
2020-07-31 08:53:05 +02:00
Thomas Haller
8225785956 device: use nm_utils_ip4_address_is_link_local() in nm_device_handle_ipv4ll_event() 2020-07-31 08:53:05 +02:00
Thomas Haller
d61bb9b97c core: use nm_utils_ip4_address_is_zeronet() helper 2020-07-31 08:53:05 +02:00
Thomas Haller
7670899d2c core: add nm_utils_ip4_address_is_zeronet() helper 2020-07-31 08:53:05 +02:00
Thomas Haller
63b788dad2 core: add nm_utils_ip_address_same_prefix_cmp() helper 2020-07-31 08:53:04 +02:00
Thomas Haller
1a4cc800f6 platform: add nmp_object_indirect_id_*() helpers 2020-07-31 08:53:04 +02:00
Thomas Haller
14fa487a60 platform: add static assertion to check NMPlatformIP{Address,Route} struct layout 2020-07-31 08:53:04 +02:00
Thomas Haller
7eb94b7dcc platform: add nm_platform_ip_route_get_gateway() helper 2020-07-31 08:53:04 +02:00
Thomas Haller
1e3f5b7c01 platform: add NMP_OBJECT_TYPE_IP_ADDRESS()/NMP_OBJECT_TYPE_IP_ROUTE() macros 2020-07-31 08:53:04 +02:00
Thomas Haller
443859f71f shared: add NM_CMP_DIRECT_UNSAFE() macro 2020-07-31 08:53:04 +02:00
Thomas Haller
62c1a1b5b2 shared: move nm_utils_is_power_of_two() to nm-stdaux and add nm_utils_is_power_of_two_or_zero() 2020-07-31 08:53:04 +02:00
Thomas Haller
d550eef02d shared: add nm_strv_ptrarray_cmp() helper 2020-07-31 08:53:03 +02:00
Thomas Haller
684b0ec061 shared: add nm_g_ptr_array_pdata() helper 2020-07-31 08:53:03 +02:00
Thomas Haller
b23d117079 shared: use designated initializer in nm_dedup_multi_idx_type_init() 2020-07-31 08:53:03 +02:00
Vincent Lefevre
a938f4f018 man: fix a typo
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/594
2020-07-30 17:52:12 +02:00
Thomas Haller
94e2348c54 cloud-setup: merge branch 'th/cloud-setup-error-handling'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/593
2020-07-30 09:22:53 +02:00
Thomas Haller
4c94a9736b cloud-setup: rework error handling and completion for EC2 provider
Make the error handling similar to the other provider implementations.

- only actually return once all callbacks completed.

- cache the first error and report it.
2020-07-30 09:18:40 +02:00
Thomas Haller
9887ea5b61 cloud-setup: cleanup error handling in Azure provider
- drop AzureData.success field. It is redundant to have AzureData.error set.
  Also it was actually unused.

- ensure that we keep the first error passed during
  _get_config_maybe_task_return(). Once we set an error, that error gets
  returned. There is a twist here, that we prefer cancellation errors
  over other error reasons.
2020-07-30 09:18:40 +02:00
Thomas Haller
2582694b46 cloud-setup: cleanup error handling in GCP provider
- drop GCPData.success field. It is redundant to have GCPData.error set.
  Also, it's meaningless to indicate failure, if we don't have an error
  at hand.

- ensure that we keep the first error passed during
  _get_config_maybe_task_return(). Once we set an error, that error gets
  returned. There is a twist here, that we prefer cancellation errors
  over other error reasons.

- in _get_config_fip_cb(), ensure to call _get_config_maybe_task_return()
  even if we are not yet ready. That is useful to record a potential
  error.
2020-07-30 09:18:40 +02:00
Sayed Shah
df6cdd4315 cloud-setup: fix the host address for azure
Fixes: e7ac7290bd ('cloud-setup: add tool for automatic IP configuration in cloud')
2020-07-30 09:16:42 +02:00
Beniamino Galvani
76a6a30577 dhcp6: don't require a hardware address
The systemd DHCPv6 client requires a hardware address only to
determine the IAID; NM always overrides the IAID with its own and
therefore the hwaddr is not used.

Removing such requirement allows DHCPv6 to run over PPP, which is
useful with DHCPv6-PD to get a prefix from the ISP.

To test this, I set up a server with pppoe-server, radvd and the Wide
DHCPv6 server providing an address and a prefix. On the client, NM was
able to obtain a prefix using both dhcp=dhclient and dhcp=systemd.

Note that if there is no hardware address and you specify
ipv6.dhcp-duid=ll or ipv6.dhcp-iaid=mac, a warning will be emitted and
NM will use a random DUID/IAID.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/478
2020-07-29 18:08:53 +02:00
Thomas Haller
cfbaa2d8eb device: fix emitting unnecessary PROP_IFINDEX notification in NMDevice
Fixes: ea1f0fc0a6 ('device: let NMDevice track a NML3Cfg instance for each ifindex')
2020-07-29 17:21:10 +02:00
Sayed Shah
e7ac7290bd cloud-setup: add tool for automatic IP configuration in cloud
This is a tool for automatically configuring networking in azure
cloud environment.

This add a provider implementation for Azure that when detected fetches
the private ip addressess and the subnet prefix of configured internal
load balancers.

Once this information is fetched from the metadata server, it instructs
NetworkManager to add private ip addressess and subnet prefix for each
interface detected.

It is inspired by SuSE's cloud-netconfig ([1], [2]) and Azure Instance Metadata service [3].

[1] https://www.suse.com/c/multi-nic-cloud-netconfig-ec2-azure/
[2] https://github.com/SUSE-Enceladus/cloud-netconfig
[3] https://docs.microsoft.com/en-us/azure/virtual-machines/linux/instance-metadata-service

It is also intended to work without configuration. The main point is
that you boot an image with NetworkManager and nm-cloud-setup enabled,
and it just works.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/572
2020-07-29 15:56:15 +02:00
Thomas Haller
c904736d96 l3cfg: merge branch 'th/l3cfg-2'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/588
2020-07-28 16:04:17 +02:00
Thomas Haller
99f096577c l3cfg: add flags for NML3ConfigData
Add a flags parameter. That is useful to bundle multiple simple boolean
properties, without need to implement individual accessors.
2020-07-28 16:03:51 +02:00
Thomas Haller
d9547e8452 l3cfg: make NML3ConfigData ref/unref functions const
NML3ConfigData is supposed to be used as immutable, ref-counted type.
You create it once, initialize it, seal it, and pass (immutable) references
around.

In such a scheme, having ref/unref functions not operate on const pointers
is a major inconvenience.
2020-07-24 16:12:23 +02:00
Thomas Haller
a2a69a2dab l3cfg: add more API to NML3ConfigData 2020-07-24 16:12:23 +02:00
Thomas Haller
6aa338edd4 l3cfg: tie NML3ConfigData to an ifindex
NML3ConfigData tracks IP addresses and routes. In their current form, these
types (NMPObject) always have an ifindex and there is no sensible way to have
an NMPObject (for routes or addresses) that have a wildcard ifindex.

Honor that by also tying NML3ConfigData to an ifindex. In most cases, the
user knows the ifindex before and can create it. On the unlikely case where
the user doesn't know the ifindex, we should add a new nm_l3_config_data_clone()
function, which allows migrating the setting from one ifindex to another.
2020-07-24 16:12:23 +02:00