Commit Graph

477 Commits

Author SHA1 Message Date
Thomas Haller
89d40d6579 wireguard: add "mtu" setting for WireGuard profiles
This adds new API for 1.16.0 and is an ABI break since 1.16-rc1.

(cherry picked from commit d5e93ae613)
2019-03-05 12:23:59 +01:00
Thomas Haller
4023012cd1 man: add a warning to NetworkManager.conf manual for rp_filter and connectivity checking 2019-02-08 16:05:36 +01:00
Thomas Haller
ce2f3d8c1e man: explain purpose of connectivity checking in man NetworkManager.conf 2019-02-05 11:12:07 +01:00
Lubomir Rintel
58ee6be348 man: fix a typo 2019-02-05 10:20:27 +01:00
Thomas Haller
930c7d2d22 man: better explain "connectivity.response" in "NetworkManager.conf" manual 2019-01-31 11:33:45 +01:00
Thomas Haller
7807ffff83 connectivity: fix handling of no-response for captive portal detection
Since we only compare that the HTTP response starts with the expected
response, we need to handle the empty expected response specially
(because, every response has "" as prefix).

So now if connectivity.response is set to "" (empty) we accept:

- HTTP status code 204. We ignore and accept any extra data that we
  might receive.

- HTTP status code 200 and an empty (or no) body.
2019-01-31 11:33:44 +01:00
Rafael Fontenelle
d81e10942f all: fix misspellings
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/64
2019-01-24 17:19:44 +01:00
Lubomir Rintel
96782b94e1 merge: branch 'master' of https://github.com/balrog-kun/NetworkManager
https://github.com/NetworkManager/NetworkManager/pull/137
2019-01-04 18:26:41 +01:00
Iñigo Martínez
35171b3c3f build: meson: Add trailing commas
Add missing trailing commas that avoids getting noise when another
file/parameter is added and eases reviewing changes[0].

[0] https://gitlab.gnome.org/GNOME/dconf/merge_requests/11#note_291585
2018-12-20 13:50:34 +01:00
Beniamino Galvani
f606124b62 man: add SR-IOV nmcli example
Add an example on how to configure SR-IOV to the nmcli examples man
page.

https://bugzilla.redhat.com/show_bug.cgi?id=1651979
2018-12-12 14:38:18 +01:00
Thomas Haller
a7ef23b326 core: fix match spec behavior for a list of all "except:"
If the spec specifies only negative matches (and none of them matches),
then the result shall be positive.

Meaning:

    [connection*] match-device=except:dhcp-plugin:dhclient
    [connection*] match-device=except:interface-name:eth0
    [.config] enabled=except:nm-version:1.14

should be the same as:

    [connection*] match-device=*,except:dhcp-plugin:dhclient
    [connection*] match-device=*,except:interface-name:eth0
    [.config] enabled=*,except:nm-version:1.14

and match by default. Previously, such specs would never yield a
positive match, which seems wrong.

Note that "except:" already has a special meaning. It is not merely
"not:". That is because we don't support "and:" nor grouping, but all
matches are combined by an implicit "or:". With such a meaning, having
a "not:" would be unclear to define. Instead it is defined that any
"except:" match always wins and makes the entire condition to explicitly
not match. As such, it makes sense to treat a match that only consists
of "except:" matches special.

This is a change in behavior, but the alternative meaning makes
little sense.
2018-12-11 13:58:24 +01:00
Thomas Haller
c7d8864511 connectivity: honor "main.systemd-resolved" setting to not resolve names first
If the user disabled systemd-resolved, two things seem apparent:

 - the user does not want us to use systemd-resolved

 - NetworkManager is not pushing the DNS configuration to
   systemd-resoved.

It seems to me, we should not consult systemd-resolved in that case.
2018-12-11 09:23:47 +01:00
Andrew Zaborowski
3593237527 cli: reuse connections in nmcli dev wifi con
Try to locate an existing connection before creating a new one when
handling "nmcli device wifi connect".  This allows WPA-Enterprise
networks to be activated this way, consistent with the comment that this
command is equivalent to clicking on an SSID in a GUI client.
2018-12-04 14:46:37 +01:00
Beniamino Galvani
446e5b27d6 core: add checks on connection default properties
Add a new CON_DEFAULT() macro that places a property name into a
special section used at runtime to check whether it is a supported
connection default.

Unfortunately, this mechanism doesn't work for plugins so we have to
enumerate the connection defaults from plugins in the daemon using
another CON_DEFAULT_NOP() macro.
2018-12-01 15:16:48 +01:00
Beniamino Galvani
a482b27593 man: add missing connection defaults 2018-12-01 15:16:48 +01:00
Lubomir Rintel
b385ad0159 all: say Wi-Fi instead of "wifi" or "WiFi"
Correct the spelling across the *entire* tree, including translations,
comments, etc. It's easier that way.

Even the places where it's not exposed to the user, such as tests, so
that we learn how is it spelled correctly.
2018-11-29 17:53:35 +01:00
Thomas Haller
de3f6cfb98 doc,all: fix spelling of Open vSwitch (instead of OpenVSwitch)
Also affects documentation and translated strings.

Reported-by: Flavio Leitner <fbl@redhat.com>
2018-11-28 14:26:42 +01:00
Thomas Haller
a294ca3eec man: advise against configuring "monitor-connection-files" in NetworkManager.conf 2018-11-23 09:57:24 +01:00
Thomas Haller
89bd19b0d7 man: fix typo in nmcli manual
Fixes: 17f9801e07
2018-11-14 18:26:07 +01:00
Francesco Giudici
2f2ad4d925 man: add an early reference to nmcli-examples in nmcli man page 2018-11-14 17:15:55 +01:00
Francesco Giudici
e3ea7245c3 man: add OTP-based VPN activation example 2018-11-14 17:15:50 +01:00
Thomas Haller
207a9a2223 man: document global connection default for "ipv4.dns-priority"
... and "ipv6.dns-priority".

Fixes: 77ded12da4
2018-11-13 13:49:02 +01:00
Thomas Haller
17f9801e07 man: clarify blocking autoconnect during nmcli connection down
Manually disconnecting a profile of course blocks autoconnect of the
same profile. Otherwise, the profile would likely re-activate right
away, which is clearly against the users intention. If the users just
want to re-activate the profile, they should issue `nmcli connection up`
instead, with does a full down and up cycle.

This is more interesting for profiles that have 'connection.multi-connect'
set to 'multiple'. Would you expect that manually deactivating such a
profile blocks autoconnect of the profile on all devices? Maybe
yes, maybe not. Currently that is indeed the case and autoconnect gets
blocked regardless of multi-connect.
2018-11-13 13:48:10 +01:00
Beniamino Galvani
15d722b70c nm-online: sort options in man page and program help 2018-11-05 09:32:20 +01:00
Beniamino Galvani
d76ac490f5 cli: sort options in man page and program help
Options are displayed in a random order, sort them.
2018-11-05 09:32:20 +01:00
Thomas Haller
b9eb264efe device: add "dhcp-plugin" match spec for device
The need for this is the following:

"ipv4.dhcp-client-id" can be specified via global connection defaults.
In absence of any configuration in NetworkManager, the default depends
on the DHCP client plugin. In case of "dhclient", the default further
depends on /etc/dhcp.

For "internal" plugin, we may very well want to change the default
client-id to "mac" by universally installing a configuration
snippet

    [connection-use-mac-client-id]
    ipv4.dhcp-client-id=mac

However, if we the user happens to enable "dhclient" plugin, this also
forces the client-id and overrules configuration from /etc/dhcp. The real
problem is, that dhclient can be configured via means outside of NetworkManager,
so our defaults shall not overwrite defaults from /etc/dhcp.

With the new device spec, we can avoid this issue:

    [connection-dhcp-client-id]
    match-device=except:dhcp-plugin:dhclient
    ipv4.dhcp-client-id=mac

This will be part of the solution for rh#1640494. Note that merely
dropping a configuration snippet is not yet enough. More fixes for
DHCP will follow. Also, bug rh#1640494 may have alternative solutions
as well. The nice part of this new feature is that it is generally
useful for configuring connection defaults and not specifically for
the client-id issue.

Note that this match spec is per-device, although the plugin is selected
globally. That makes some sense, because in the future we may or may not
configure the DHCP plugin per-device or per address family.

https://bugzilla.redhat.com/show_bug.cgi?id=1640494
2018-11-01 11:17:12 +01:00
Thomas Haller
085b769729 man: clarify udev property "NM_UNMANAGED" in man NetworkManager 2018-10-26 09:06:45 +02:00
Thomas Haller
ac90593cc2 man: fix "no-auto-default" state dir in NetworkManager.conf manual
Quote from `man NetworkManager.conf`:

  When the default wired connection is deleted or saved to a new
  persistent connection by a plugin, the device is added to a list in the
  file /run/NetworkManager/no-auto-default.state to prevent creating
  the default connection for that device again.

"/run" is obviously wrong. Fix it.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/33
2018-10-25 15:24:38 +02:00
Thomas Haller
1b732e28f7 man: document nmcli device connect behaviour
Already since 1.0.0 release and commit "3784678177 cli: create a connection
if none exist in 'nmcli dev connect' (rh #1113941)", device-connect can
also create a profile.

That is useful, in particular as opposed to

  $ nmcli connection up ifname "$DEVICE"

which wouldn't create a profile (ever).

Document it.
2018-10-17 18:16:25 +02:00
Beniamino Galvani
dcfddeef7a build: meson: fix generation of api docs
We need to copy all introspection files to the same directory when
building the documentation.

Note that we only require Meson 0.44, but for the documentation at
least 0.46 is needed because of a new functionality of
gnome.gdbus_codegen(). In this way we can still build on Travis CI
(without documentation).
2018-09-28 17:25:46 +02:00
Beniamino Galvani
929298333e build: meson: add missing man file
Fixes: 9f9609555d
2018-09-28 17:23:23 +02:00
Lubomir Rintel
d4eb4cb45f dns: allow loading nm-dns-systemd-resolve alongside other DNS plugins
Even when the system resolver is configured to something else that
systemd-resolved, it still is a good idea to keep systemd-resolved up to
date. If not anything else, it does a good job at doing per-interface
resolving for connectivity checks.

If for whatever reasons don't want NetworkManager to push the DNS data
it discovers to systemd-resolved, the functionality can be disabled
with:

  [main]
  systemd-resolved=false
2018-09-24 15:17:02 +02:00
Thomas Haller
320461c062 dns: minor rewording of main.dns in man NetworkManager.conf 2018-09-21 11:12:47 +02:00
Thomas Haller
0dc673f0a5 dns: write original DNS servers to /var/run/NetworkManager/no-stub-resolv.conf
When a DNS plugin is enabled (like "main.dns=dnsmasq" or "main.dns=systemd-resolved"),
the name servers announced to the rc-manager are coerced to be 127.0.0.1
or 127.0.0.53.

Depending on the "main.rc-manager" setting, also "/etc/resolv.conf"
contains only this coerced name server to the local caching service.
The same is true for "/var/run/NetworkManager/resolv.conf" file, which
contains what we would write to "/etc/resolv.conf" (depending on
the "main.rc-manager" configuration).

Write a new file "/var/run/NetworkManager/no-stub-resolv.conf", which contains
the original name servers, uncoerced. Like "/var/run/NetworkManager/resolv.conf",
this file is always written.

The effect is, when one enables "main.dns=systemd-resolved", then there
is still a file "no-stub-resolv.conf" with the same content as with
"main.dns=default".

The no-stub-resolv.conf may be a possible solution, when a user wants
NetworkManager to update systemd-resolved, but still have a regular
/etc/resolv.conf [1]. For that, the user could configure

    [main]
    dns=systemd-resolved
    rc-manager=unmanaged

and symlink "/etc/resolv.conf" to "/var/run/NetworkManager/no-stub-resolv.conf".
This is not necessarily the only solution for the problem and does not preclude
options for updating systemd-resolved in combination with other DNS plugins.

[1] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/20
2018-09-21 11:12:47 +02:00
Beniamino Galvani
c06a6aec1a build: meson: gtk-doc needs common.ent 2018-09-19 16:03:32 +02:00
Beniamino Galvani
c8636449b3 build: meson: man files depend on common.ent 2018-09-19 16:03:32 +02:00
Lubomir Rintel
9dab0a5eba man/NetworkManager: document --configure-and-quit option 2018-09-18 17:40:47 +02:00
Lubomir Rintel
9f9609555d initrd: add configuration generator
nm-initrd-generator scans the command line for options relevant to network
configuration and creates configuration files for an early instance of
NetworkManager run from the initial ramdisk during early boot.
2018-09-18 17:40:47 +02:00
Beniamino Galvani
bc7efc750a core: add support for connection.llmnr 2018-09-06 09:07:41 +02:00
Lubomir Rintel
57d4286d54 man/openvswitch: advise to use "master" instead of "conn.master"
It does some extra magic -- normalizes the value and initializes
slave-type.

https://bugzilla.redhat.com/show_bug.cgi?id=1519176
2018-08-06 18:59:01 +02:00
Beniamino Galvani
53c2951f61 device: configure SR-IOV 2018-07-11 16:16:22 +02:00
Francesco Giudici
21e5e61655 man/trivial: fix heading comment in nm-openvswitch.xml 2018-07-06 17:28:28 +02:00
Thomas Haller
2ccf6168dc logging: warn about invalid logging backends and drop "debug" backend
"debug" was documentation in `man NetworkManager.conf` as a valid
logging backend. However, it was completely ignored by
nm_logging_syslog_openlog().
In fact, it makes not sense. Passing debug = TRUE to
nm_logging_syslog_openlog(), means that all messages will be
printed to stderr in addition to syslog/journal. However, when
NetworkManager is daemonizing, stderr is closed.
Whether NetworkManager is daemonizing depends entirely on command
line options --no-daemon and --debug. Hence, the logging backend "debug"
from the configuration file either conflicts or is redundant.

Also, adjust logging backend description in `man NetworkManager.conf`.

Also, log a warning about invalid/unsupported logging backend.
2018-06-27 09:16:04 +02:00
Lubomir Rintel
29636535b2 client: support 6lowpan setting 2018-06-26 16:21:55 +02:00
Lubomir Rintel
5da77c0e2c client: support wpan setting 2018-06-26 16:21:55 +02:00
Thomas Haller
ce9619047c dispatcher: add NM_DISPATCHER_ACTION environment variable
Previously, the action was only passed as the first command line
argument to the dispatcher scripts. Now, also set it via the
"$NM_DISPATCHER_ACTION" environment variable.

The main purpose is to have a particular, nm-dispatcher specific
variable that is always set inside the dispatcher scripts.
For example, imagine you have a script that can be either called by
dispatcher or some other means (manually, or spawned via
/etc/NetworkManager/dispatcher.d/11-dhclient).  Then it might make
sense to differenciate from inside the script whether you are called
by nm-dispatcher. But previously, there was no specific environment
variable that was always set inside the dispatcher event. For example,
with the "hostname" action there are no other environment variables.

Now (with version 1.12), you can check for `test -n "$NM_DISPATCHER_ACTION"`.
2018-06-18 14:18:08 +02:00
Lubomir Rintel
34412a8d3d cli/devices: rescan the Wi-Fi network if the AP list is not fresh enough 2018-06-13 14:48:23 +02:00
Francesco Giudici
7a0b6b17bb libnm-core: add ipv6.dhcp-duid property
allow to specify the DUID to be used int the DHCPv6 client identifier
option: the dhcp-duid property accepts either a hex string or the
special values "lease", "llt", "ll", "stable-llt", "stable-ll" and
"stable-uuid".

"lease": give priority to the DUID available in the lease file if any,
         otherwise fallback to a global default dependant on the dhcp
         client used. This is the default and reflects how the DUID
         was managed previously.
"ll": enforce generation and use of LL type DUID based on the current
      hardware address.
"llt": enforce generation and use of LLT type DUID based on the current
       hardware address and a stable time field.
"stable-ll": enforce generation and use of LL type DUID based on a
             link layer address derived from the stable id.
"stable-llt": enforce generation and use of LLT type DUID based on
              a link layer address and a timestamp both derived from the
              stable id.
"stable-uuid": enforce generation and use of a UUID type DUID based on a
               uuid generated from the stable id.
2018-06-08 18:23:31 +02:00
Thomas Haller
5f94476b26 man: improve explaining settings plugins in manual NetworkManager.conf
https://bugzilla.redhat.com/show_bug.cgi?id=1586351
2018-06-07 11:32:34 +02:00
Thomas Haller
644aa42f68 dns: change main.rc-manager=file behavior to always follow symlink
With "main.rc-manager=file", if /etc/resolv.conf is a symlink, NetworkManager
would follow the symlink and update the file instead.

However, note that realpath() only returns a target, if the file actually
exists. That means, if /etc/resolv.conf is a dangling symlink, NetworkManager
would replace the symlink with a file.

This was the only case in which NetworkManager would every change a symlink
resolv.conf to a file. I think this is undesired behavior.

This is a change in long established behavior. Although note that there were several
changes regarding rc-manager settings in the past. See for example commit [1] and [2].

Now, first still try using realpath() as before. Only if that fails, try
to resolve /etc/resolv.conf as a symlink with readlink().

Following the dangling symlink is likely not a problem for the user, it
probably is even desired. The part that most likely can cause problems
is if the destination file is not writable. That happens for example, if
the destination's parent directories are missing. In this case, NetworkManager
will now fail to write resolv.conf and log a warning. This has the potential of
breaking existing setups, but it really is a mis-configuration from the user's
side.

This fixes for example the problem, if the user configures
/etc/resolv.conf as symlink to /tmp/my-resolv.conf. At boot, the file
would not exist, and NetworkManager would previously always replace the
link with a plain file. Instead, it should follow the symlink and create
the file.

[1] 718fd22436
[2] 15177a34be

https://github.com/NetworkManager/NetworkManager/pull/127
2018-06-05 16:21:10 +02:00