Commit Graph

25044 Commits

Author SHA1 Message Date
Thomas Haller
e978eca644 libnm: fix exposing nm_wifi_p2p_peer_get_name() from D-Bus property
Fixes: ce0e898fb4 ('libnm: refactor caching of D-Bus objects in NMClient')
2020-01-15 13:37:20 +01:00
Thomas Haller
109a6fd557 introspection: belatedly add Wi-Fi P2P peer "Name" property to D-Bus introspection file
Fixes: 00e64d1332 ('core/devices: Add P2P Wifi device and peer tracking')
2020-01-15 13:32:33 +01:00
Thomas Haller
51b39ceb33 libnm: fix wrong assertion in nm_client_add_and_activate_connection2_finish()
Fixes: ce0e898fb4 ('libnm: refactor caching of D-Bus objects in NMClient')
2020-01-15 12:32:02 +01:00
Benjamin Berg
e8cc69c37e libnm: fix interface and object path for P2P StartFind/StopFind calls
The change to use a GDBusConnection (7871105ff9) introduced a bug by
using the wrong hardcoded path and the wrong interface. Correct this
mistake again.

Fixes: 7871105ff9 ('libnm: implement nm_device_wifi_p2p_start_find()/nm_device_wifi_p2p_stop_find() by using GDBusConnection directly')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/399
2020-01-15 11:55:57 +01:00
Thomas Haller
7766e24cdc license: add Iñigo to RELICENSE.md
https://mail.gnome.org/archives/networkmanager-list/2020-January/msg00014.html
2020-01-14 17:30:44 +01:00
Thomas Haller
d7d66f0963 license: add Dan, Dan, Lubomir and Franceso to RELICENSE.md
Dan Williams:      https://mail.gnome.org/archives/networkmanager-list/2020-January/msg00013.html
Dan Winship:       https://mail.gnome.org/archives/networkmanager-list/2020-January/msg00012.html
Francesco Giudici: https://mail.gnome.org/archives/networkmanager-list/2020-January/msg00015.html
Lubomir Rintel:    https://mail.gnome.org/archives/networkmanager-list/2020-January/msg00018.html
2020-01-14 17:25:11 +01:00
Thomas Haller
694e22f88d license: add list for legal entities to track their relation of contributors
And add "Red Hat, Inc." there. The actual consent is not yet determined.
2020-01-14 17:13:37 +01:00
Thomas Haller
6d9f1725db license: relicense "shared/nm-std-aux/nm-dbus-compat.h" under LGPL-2.1+
"nm-dbus-compat.h" was GPL licensed. That is a problem, because we use it from
libnm (which is LGPL).

The history of this file in NetworkManager source tree:

  $ git shortlog -n -s e055bdbbc3 -- shared/nm-std-aux/nm-dbus-compat.h include/nm-dbus-compat.h shared/nm-dbus-compat.h
       5    Thomas Haller
       1    Dan Winship
       1    Lubomir Rintel

Note that commit dd0e198955 ('include: add nm-dbus-compat.h')
introduced this file from dbus sources ([1]). Hence, originally
the file is (like all of dbus sources) dual-licensed under GPL-2.0+
and Academic Free License 2.1 (AFL-2.1). That makes it problematic to
change the license of this file to LGPL also because of the old history
of the file.

Instead, drop everything from the header except the bits that we
actually use. I claim the remainder is trivial and only contains
defines for documented D-Bus API. I don't think that the remainder
is copyrightable and hence get rid of the copy-right notice and the
GPL license.

[1] 39ea37b587/dbus/dbus-shared.h
2020-01-14 16:54:43 +01:00
Thomas Haller
d60cb4d5de initrd: merge branch 'lr/a-pair-of-ibft-fixes'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/393
2020-01-14 16:44:51 +01:00
Thomas Haller
9f95b797f1 initrd/cmdline: minor style cleanups 2020-01-14 16:43:26 +01:00
Lubomir Rintel
39e1e723de initrd/cmdline: obey rd.iscsi.ibft
Do process the connections from the iBFT block if the rd.iscsi.ibft or
rd.iscsi.ibft=1 argument is present.

This is supposed to fix what was originally reported by Kairui Song
<kasong@redhat.com> here: https://github.com/dracutdevs/dracut/pull/697
2020-01-14 16:43:26 +01:00
Lubomir Rintel
59ead70952 initrd/ibft-reader: don't set con.interface-name in iBFT connections
If an argument in form ip=eth0:ibft is specified, we'd first create a
wired connection with con.interface-name and then proceed completing it
from the iBFT block. At that point we also add the MAC address, so the
interface-name is no longer necessary..

Worse even, for VLAN connections, it results in an attempt to create
a VLAN with the same name as the parent wired device. Ooops.

Let's just drop it. MAC address is guarranteed to be there and does the
right thing for both plain wired devices as well as VLANs.
2020-01-14 16:43:26 +01:00
Thomas Haller
de818bf610 n-dhcp4: fix integer context in n_dhcp4_client_probe_transition_nak() on 32 bit
Fixes: 218782a9a3 ('n-dhcp4: restart the transaction after a NAK')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/339
2020-01-14 16:25:49 +01:00
Thomas Haller
c6f9002b13 platform: merge branch 'th/ifa-broadcast'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/391
2020-01-14 16:10:50 +01:00
Thomas Haller
7910333527 platform: generate IFA_BROADCAST address based on the peer IFA_ADDRESS
This is also what iproute2 does ([1]) when creating a default broadcast address
with `ip addr add 192.168.1.5/24 brd + dev eth0`.

Also, kernel does in fib_add_ifaddr() ([2]):
```
        __be32 addr = ifa->ifa_local;
        __be32 prefix = ifa->ifa_address & mask;

        ...

        /* Add broadcast address, if it is explicitly assigned. */
        if (ifa->ifa_broadcast && ifa->ifa_broadcast != htonl(0xFFFFFFFF))
                fib_magic(RTM_NEWROUTE, RTN_BROADCAST, ifa->ifa_broadcast, 32,
                          prim, 0);

        if (!ipv4_is_zeronet(prefix) && !(ifa->ifa_flags & IFA_F_SECONDARY) &&
            (prefix != addr || ifa->ifa_prefixlen < 32)) {
                if (!(ifa->ifa_flags & IFA_F_NOPREFIXROUTE))
                        fib_magic(RTM_NEWROUTE,
                                  dev->flags & IFF_LOOPBACK ? RTN_LOCAL : RTN_UNICAST,
                                  prefix, ifa->ifa_prefixlen, prim,
                                  ifa->ifa_rt_priority);

                /* Add network specific broadcasts, when it takes a sense */
                if (ifa->ifa_prefixlen < 31) {
                        fib_magic(RTM_NEWROUTE, RTN_BROADCAST, prefix, 32,
                                  prim, 0);
                        fib_magic(RTM_NEWROUTE, RTN_BROADCAST, prefix | ~mask,
                                  32, prim, 0);
                }
        }
```

Which means by default kernel already adds those special broadcast routes which
are identical to what we configure with IFA_BROADCAST. However, kernel too bases
them on the peer (IFA_ADDRESS).

[1] https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/tree/ip/ipaddress.c?id=d5391e186f04214315a5a80797c78e50ad9f5271#n2380
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/ipv4/fib_frontend.c?id=bef1d88263ff769f15aa0e1515cdcede84e61d15#n1109
2020-01-14 16:09:24 +01:00
Thomas Haller
71d5550547 platform: track IFA_BROADCAST address in NMPlatformIP4Address
- track the broadcast address in NMPlatformIP4Address. For addresses
  that we receive from kernel and that we cache in NMPlatform, this
  allows us to show the additional information. For example, we
  can see it in debug logging.

- when setting the address, we still mostly generate our default
  broadcast address. This is done in the only relevant caller
  nm_platform_ip4_address_sync(). Basically, we merely moved setting
  the broadcast address to the caller.
  That is, because no callers explicitly set the "use_ip4_broadcast_address"
  flag (yet). However, in the future some caller might want to set an explicit
  broadcast address.

In practice, we currently don't support configuring special broadcast
addresses in NetworkManager. Instead, we always add the default one with
"address|~netmask" (for plen < 31).

Note that a main point of IFA_BROADCAST is to add a broadcast route to
the local table. Also note that kernel anyway will add such a
"address|~netmask" route, that is regardless whether IFA_BROADCAST is
set or not. Hence, setting it or not makes very little difference for
normal broadcast addresses -- because kernel tends to add this route either
way. It would make a difference if NetworkManager configured an unusual
IFA_BROADCAST address or an address for prefixes >= 31 (in which cases
kernel wouldn't add them automatically). But we don't do that at the
moment.

So, while what NM does has little effect in practice, it still seems
more correct to add the broadcast address, only so that you see it in
`ip addr show`.
2020-01-14 16:09:24 +01:00
Beniamino Galvani
e6a9d5b99c merge: branch 'bg/vrf'
Add support for virtual routing and forwarding (VRF) interfaces.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/375
2020-01-14 10:31:41 +01:00
Beniamino Galvani
667568d1b2 core,libnm: add VRF support
Add VRF support to the daemon. When the device we are activating is a
VRF or a VRF's slave, put routes in the table specified by the VRF
connection.

Also, introduce a VRF device type in libnm.
2020-01-14 09:51:56 +01:00
Beniamino Galvani
7c73c6a038 platform: add VRF support
Add support for creating and parsing VRF links.
2020-01-14 09:49:01 +01:00
Beniamino Galvani
89d387f782 ifcfg-rh: add support for VRF slaves
Even if the ifcfg-rh plugin doesn't support VRF connections, it must
be able to read and write other connection types that have a VRF
master.
2020-01-14 09:49:01 +01:00
Beniamino Galvani
f4ced16791 libnm-core,cli: add VRF setting
Add new VRF setting and connection types to libnm-core and support
them in nmcli.
2020-01-14 09:49:01 +01:00
Thomas Haller
56e91b11a2 all: merge branch 'th/unix-fd-source'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/378
2020-01-13 15:49:27 +01:00
Thomas Haller
5af17d80f3 session-monitor: don't use GIOChannel to watch plain file descriptor 2020-01-13 15:46:04 +01:00
Thomas Haller
cc1822d783 lndp: don't use GIOChannel to watch plain file descriptor for socket 2020-01-13 15:46:04 +01:00
Thomas Haller
7848c165a1 platform: don't use GIOChannel to watch plain file descriptor for netlink socket 2020-01-13 15:46:04 +01:00
Thomas Haller
e832c478b0 acd: don't use GIOChannel to watch plain file descriptor for event fd 2020-01-13 15:46:04 +01:00
Thomas Haller
4b46e3a5fa dhcp/nettools: don't use GIOChannel to watch plain file descriptor for event fd 2020-01-13 15:46:04 +01:00
Thomas Haller
e4ab27722a bluez: don't use GIOChannel to watch plain file descriptor for rfcomm 2020-01-13 15:46:04 +01:00
Thomas Haller
c15411d7c9 bluez: don't use GIOChannel to watch plain file descriptor
Also, don't track the GSource via the guint ID but the full
GSource pointer.
2020-01-13 15:46:04 +01:00
Thomas Haller
cccfeb3891 cli: don't use GIOChannel to watch plain file descriptor for nmc_readline_helper() 2020-01-13 15:46:04 +01:00
Thomas Haller
9cc6d3a26d tui: don't use GIOChannel to watch plain file descriptor for key press 2020-01-13 15:46:04 +01:00
Thomas Haller
a3b29b06dc shared/udev: don't use GIOChannel to watch plain file descriptor 2020-01-13 15:46:04 +01:00
Thomas Haller
e90c1de868 all: use nm_g_unix_fd_source_new() instead of g_unix_fd_source_new()
Its source-func argument has the right signature. Otherwise, this is an
easy to make mistake.
2020-01-13 15:46:04 +01:00
Thomas Haller
421256073b shared: add nm_g_unix_fd_source_new() helper 2020-01-13 15:46:04 +01:00
Thomas Haller
4972ba0957 platform: use NM_MAKE_STRV() in NMLinuxPlatform:constucted() 2020-01-13 15:46:04 +01:00
Thomas Haller
78c4bc58c7 shared: use G_SOURCE_FUNC() macro in "shared/nm-test-utils-impl.c" 2020-01-13 15:46:04 +01:00
Thomas Haller
38323216f5 tui: fix signature for nmt_newt_form_keypress_callback() callback
Fixes: 3bda3fb60c ('nmtui: initial import of nmtui')
2020-01-13 15:46:04 +01:00
Thomas Haller
d63cd26e60 shared: improve nm_free_secret() to clear entire memory buffer
The purpose is to clear the entire available buffer, not only
up to the first '\0'. This is done, because otherwise we might
leak sensitive data that happens to be after the first '\0',
or we might give away the length of the secrets.

Of course, those are very (very) minor concerns. But avoiding them is
easy enough.
2020-01-09 17:45:01 +01:00
Yuri Chornoivan
1c7ea45aaa po: update Ukrainian (uk) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/388
2020-01-09 14:09:20 +01:00
Thomas Haller
e1a76a201a license: add Beniamino Galvani to RELICENSE.md
https://mail.gnome.org/archives/networkmanager-list/2020-January/msg00011.html
2020-01-09 14:07:46 +01:00
Beniamino Galvani
3a9b069c41 n-dhcp4: use C_CLAMP() macro instead of c_clamp()
The latter requires __auto_type which is not available in GCC versions
older than 4.9. Fix the following compile error on RHEL 7.8:

 CC       src/src_libNetworkManagerBase_la-NetworkManagerUtils.lo
 shared/n-dhcp4/src/n-dhcp4-c-probe.c: In function 'n_dhcp4_client_probe_transition_nak':
 shared/n-dhcp4/src/n-dhcp4-c-probe.c:1008:17: error: unknown type name '__auto_type'
                  probe->ns_nak_restart_delay = c_clamp(probe->ns_nak_restart_delay * 2,
                  ^
 shared/n-dhcp4/src/n-dhcp4-c-probe.c:1008:17: error: unknown type name '__auto_type'
 shared/n-dhcp4/src/n-dhcp4-c-probe.c:1008:17: error: unknown type name '__auto_type'

Fixes: 218782a9a3 ('n-dhcp4: restart the transaction after a NAK')
2020-01-09 13:19:54 +01:00
Thomas Haller
d9451fcc0b license: add RELICENSE.md file to track consent/disapproval for relicensing under LGPL-2.1+ 2020-01-09 11:34:55 +01:00
Thomas Haller
5fc1b1a681 platform,device: merge branch 'th/device-ip-tunnel-mac'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/377
2020-01-09 10:42:45 +01:00
Thomas Haller
a90397b963 core: set MAC address for IP tunnels when creating device
There is however a serious issue currently: when NetworkManager creates
virtual devices, it starts from an unrealized NMDevice, creates the
netdev device, realizes the device, and transitions through states
UNMANAGED and DISCONNECTED. Thereby, the state of NMDevice gets cleared
again. That means, if the profile has "connection.stable-id=${RANDOM}"
and "ethernet.cloned-mac-address=stable", then we will first set a
random MAC address when creating the device. Then, the NMDevice
transitions through UNMANAGED state, forgets the MAC address it
generated and creates a new MAC address in stage 1. This should be
fixed by better handling unrealized devices. It also affects all
software devices that set the MAC address upon creation of the
interfaces (as they all should).
2020-01-09 10:42:32 +01:00
Thomas Haller
81d83b9e00 platform: support setting MAC address during nm_platform_link_gre_add()
We should set the MAC address of devices early on, and not later.
2020-01-09 10:42:32 +01:00
Thomas Haller
cb4093fc8f platform: drop NMPlatformLnkMacvtap typedef
In several cases, the layer 2 and layer 3 type are very similar, also from
kernel's point of view. For example, "gre"/"gretap" and "ip6tnl"/"ip6gre"/"ip6gretap"
and "macvlan"/"macvtap".

While it makes sense that these have different NMLinkType types
(NM_LINK_TYPE_MACV{LAN,TAP}) and different NMPObject types
(NMPObjectLnkMacv{lan,tap}), it makes less sense that they have
different NMPlatformLnk* structs.

Remove the NMPlatformLnkMacvtap typedef. A typedef does not make things simpler,
but is rather confusing. Because several API that we would usually have, does
not exist for the typedef (e.g. there is no nm_platform_lnk_macvtap_to_string()).

Note that we also don't have such a typedef for NMPlatformLnkIp6Tnl
and NMPlatformLnkGre, which has the same ambiguity between the link type
and the struct with the data.
2020-01-09 10:42:32 +01:00
Thomas Haller
f30ae56608 platform: implement link_macvlan_add via nm_platform_link_add() 2020-01-09 10:42:32 +01:00
Thomas Haller
1ffdca6331 platform: implement link_macsec_add via nm_platform_link_add() 2020-01-09 10:42:32 +01:00
Thomas Haller
14b5627633 platform: implement link_ipip_add via nm_platform_link_add() 2020-01-09 10:42:32 +01:00
Thomas Haller
16fd8ddf95 platform: implement link_ip6gre_add via nm_platform_link_add() 2020-01-09 10:42:31 +01:00