Commit Graph

27607 Commits

Author SHA1 Message Date
Thomas Haller
3ee35a3906 core: fix warning about unused variable in _l3_acd_data_add_all()
src/nm-l3cfg.c: In function _l3_acd_data_add_all:
    src/nm-l3cfg.c:1557:14: error: unused variable i [-Werror=unused-variable]
     1557 |     guint    i;
          |              ^
2020-12-03 14:54:15 +01:00
Thomas Haller
952e3ebbe4 release: bump version to 1.29.4 (development) 2020-12-03 13:38:19 +01:00
Thomas Haller
8ff4625db9 man: better explain default connection settings in man NetworkManager.conf 2020-12-03 08:44:26 +01:00
Beniamino Galvani
5b9479a728 policy: fix hostname lookup from DNS
Fixes: 09c8387114 ('policy: use the hostname setting')
2020-12-02 17:33:45 +01:00
Fernando Fernandez Mancera
fda6b702ba veth: peer property is D-Bus object path not a string
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2020-12-01 16:45:36 +01:00
Beniamino Galvani
dedcba61ef dns: sd-resolved: fix hash table iteration
g_hash_table_iter_next() wants a (gpointer *), not an (int *).

Fixes: f70ee67058 ('dns: sd-resolved: reset interface configuration on deactivation')
(cherry picked from commit 526b484be1)
2020-11-30 23:04:37 +01:00
Beniamino Galvani
526b484be1 dns: sd-resolved: fix hash table iteration
g_hash_table_iter_next() wants a (gpointer *), not an (int *).

Fixes: f70ee67058 ('dns: sd-resolved: reset interface configuration on deactivation')
2020-11-30 22:36:55 +01:00
Beniamino Galvani
d0df9bf0bd manager: return most recent connection in active_connection_find()
When a connection is reactivated, there could be two active
connections tracked by the manager: the deactivating one and the new
one. Ensure that we first return the most recent one so that slaves
will pick the right master.

Fixes-test: @iptunnel_gretap_doc_procedure
Fixes: dc6ec6ce7b ('core: reverse the order of active connections in the manager')
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/697
2020-11-30 14:43:22 +01:00
Yuri Chornoivan
587a1949b2 po: update Ukrainian (uk) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/698
2020-11-30 14:38:45 +01:00
Beniamino Galvani
b24ec6af04 release: bump version to 1.29.3 (development) 2020-11-27 15:33:07 +01:00
Thomas Haller
e749a1a5db dns: merge branch 'th/dns-resolved-default-route'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/694

(cherry picked from commit bb9dcde97f)
2020-11-27 10:54:46 +01:00
Thomas Haller
c182984469 dns: detect support of systemd-resolved's SetLinkDefaultRoute() and avoid it
We now always use SetLinkDefaultRoute(), but that API was only added in
systemd v240 ([1]).

We could just always call the non-existing method, and ignore the
error. However, that feels ugly. Would systemd-resolved log warnings
about that? Should we suppress all messages about that failure (not
good for debugging).

Instead, make an effort to detect support of the function, and avoid
calling it. That is significantly more complicated than just always
calling the method and not care.

Note that even if systemd-resolved does not support SetLinkDefaultRoute(),
we cannot do anything smart about that. We would simply rely on
systemd-resolved (hopefully) doing the right thing automatically.
That's better and simpler than explicitly adding a "~." domain in
the fallback case.

Also, detecting support is straight forward in the common case, where
there is either success or a clear "org.freedesktop.DBus.Error.UnknownMethod"
error. In cases where there is any other failure, we don't really know.
In that case, we keep trying to use the API under the assumption that
it should work.

[1] https://github.com/systemd/systemd/commit/7 ## 7673795dcf5797491e7f785cbf5077d29a15db4

(cherry picked from commit 44ebb99cfa)
2020-11-27 10:54:45 +01:00
Thomas Haller
3f16b988a4 dns: preserve DNS settings for systemd-resolved to resend
When the DNS settings change, we update the request_queue_lst_head list,
with all the requests we want to send.

Then, send_updates() will try to send it. It might not do it right away,
if resolved is not on the bus or the D-Bus connection is not fully inialized
(meaning, we don't know the name owner yet). In those cases, we would
keep the list of requests, and send them later.

However, when sending them, we would also forget about the configuration.

That means, if you restart systemd-resolved, then the daemon drops off
the bus and reappears. I think that systemd-resolved in fact persists
the configuration during restart. So, usually the settings are still the
same after restart. However, we should do better here: if the service
appears, we should send the settings again.

This means to not forget the requests after we send them once -- at
least, until a new update replaces them.

(cherry picked from commit 4fc44952f7)
2020-11-27 10:54:45 +01:00
Thomas Haller
3cb7b3a8a2 dns: minor cleanup of call_done() in "nm-dns-systemd-resolved.c"
(cherry picked from commit 42d47d1cd7)
2020-11-27 10:54:45 +01:00
Thomas Haller
4401c6d567 dns: cleanup RequestItem and track ifindex and self parameter
We will need these changes next:

- add "self" and "ifindex" fields to RequestItem struct. We will
  pass on these structs are user-data for the callbacks, so that
  we afterwards know which request completed.

- add DBUS_OP_SET_LINK_DEFAULT_ROUTE global variable. We don't
  clone the "operation" string but use string literals. However,
  string literals are not guaranteed to be deduplicated, so we
  should only compare them with strcmp(). The static variable
  avoids this: we can use pointer equality to compare it.
  This will be used next.

(cherry picked from commit 8af6647cda)
2020-11-27 10:54:45 +01:00
Thomas Haller
bb9dcde97f dns: merge branch 'th/dns-resolved-default-route'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/694
2020-11-27 10:47:05 +01:00
Thomas Haller
44ebb99cfa dns: detect support of systemd-resolved's SetLinkDefaultRoute() and avoid it
We now always use SetLinkDefaultRoute(), but that API was only added in
systemd v240 ([1]).

We could just always call the non-existing method, and ignore the
error. However, that feels ugly. Would systemd-resolved log warnings
about that? Should we suppress all messages about that failure (not
good for debugging).

Instead, make an effort to detect support of the function, and avoid
calling it. That is significantly more complicated than just always
calling the method and not care.

Note that even if systemd-resolved does not support SetLinkDefaultRoute(),
we cannot do anything smart about that. We would simply rely on
systemd-resolved (hopefully) doing the right thing automatically.
That's better and simpler than explicitly adding a "~." domain in
the fallback case.

Also, detecting support is straight forward in the common case, where
there is either success or a clear "org.freedesktop.DBus.Error.UnknownMethod"
error. In cases where there is any other failure, we don't really know.
In that case, we keep trying to use the API under the assumption that
it should work.

[1] https://github.com/systemd/systemd/commit/7 ## 7673795dcf5797491e7f785cbf5077d29a15db4
2020-11-27 10:46:42 +01:00
Thomas Haller
4fc44952f7 dns: preserve DNS settings for systemd-resolved to resend
When the DNS settings change, we update the request_queue_lst_head list,
with all the requests we want to send.

Then, send_updates() will try to send it. It might not do it right away,
if resolved is not on the bus or the D-Bus connection is not fully inialized
(meaning, we don't know the name owner yet). In those cases, we would
keep the list of requests, and send them later.

However, when sending them, we would also forget about the configuration.

That means, if you restart systemd-resolved, then the daemon drops off
the bus and reappears. I think that systemd-resolved in fact persists
the configuration during restart. So, usually the settings are still the
same after restart. However, we should do better here: if the service
appears, we should send the settings again.

This means to not forget the requests after we send them once -- at
least, until a new update replaces them.
2020-11-27 10:46:42 +01:00
Thomas Haller
42d47d1cd7 dns: minor cleanup of call_done() in "nm-dns-systemd-resolved.c" 2020-11-27 10:46:42 +01:00
Thomas Haller
8af6647cda dns: cleanup RequestItem and track ifindex and self parameter
We will need these changes next:

- add "self" and "ifindex" fields to RequestItem struct. We will
  pass on these structs are user-data for the callbacks, so that
  we afterwards know which request completed.

- add DBUS_OP_SET_LINK_DEFAULT_ROUTE global variable. We don't
  clone the "operation" string but use string literals. However,
  string literals are not guaranteed to be deduplicated, so we
  should only compare them with strcmp(). The static variable
  avoids this: we can use pointer equality to compare it.
  This will be used next.
2020-11-27 10:26:11 +01:00
Thomas Haller
d80eee9991 veth: merge branch 'ffmancera:veth_support'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/682
2020-11-27 10:12:47 +01:00
Fernando Fernandez Mancera
cd0cf9229d veth: add support to configure veth interfaces
NetworkManager is now able to configure veth interfaces throught the
NMSettingVeth. Veth interfaces only have "peer" property.

In order to support Veth interfaces in NetworkManager the design need
to pass the following requirements:

 * Veth setting only has "peer" attribute.
 * Ethernet profiles must be applicable to Veth interfaces.
 * When creating a veth interface, the peer will be managed by
   NetworkManager but will not have a profile.
 * Veth connection can reapply only if the peer has not been modified.
 * In order to modify the veth peer, NetworkManager must deactivate the
   connection and create a new one with peer modified.

In general, it should support the basis of veth interfaces but without
breaking any existing feature or use case. The users that are using veth
interfaces as ethernet should not notice anything changed unless they
specified the veth peer setting.

Creating a Veth interface in NetworkManager is useful even without the
support for namespaces for some use cases, e.g "connecting one side of
the veth to an OVS bridge and the other side to a Linux bridge" this is
done when using OVN kubernetes [1][2]. In addition, it would provide
persistent configuration and rollback support for Veth interfaces.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1885605
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1894139

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2020-11-27 10:12:36 +01:00
Fernando Fernandez Mancera
de1d849f17 ethernet: define NMDeviceEthernet on nm-libnm-utils.h
NMDeviceEthernet will be used to support Veth interfaces. Therefore, it
needs to be defined on libnm/nm-libnm-utils.h

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2020-11-27 10:12:36 +01:00
Thomas Haller
3b1ae89d2f core: recognize "wifi.scan-generate-mac-address-mask" as valid "NetworkManager.conf" option
Fixes: 32f4abe90b ('config: warn about unknown keys in config files')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/595
(cherry picked from commit d615b902d8)
2020-11-27 09:58:45 +01:00
Thomas Haller
d615b902d8 core: recognize "wifi.scan-generate-mac-address-mask" as valid "NetworkManager.conf" option
Fixes: 32f4abe90b ('config: warn about unknown keys in config files')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/595
2020-11-27 09:55:01 +01:00
Thomas Haller
e68e5c0a4c contrib/rpm: on rhel-9 let a test failure or compiler warning fail the build
We always run the unit tests during package build and also enable all compiler
warnings. However, by default we used to ignore failures. That is, because
rebuilding a package on another, future distro led to frequent, annoying build
failures. Especially compiler warnings appear easily when using a
different compiler version.

The default mostly matters here when you want to build the package in
brew/koji, where you don't have a possibility to explicitly select the
build option.

Note that rpmdiff detects failures in the build log, and thus we usually
would not miss failures for builds we add to errata. Also, all our CI
tests build packages with a manner where they would not allow a failure
of the unit tests. So, we run these unit tests frequently and in a
manner where we notice a failure.

For rhel-9 builds, change the default here and let test failures and
compiler warnings be fatal to the build.
2020-11-26 18:31:46 +01:00
Beniamino Galvani
145fe0d82c ovs: merge branch 'bg/rh1899745'
https://bugzilla.redhat.com/show_bug.cgi?id=1899745
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/691

(cherry picked from commit e2ed707c87)
2020-11-26 18:00:40 +01:00
Beniamino Galvani
031583c1d3 ovs: avoid ovs error when same MAC is set on a local interface and bridge
If the same MAC address is set on both the bridge connection and the
interface connection, and the interface is local, NM currently sets
the hwaddr record in both Bridge and Interface ovsdb tables. As a
result, ovs complains with error:

  bridge|ERR|interface br0: ignoring mac in Interface record (use Bridge record to set local port's mac)

Avoid this error: if the bridge and interface MACs are the same, just
set the address in the Bridge table; if they are different, give a
more detailed warning and ignore the interface MAC.

https://bugzilla.redhat.com/show_bug.cgi?id=1899745
(cherry picked from commit c4beaac67b)
2020-11-26 18:00:40 +01:00
Beniamino Galvani
38d0c2f12b ovs: rename variable
@interface_is_internal is a bad name. The variable indicates whether
the interface is the local interface.

(cherry picked from commit e9e99b8677)
2020-11-26 18:00:40 +01:00
Beniamino Galvani
435d662669 initrd: fix parsing of ip= arguments with empty first token
The parser checks if the first token of an ip= argument is an IP
address to determine which of the two possible syntaxes is used:

 ip=<interface>:{dhcp|on|any|dhcp6|auto6}[:[<mtu>][:<macaddr>]]
 ip=<client-IP>:[<peer>]:<gateway-IP>:<netmask>:<client_hostname>:<interface>:{none|off|dhcp|on|any|dhcp6|auto6|ibft}[:[<mtu>][:<macaddr>]]

This works as long as the first token is not empty, which - according
to the dracut.cmdline man page - seems to be guaranteed.

However, the network-legacy dracut plugin accepts an empty interface
or client IP. Also, if a user needs DHCP and wants to specify a
hostname, the only possible syntax is:

 ip=::::<hostname>::dhcp

Change the parser to check the second token instead, similarly to what
the network-legacy module does [1].

[1] https://github.com/dracutdevs/dracut/blob/050/modules.d/40network/net-lib.sh#L490

https://bugzilla.redhat.com/show_bug.cgi?id=1900260
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/693
(cherry picked from commit b0c018830e)
2020-11-26 18:00:32 +01:00
Beniamino Galvani
e2ed707c87 ovs: merge branch 'bg/rh1899745'
https://bugzilla.redhat.com/show_bug.cgi?id=1899745
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/691
2020-11-26 17:54:33 +01:00
Beniamino Galvani
c4beaac67b ovs: avoid ovs error when same MAC is set on a local interface and bridge
If the same MAC address is set on both the bridge connection and the
interface connection, and the interface is local, NM currently sets
the hwaddr record in both Bridge and Interface ovsdb tables. As a
result, ovs complains with error:

  bridge|ERR|interface br0: ignoring mac in Interface record (use Bridge record to set local port's mac)

Avoid this error: if the bridge and interface MACs are the same, just
set the address in the Bridge table; if they are different, give a
more detailed warning and ignore the interface MAC.

https://bugzilla.redhat.com/show_bug.cgi?id=1899745
2020-11-26 17:54:22 +01:00
Beniamino Galvani
e9e99b8677 ovs: rename variable
@interface_is_internal is a bad name. The variable indicates whether
the interface is the local interface.
2020-11-26 17:45:26 +01:00
Beniamino Galvani
b0c018830e initrd: fix parsing of ip= arguments with empty first token
The parser checks if the first token of an ip= argument is an IP
address to determine which of the two possible syntaxes is used:

 ip=<interface>:{dhcp|on|any|dhcp6|auto6}[:[<mtu>][:<macaddr>]]
 ip=<client-IP>:[<peer>]:<gateway-IP>:<netmask>:<client_hostname>:<interface>:{none|off|dhcp|on|any|dhcp6|auto6|ibft}[:[<mtu>][:<macaddr>]]

This works as long as the first token is not empty, which - according
to the dracut.cmdline man page - seems to be guaranteed.

However, the network-legacy dracut plugin accepts an empty interface
or client IP. Also, if a user needs DHCP and wants to specify a
hostname, the only possible syntax is:

 ip=::::<hostname>::dhcp

Change the parser to check the second token instead, similarly to what
the network-legacy module does [1].

[1] https://github.com/dracutdevs/dracut/blob/050/modules.d/40network/net-lib.sh#L490

https://bugzilla.redhat.com/show_bug.cgi?id=1900260
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/693
2020-11-26 17:41:40 +01:00
Thomas Haller
c6fb949789 trivial: fix coding style
(cherry picked from commit e7d828f6a0)
2020-11-24 18:56:03 +01:00
Thomas Haller
e7d828f6a0 trivial: fix coding style 2020-11-24 18:51:58 +01:00
Thomas Haller
9960c8d727 gitlab-ci: add CentOS 7.9 and 8.2 images 2020-11-24 18:44:11 +01:00
Beniamino Galvani
ae453f0ae8 dns: fix setting systemd-resolved name servers for default route
If the interface is the DNS default route but has no domain, its name
servers were not sent to systemd-resolved. Fix this.

Fixes: ee9fab0361 ('dns: fix handling default routing domains with systemd-resolved')
(cherry picked from commit 195cbf3cee)
2020-11-24 18:29:23 +01:00
Beniamino Galvani
195cbf3cee dns: fix setting systemd-resolved name servers for default route
If the interface is the DNS default route but has no domain, its name
servers were not sent to systemd-resolved. Fix this.

Fixes: ee9fab0361 ('dns: fix handling default routing domains with systemd-resolved')
2020-11-24 17:55:37 +01:00
Thomas Haller
87749642e2 scripts: allow marking commits with "Ignore-Backport:" in "find-backports" script
"find-backports" searches commit messages of upstream branches for
"Fixes:" comments. Those will then be highlighted to be backported,
if the script determines that to be necessary.

"find-backports" also honors the "cherry picked from" comments, to detect when
a patch was already backported. That is thus a way to suppress reporting a
commit to be backported.

Add another way to flag commits so they don't need backporting. Via
"Ignore-Backport:" tag.

As "find-backports" also honors "refs/notes/bugs" notes, this can be used
like:

    git notes \
      --ref refs/notes/bugs \
      append \
      -m "Ignore-Backport: e""29f00fa0c69 ('NEWS: fix entry that is targeted for 1.30 instead of 1.28')" \
      2''3364aa8f3bd6b11e2ac9e30117eaabfe1f3a9f2
2020-11-24 12:30:06 +01:00
Beniamino Galvani
0f26529bb3 NEWS: move entry that was backported to 1.28 2020-11-24 11:59:25 +01:00
Beniamino Galvani
23fb0f26de initrd: merge branch 'bg/initrd-vlan'
https://bugzilla.redhat.com/show_bug.cgi?id=1898294
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/581
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/509
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/685

(cherry picked from commit 2889a3a5c5)
2020-11-24 10:08:54 +01:00
Beniamino Galvani
4b0007b037 initrd: disable ipv4 and ipv6 by default for vlan parent connection
Change the generator to disable by default IP configuration for the
parent connection of a VLAN, because that is what a user would expect
and what the legacy module does. Of course if the user explicitly
configures DHCP or an address for the parent interface, that overrides
the default.

Note that now the generator always creates a connection for the parent
interface. Before this commit, it did only when there was an explicit
ip= argument for the parent interface.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/509
(cherry picked from commit f2e51ace68)
2020-11-24 10:08:53 +01:00
Beniamino Galvani
f766b3cbae initrd: fix parsing of ip= argument with dotted interface name
The command line parser looks for a dot or a colon to determine
whether the first token in a ip= argument is a IPv4 address (dot), an
IPv6 address (colon) or an interface name (none). This strategy
doesn't work for interface names containing a dot (typically VLANs).

Instead, try to parse the IPv4/IPv6 address in the token; if this
fails then consider the token as an interface name.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/581
(cherry picked from commit 4aa902ecf5)
2020-11-24 10:08:53 +01:00
Beniamino Galvani
58a6697e96 initrd: add test for prefixed address in ip= argument
(cherry picked from commit 584e9048b3)
2020-11-24 10:08:53 +01:00
Beniamino Galvani
10f2600832 initrd: merge branch 'ac/cmdline_reader_ipv6_off' into master
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/539
(cherry picked from commit 3093a0073b)
2020-11-24 10:05:45 +01:00
Antonio Cardace
23364aa8f3 NEWS: update
Signed-off-by: Antonio Cardace <acardace@redhat.com>
(cherry picked from commit 8764d47af6)
2020-11-24 10:04:12 +01:00
Antonio Cardace
ad3088f63f initrd: disable ipv6 when 'off|none' is set in the 'ip' option
This is potentially a breaking change, formerly speciyfing 'none|off'
in the kernel cmdline option 'ip' was understood by the dracut
network-module as doing 'ipv6.method=auto' which is clearly incosistent
with the 'off' naming, thus 'off|none' now means to actually disable
both ipv6 and ipv4 (unless a static ip is provided).

Unit test added.

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

Reverts: 440a0b4078 ('initrd: set ipv6.method=auto when the autoconfiguration field is 'none'')
Signed-off-by: Antonio Cardace <acardace@redhat.com>
(cherry picked from commit fc7c83cbdd)
2020-11-24 10:02:53 +01:00
Thomas Haller
04ba2cafa3 dns: merge branch 'th/ip-config-cleanups' into master
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/689
2020-11-24 08:53:21 +01:00
Thomas Haller
297e84d569 dns/trivial: rename NMDnsIPConfigData to NMDnsConfigIPData
Let's try to rework and improve the implementation.

The code is already rather complicated from the start. Let's first try
to use consistent names for things. Naming is very important, so that
they follow a pattern that tells you what something does.
2020-11-24 08:53:01 +01:00