Commit graph

23886 commits

Author SHA1 Message Date
Beniamino Galvani
ad17cfff24 ovs: fix memory leak
(cherry picked from commit 508c7679cf)
2019-11-20 11:10:53 +01:00
Beniamino Galvani
a5667952db build: meson: fix dependency to gdbus generated headers
libnm has a dependency on 'libnmdbus_dep', which contains 'link_with:
libnmdbus'. This however only enforces that libnm is linked after the
libnmdbus static library is built; it doesn't give any guarantees
about the compilation phase.

We need to make libnm compilation depend on the generated header
files. The output of 'gnome.gdbus_codegen' is an array with the header
file in the second position; use it to add a proper
dependency. Unfortunately this works only with meson >= 0.46.

In the future libnm will no longer use gdbus generated code and this
dependency will not be needed anymore.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/286
(cherry picked from commit a59a8aa033)
2019-11-20 10:22:27 +01:00
Thomas Haller
8b4f7a9eb6 libnm: fix annotation for out arguments of nm_bridge_vlan_get_vid_range()
Workaround:

def br_get_vid_range(bridge_vlan):
    try:
        (is_range, vid_start, vid_end) = bridge_vlan.get_vid_range()
    except TypeError as e:
        s = bridge_vlan.to_str()
        s = s.split(' ', 1)
        s = s[0]
        s = s.split('-', 2)
        vid_start = int(s[0])
        if len(s) == 2:
            vid_end = int(s[1])
        else:
            vid_end = vid_start
        is_range = (vid_start == vid_end)
    return (vid_start, vid_end)

Fixes: da204257b1 ('all: support bridge vlan ranges')
(cherry picked from commit c68c199eda)
2019-11-19 16:17:57 +01:00
Lubomir Rintel
e51a4ae806 initrd/tests: put the bootif=no next to the other bootif tests
A cosmetical improvement.

(cherry picked from commit cdfa3d3428)
2019-11-18 13:44:06 +01:00
Lubomir Rintel
964f8aab6d dracut/cmdline: don't combine BOOTIF with on with a name or a MAC address
This fixes the dracut test suite.

(cherry picked from commit 45548bc670)
2019-11-18 13:44:06 +01:00
Lubomir Rintel
82283a50b3 utils: make nm_utils_hwaddr_matches() accept NULL
This essentially aligns the implementation with the documentation.

It is also rather useful, since it allows us to use the value returned
by nm_setting_wired_get_mac_address() directly, and that one can indeed
be NULL.

(cherry picked from commit 62919bab43)
2019-11-18 13:44:06 +01:00
Lubomir Rintel
d240c14478 initrd/cmdline: split add_conn() from get_conn()
No change in behavior. Will be useful when we'll want to unconditionally
add new connection without the matching behavior.

(cherry picked from commit e1a068e93c)
2019-11-18 13:44:06 +01:00
Lubomir Rintel
b03a632c3d initrd: don't overwrite just any connection's name with bootdev= argument
It is really not clear what the user could have meant by specifying a
bootdev= argument, and we deal with it just by ensuring a device with
that name whould come up.

We therefore pick a default connection if there's one (that is a
conneciton that we create if the device name is unspecified, as in
"ip=auto"), otherwise we create a new one.

(cherry picked from commit 30f8154319)
2019-11-18 13:44:06 +01:00
Lubomir Rintel
d7101d8342 initrd: default bridge name to br0 as opposed to bridge0
For compatibility. The dracut.cmdline(7) manual says:

  Bridge without parameters assumes bridge=br0:eth0

(cherry picked from commit f581756af6)
2019-11-18 13:44:06 +01:00
Lubomir Rintel
e19138b94c manager: assume DHCP if we see a lease on taking over an initramfs connection
In general, we aren't really able to tell, but when we see a lease file
we're pretty sure that DHCP is what was going on.

https://bugzilla.redhat.com/show_bug.cgi?id=1771792
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/335

Fixes: f2fe6c03ee ('manager: don't treat the initramfs-configured DHCP connections as generated')
(cherry picked from commit 7a84388a9b)
2019-11-18 13:44:06 +01:00
Lubomir Rintel
3a133e2826 dhcp/nettools: add siaddr to lease options
This is so that we end up with a next-server option analogous to what
dhclient helper sends us. Dracut uses this for networked boots.

(cherry picked from commit c1104a5cc2)
2019-11-18 13:44:06 +01:00
Lubomir Rintel
435dcc3dc6 n-dhcp4/lease: expose the server IP address
This is useful for network booting.

https://github.com/nettools/n-dhcp4/pull/7
(cherry picked from commit edda3d3606)
2019-11-18 13:44:06 +01:00
Lubomir Rintel
68841b76a6 systemd: add siaddr to lease options
This is so that we end up with a next-server option analogous to what
dhclient helper sends us. Dracut uses this for networked boots.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/329
(cherry picked from commit e475ac7567)
2019-11-18 13:44:06 +01:00
Frank Deng
e1acd336bb utils: alow matching ipv6 new method 'disable'
Make nm_utils_match_connection() match 'ignore' connections with
connections that are generated to have ipv6.method of 'disable'.
Perhaps the ipv6 was disabled globally.

[lkundrak@v3.sk: commit message fixup]

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/336
(cherry picked from commit 87c9583282)
2019-11-18 13:44:06 +01:00
Beniamino Galvani
b35fb49a28 merge: branch 'bg/ipv6-accept-ra-rh1734470'
https://bugzilla.redhat.com/show_bug.cgi?id=1734470

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/247
(cherry picked from commit 6cf28fe2c0)
2019-11-15 16:18:30 +01:00
Beniamino Galvani
d1c7c381e4 ipv6: disable kernel handling of RAs (accept_ra)
With accept_ra set to 1, kernel sends its own router solicitation
messages and parses the advertisements. This duplicates what NM
already does in userspace and has unwanted consequences like [1] and
[2].

The only reason why accept_ra was re-enabled in the past was to apply
RA parameters like ReachableTime and RetransTimer [3]; but now NM
supports them and so accept_ra can be turned off again.

Also, note that previously the option was set in
addrconf6_start_with_link_ready(), and so this was done only when the
method was 'auto'. Instead, now we clear it for all methods except
'ignore'.

[1] https://mail.gnome.org/archives/networkmanager-list/2019-June/msg00027.html
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1734470
[3] https://bugzilla.redhat.com/show_bug.cgi?id=1068673

(cherry picked from commit 5a534529e2)
2019-11-15 16:17:41 +01:00
Beniamino Galvani
08fdea122d ipv6: set neighbor parameters from RAs
IPv6 router advertisement messages contain the following parameters
(RFC 4861):

 - Reachable time: 32-bit unsigned integer.  The time, in
   milliseconds, that a node assumes a neighbor is reachable after
   having received a reachability confirmation.  Used by the Neighbor
   Unreachability Detection algorithm.  A value of zero means
   unspecified (by this router).

 - Retrans Timer: 32-bit unsigned integer.  The time, in milliseconds,
   between retransmitted Neighbor Solicitation messages.  Used by
   address resolution and the Neighbor Unreachability Detection
   algorithm.   A value of zero means unspecified (by this router).

Currently NM ignores them; however, since it leaves accept_ra=1, the
kernel parses RAs and applies those parameters for us [1].

In the next commit kernel handling of RAs will be disabled, so let NM
set those neighbor-related parameters.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/ipv6/ndisc.c?h=v5.2#n1353

(cherry picked from commit 5f0c6f8d3b)
2019-11-15 16:17:33 +01:00
Beniamino Galvani
188911ae7d device: merge branch 'bg/parent-mtu-rh1723690-part1'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/273
(cherry picked from commit facfc94744)
2019-11-11 10:58:21 +01:00
Beniamino Galvani
49857ed279 device: fix setting MTU from connection when limited by parent
We try to set only one time the MTU from the connection to not
interfere with manual user changes.

If at some point the parent interface changes temporarily MTU to a
lower value (for example, because the connection was reactivated), the
kernel will also lower the MTU on child interface and we will not
update it ever again.

Add a workaround to this. If we detect that the MTU we want to set
from connection is higher that the allowed one, go into a state where
we follow the parent MTU until it is possible to set again the desired
MTU. This is a bit ugly, but I can't think of any nicer way to do it.

https://bugzilla.redhat.com/show_bug.cgi?id=1751079
(cherry picked from commit ec28f5b343)
2019-11-11 10:56:43 +01:00
Beniamino Galvani
9133ba9003 macvlan: update MTU according to parent's one
(cherry picked from commit 4875745bc0)
2019-11-11 10:56:42 +01:00
Beniamino Galvani
c58ce8945d macsec: update MTU according to parent's one
A MACsec connection doesn't have an ordering dependency with its
parent connection and so it's possible that the parent gets activated
later and sets a greater MTU than the original one.

It is reasonable and useful to keep the MACsec MTU configured by
default as the maximum allowed by the parent interface, that is the
parent MTU minus the encapsulation overhead (32). The user can of
course override this by setting an explicit value in the
connection. We already do something similar for VLANs.

https://bugzilla.redhat.com/show_bug.cgi?id=1723690
(cherry picked from commit 438a0a9ad5)
2019-11-11 10:56:39 +01:00
Beniamino Galvani
73597864bb device: introduce generic function to inherit MTU from parent
Introduce a generic function to set a MTU based on parent's one. Also
define a device-specific @mtu_parent_delta value that specifies the
difference from parent MTU that should be set by default. For VLAN it
is zero but other interface types (for example MACsec) require a
positive value due to encapsulation overhead.

(cherry picked from commit 5cf57f4522)
2019-11-11 10:56:36 +01:00
Beniamino Galvani
37720d856a device: expand comment on MTU selection
(cherry picked from commit 6455a4e528)
2019-11-11 10:56:34 +01:00
Beniamino Galvani
f35783c3fb device: reset ip6_mtu on cleanup
ip6_mtu contains the MTU received through IPv6 autoconfiguration; it
should be reset when the connection is deactivated.

https://bugzilla.redhat.com/show_bug.cgi?id=1753128
(cherry picked from commit 353c7c95c1)
2019-11-11 10:50:13 +01:00
Beniamino Galvani
3478b515e5 release: bump version to 1.20.7 (development) 2019-11-06 17:34:33 +01:00
Beniamino Galvani
7910cdfe5a release: bump version to 1.20.6 2019-11-06 17:34:33 +01:00
Beniamino Galvani
2745798198 release: update NEWS 2019-11-06 17:34:33 +01:00
Thomas Haller
9ef4137826 libnm: fix handling "q" (uint16) property types in libnm
NMDeviceVxlan has some "q" type properties. They were not handled:

    $ G_MESSAGES_DEBUG=all PAGER= LIBNM_GLIB_DEBUG=properties-changed nmcli 2>&1 | grep "couldn't be set from D-Bus type"
    libnm-Message: 10:44:04.538: demarshal_generic: NMDeviceVxlan:dst-port (type guint) couldn't be set from D-Bus type q.
    libnm-Message: 10:44:04.538: demarshal_generic: NMDeviceVxlan:src-port-max (type guint) couldn't be set from D-Bus type q.
    libnm-Message: 10:44:04.538: demarshal_generic: NMDeviceVxlan:src-port-min (type guint) couldn't be set from D-Bus type q.
    libnm-Message: 10:44:04.539: demarshal_generic: NMDeviceWireGuard:listen-port (type guint) couldn't be set from D-Bus type q.

(cherry picked from commit e2dac63de6)
2019-11-06 17:30:58 +01:00
Beniamino Galvani
c36da8b990 acd: poll the acd fd after starting the announcements
In nm_acd_manager_announce_addresses() we should not only start the
probes but also add the acd file descriptor to the main loop.
Otherwise, a timer is armed to send the announcements but it never
fires and no announcements are sent.

Fixes: d9a4b59c18 ('acd: adapt NM code and build options')

https://bugzilla.redhat.com/show_bug.cgi?id=1767681
(cherry picked from commit 14992ab9cd)
2019-11-06 16:39:29 +01:00
Beniamino Galvani
8426a2398a merge: branch 'bg/802-1x-optional'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/249
https://bugzilla.redhat.com/show_bug.cgi?id=1698532
(cherry picked from commit 495ae4a676)
2019-11-06 11:48:36 +01:00
Beniamino Galvani
91ea7737fd ethernet: honor the 802-1x.optional property
If the 802.1X authentication fails and 802-1x.optional is set,
continue with activation. In this case, subscribe to the auth-state
supplicant property so that any dynamic IP method can be restarted
when the authentication succeeds. This is because upon authentication
the switch could have changed the VLAN we are connected to.

(cherry picked from commit 8afce75bf3)
2019-11-06 11:46:05 +01:00
Beniamino Galvani
90671a30b7 all: add 802-1x.optional property
Introduce a 802-1x.optional boolean property that can be used to
succeed the connection even after an authentication timeout or
failure.

(cherry picked from commit 8763e6da9c)
2019-11-06 11:46:04 +01:00
Beniamino Galvani
2c9912d812 supplicant: export authentication state
Add a property to the supplicant to indicate the current state of the
authentication process.

(cherry picked from commit 5b4f4a4c30)
2019-11-06 11:46:02 +01:00
Thomas Haller
e59f6f593f device/trivial: rename local variable for device in "nm-device-{ethernet,macvlan}.c"
This variable is commonly called "device", not "dev". Rename.

(cherry picked from commit f42ced162f)
2019-11-06 11:46:00 +01:00
Beniamino Galvani
cf557bf06f settings: fix updating agent-owned VPN secrets
property_to_dbus() returns NULL when called with
NM_CONNECTION_SERIALIZE_WITH_SECRETS_AGENT_OWNED and the property is
not an agent-owned secrets. The function doesn't handle VPN secrets
correctly, since they are all stored as a hash in the vpn.secrets
property and the flag for each of them is a matching '*-flags' key in
the vpn.data property. VPN secrets must be handled differently; do it
in the VPN setting to_dbus_fcn() function.

Fixes: 71928a3e5c ('settings: avoid cloning the connection to maintain agent-owned secrets')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/230
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/280
(cherry picked from commit 43b7e66948)
2019-11-05 14:34:05 +01:00
Lubomir Rintel
ee2b37e714 merge: branch 'sharkcz/s390-initrd'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/317

(cherry picked from commit 8eb20013ab)
2019-11-04 21:42:09 +01:00
Lubomir Rintel
4c7d12cb29 initrd/tests: test that we generate the s390 interface names correctly
(cherry picked from commit 927ae6d927)
2019-11-04 16:24:42 +01:00
Dan Horák
56026dd3dd initrd: handle rd.znet with legacy interface names
Handle rd.znet with legacy interface names too, the index for eth or ctc
corresponds to the position on the command line.

(cherry picked from commit 22e388d90e)
2019-11-04 16:24:40 +01:00
Dan Horák
72fcf35cb6 initrd: prepare interface in rd.znet only if persistent interface names are enabled
When processing the rd.znet option set the interface name only in case when
the persistent interface names feature isn't disabled via net.ifnames=0

[lkundrak@v3.sk: minor tweaks to the net.ifnames=0 parsing]

(cherry picked from commit c7423dca89)
2019-11-04 16:24:39 +01:00
Dan Horák
31d44a28e1 initrd/tests: use a valid combination of device and interface name for testing
(cherry picked from commit c27f5030e9)
2019-11-04 16:24:39 +01:00
Dan Horák
deff651704 initrd: use proper interface when adding s390 specific details
The current solution for s390 specific details relies on an interface to
exist before adding the s390 details. It means the ip= option must precede
the rd.znet= option. Also only a single interface can be configured. With
this change the s390 details are put to the right interface and properly
named interface is created if it hasn't existed yet.

(cherry picked from commit adcc52c3da)
2019-11-04 16:24:38 +01:00
Lubomir Rintel
9e6706edb7 iwd: unbreak iwd-1.0
The upstream apparently thought it's a great idea to change the agent
manager path. This fixes things for those unfortunate enough to run
IWD.

(cherry picked from commit 186d22a963)
2019-11-03 13:06:04 +01:00
Lubomir Rintel
8a668d0983 iwd: add some missing error handling
g_dbus_object_manager_get_interface() can happily return NULL and we
need to check for that.

(cherry picked from commit 59923ad85d)
2019-11-03 13:06:03 +01:00
worldofpeace
4c11364201 build: add PPPD_PATH to config.h.meson
Without this using -Dpppd= was completely broken.

First observed in NixOS [0]

[0]: https://github.com/NixOS/nixpkgs/issues/72330

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/323
(cherry picked from commit e1ead6fa98)
2019-11-01 07:35:24 +01:00
Lubomir Rintel
cab2e4fc96 libnm/utils: fix build
We don't have NM_WIFI_DEVICE_CAP_IBSS_RSN in 1.20.x series. Don't allow
SAE on ad-hoc networks, we don't allow WPA2 in 1.20.x either.
2019-10-11 10:18:38 +02:00
Beniamino Galvani
58ffded2d0 dhcp: include conditionals from existing dhclient configuration
Since commit 159ff23268 ('dhcp/dhclient-utils: skip over
dhclient.conf blocks') we skip blocks enclosed in lines containing '{'
and '}' because NM should ignore 'lease', 'alias' and other
declarations. However, conditional statements seem useful and should
not be skipped.

https://bugzilla.redhat.com/show_bug.cgi?id=1758550
(cherry picked from commit b58e4d311d)
2019-10-10 14:53:01 +02:00
Beniamino Galvani
299fbc0888 supplicant: allow PMF with SAE
PMF can be used with SAE, allow it. Actually, it is required according
to WPA3 specifications but there are implementations that don't
require it (hostapd can be configured in a such way); so let's not
make it mandatory for WPA3.

Fixes: 6640fb4b36 ('supplicant: add support for SAE key management')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/257
(cherry picked from commit e36c297fd8)
2019-10-09 13:09:42 +02:00
Lubomir Rintel
2c4195bb74 libnm/utils: add SAE security type
https://github.com/NetworkManager/NetworkManager/pull/354
(cherry picked from commit 0ff1cb556c)
2019-10-09 12:48:45 +02:00
Lubomir Rintel
fb874e6cda bluetooth: don't set the ifindex after the device has been activated
The Bluetooth DUN device's NMModem would signal the reset of ifindex to zero
when it's disconnected and the NMDeviceBt would accordingly update the
bluetooth device's ip ifindex. This is not okay since commit ab4578302d
('device: refactor nm_device_set_ip_ifindex() and set_ip_iface()') which,
although claiming to be a refactoring, made such use of
nm_device_set_ip_ifindex() illegal. Resetting the ifindex is anyway not
necessary, since it's taken care of _cleanup_generic_post().

Let's leave the ifindex alone once the device is activated, in a manner
analogous to what NMDeviceModem.

Fixes: ab4578302d ('device: refactor nm_device_set_ip_ifindex() and set_ip_iface()')
Fixes: 78ca2a70c7 ('device: don't set invalid ip-iface'):
(cherry picked from commit a5ca504b5b)
2019-10-09 12:48:29 +02:00
Lubomir Rintel
56036d85ec build: regenerate config-extra.h if configure was re-run with different arguments
(cherry picked from commit 140619854e)
2019-10-09 12:48:22 +02:00