Commit Graph

20676 Commits

Author SHA1 Message Date
Thomas Haller
bc2367b83c generate-setting-docs.py: remove unused propxml argument from get_prop_type() 2018-07-11 08:16:40 +02:00
Lubomir Rintel
354140e8d3 setting-connection: fix ovs-port parent setting verification
$ nmcli c add type ovs-port ifname ovsport0
  Error: Failed to add 'ovs-port-ovsport0' connection: connection.type:
      Only 'ovs-port' connections can be enslaved to 'ovs-bridge'

nm_streq0() is not good here. It fails (with a wrong error message) even
when the slave_type is not set, which it shouldn't since slave_type can
be normalized. The real problem is the lack of the master property.

This fixes the condition:

  $ nmcli c add type ovs-port ifname ovsport0
  Error: Failed to add 'ovs-port-ovsport0' connection: connection.master:
    A connection with a 'ovs-port' setting must have a master.

Corrects the error message:

  $ nmcli c add con-name br0 type bridge
  $ nmcli c add type ovs-port ifname ovsport0 parent br0
  Error: Failed to add 'bridge-slave-ovsport0' connection: connection.slave-type:
    'ovs-port' connections must be enslaved to 'ovs-bridge', not 'bridge'

And gets rid of a confusing nm_streq0 use when comparing the type, since
at that point type must not be NULL anymore.

Fixes: 4199c976da
2018-07-10 18:30:34 +02:00
Lubomir Rintel
c866df7997 contrib/checkpatch: print the actual source name instead of patch name
This gives more relevant output in a commit check.

Include a couple of small fixes trivial enough not to deserve a separate
commit.
2018-07-10 13:32:04 +02:00
Lubomir Rintel
8149859c02 merge: branch 'lr/ovs-slaves'
https://github.com/NetworkManager/NetworkManager/pull/155
2018-07-10 13:13:21 +02:00
Lubomir Rintel
5f30a2b525 libnm: add accessors for ovs port/bridge slaves 2018-07-10 13:12:07 +02:00
Lubomir Rintel
8d65f636e1 devices/ovs: expose slaves on D-Bus for OVS bridges and ports 2018-07-10 13:12:02 +02:00
Lubomir Rintel
889961f8b6 all/trivial: grammar fix 2018-07-10 13:12:02 +02:00
Lubomir Rintel
0f3f56695a contrib: add checkpatch.pl
A naive code compliance checker. Invoke directly:

  contrib/scripts/checkpatch.pl 0001-switch-comments-to-klingon.patch
  contrib/scripts/checkpatch.pl hello.[ch] world.c

Use from a commit hook:

  echo 'git format-patch --stdout -1 |contrib/scripts/checkpatch.pl || :>' \
      >.git/hooks/post-commit

Or view the documentation with "perldoc contrib/scripts/checkpatch.pl"
2018-07-10 12:41:37 +02:00
Thomas Haller
73fa1b54ef shared: merge branch 'th/shared-glib-compat' 2018-07-09 16:30:25 +02:00
Thomas Haller
bf593304ef shared: ensure "nm-glib.h" is not used without "nm-macros-internal.h"
Note how "nm-glib.h" uses _nm_printf() macro, which is defined in
"nm-macros-internal.h". There are many ways how to solve that
problem.

For example, we could define certain _nm_*() macros in "nm-glib.h"
itself. However, that is a bit awkward, because optimally "nm-glib.h"
only provides functions that are strictly related to glib compatiblity.
_nm_printf() is used by "nm-glib.h" for its own implementation, it should
not provide (or reimplement) this macro.

We solve this instead by enforcing what NetworkManager already does.
NetworkManager never includes "nm-glib.h" directly, instead
"nm-macros-internal.h" is the only place that includes the glib compat
header. It means, you cannot use "nm-glib.h" without
"nm-macros-internal.h". But that is a reasonable compromise, with
respect to granularity. The granularity at the moment is: if you use
anything from "shared/nm-utils", you almost always need at least
"nm-macros-internal.h" header (and automatically also get "nm-glib.h"
and "gsystem-local-alloc.h"). It's not intended, to use "nm-glib.h"
directly.

This makes "nm-glib.h" an implementation detail of "nm-macros-internal.h"
and it only exists to separate code that is related to glib compatibility to
its own header.
2018-07-09 16:30:12 +02:00
Thomas Haller
62cd6afd98 shared/trivial: prettify nm-glib.h compat implementation by grouping code 2018-07-09 16:30:12 +02:00
Thomas Haller
56ddc8904d shared: restore compat code in nm-glib.h for 2.32 compatibility
In commit 8a46b25cfa, NetworkManager
bumped its glib dependency to 2.40 or newer.

"nm-glib.h" header is precisely the compatiblity implementation that we
use to cope with older glib versions. Note, that the same implementation
is also used by applet and VPN plugins.

However, applet and VPN plugins don't yet require 2.40 glib. Also,
they don't yet require NetworkManager 1.12.0 API (which was the one
that bumped the glib requirement to 2.40). Hence, when "nm-glib.h"
is used in applet or VPN, it must still cope with older versions,
although, the code is not used by NetworkManager itself.

Partly revert 8a46b25cfa so that nm-glib.h
again works for 2.32 or newer.

The same is true, also for "nm-test-utils.h", which is also used by
applet and VPN plugins.
2018-07-09 16:30:12 +02:00
Thomas Haller
29c9ef3f46 cli: merge branch 'th/cli-connection-handling-3'
https://github.com/NetworkManager/NetworkManager/pull/148
2018-07-09 15:44:15 +02:00
Thomas Haller
d7b643f66f cli/trivial: move code 2018-07-09 15:43:55 +02:00
Thomas Haller
ba350a3495 cli: add additional user-data argument to get_fcn()
The function nmc_print() receives a list of "targets". These are essentially
the rows that should be printed (while the "fields" list represents the columns).

When filling the cells with values, it calles repeatedly get_fcn() on the
column descriptors (fields), by passing each row (target).

The caller must be well aware that the fields and targets are
compatible. For example, in some cases the targets are NMDevice
instances and the target type must correspond to what get_fcn()
expects.

Add another user-data pointer that is passed on along with the
targets. That is useful, if we have a list of targets/rows, but
pass in additional data that applies to all rows alike.

It is still unused.
2018-07-09 15:43:55 +02:00
Thomas Haller
918be83493 cli: rework printing of "wired" and "wifi" device details 2018-07-09 15:43:55 +02:00
Thomas Haller
d6949a2924 cli: rework printing of "capabilities" device details 2018-07-09 15:43:55 +02:00
Thomas Haller
2fc475ccdf cli: rework printing of "connections" device details 2018-07-09 15:43:55 +02:00
Thomas Haller
e771153c0a cli: don't translate device details in terse mode
https://bugzilla.gnome.org/show_bug.cgi?id=794329
2018-07-09 15:43:55 +02:00
Thomas Haller
6f8f7ad597 cli: rework enum-to-string function to not return translated text
There are cases, where we need the untranslated text.

There is no change of behavior of this patch, because all
callers now explicitly call gettext().
2018-07-09 15:43:55 +02:00
Thomas Haller
fede017001 cli: rework printing of "general" device details 2018-07-09 15:43:55 +02:00
Thomas Haller
283b1d18b7 cli: rework printing of device status 2018-07-09 15:43:55 +02:00
Thomas Haller
940979a5a6 cli: merge IPv4 and IPv6 versions of ip/dhcp config print 2018-07-09 15:43:55 +02:00
Thomas Haller
bddf482fa1 cli/trivial: move code 2018-07-09 15:43:55 +02:00
Thomas Haller
ff273b8221 cli: drop duplicate IPv6 property metadata 2018-07-09 15:43:55 +02:00
Thomas Haller
096ac93f8a cli: rework printing of dhcp options 2018-07-09 15:43:55 +02:00
Thomas Haller
59ea03cc08 cli: rework printing of vpn active-connection properties
use nmc_print() for the job.
2018-07-09 15:43:55 +02:00
Beniamino Galvani
505a21131e core: merge branch bg/vpn-primary
Fix setting PrimaryConnection for VPNs.

https://github.com/NetworkManager/NetworkManager/pull/158
2018-07-09 15:13:35 +02:00
Beniamino Galvani
522e49edd6 policy: track best active connections rather than best devices
If a VPN with default route is activated, the Manager's
PrimaryConnection property is not updated to indicate the VPN as
primary connection.

This happens because the PrimaryConnection property gets updated when
the default_ipX_device property of NMPolicy changes, and the primary
connection is set to the activation request currently pending on the
default device. We select the base (for example, ethernet) device as
best device and therefore the NMActRequest active on it is selected as
primary connection.

This patch fixes the problem by properly selecting the VPN as
primary. It seems a better choice to track best active connections
directly from NMPolicy instead of going through two steps.
2018-07-09 14:56:59 +02:00
Beniamino Galvani
e1888ad4e5 policy: choose best VPN based on metrics
As the FIXME suggests, select the VPN with best metric to determine
the best IP config.
2018-07-09 13:34:29 +02:00
Beniamino Galvani
e205664ba8 manager: accept non-null device for VPN activations
Commit 10753c3616 ("manager: merge VPN handling into
_new_active_connection()") added a check to fail the activation of
VPNs when a device is passed to ActivateConnection(), since the device
argument is ignored for VPNs.

This broke activating VPNs from nm-applet as nm-applet sets both the
specific_object (parent-connection) and device arguments in the
activation request.

Note that we already check in _new_active_connection() that when a
device is supplied, it matches the device of the parent
connection. Therefore, the check can be dropped.

Reported-by: Michael Biebl <biebl@debian.org>
Fixes: 10753c3616

https://github.com/NetworkManager/NetworkManager/pull/159
2018-07-09 13:28:47 +02:00
Thomas Haller
530b82a372 build/meson: fix meson build without pppd
Fixes: 1cdb36b8de
2018-07-09 12:02:37 +02:00
Thomas Haller
4e4b363cc2 platform: reduce logging level for wireguard messages 2018-07-09 11:42:35 +02:00
Thomas Haller
67f50f64d9 platform: fix -Werror=maybe-uninitialized in _new_from_nl_link()
Fixes: 0827d4c2e4
2018-07-09 11:36:43 +02:00
Lubomir Rintel
b200e5d8ed platform/linux: drop an unused variable
Fixes: 2ac5860a06
2018-07-09 11:32:09 +02:00
Jan Tojnar
1cdb36b8de ppp-manager: use configured pppd path
Path to pppd can be set via configure flag but the source code ignores it.

Let's use PPPD_PATH like other calls of nm_utils_find_helper do.

https://bugzilla.gnome.org/show_bug.cgi?id=796752
2018-07-09 11:27:13 +02:00
Jan Tojnar
f3c1e7f6ab meson: define PPPD_PATH variable
configure.ac defines it just like it defines other PATH variables
for use with nm_utils_find_helper. Meson for some reason did not.

https://bugzilla.gnome.org/show_bug.cgi?id=796752
2018-07-09 11:27:13 +02:00
Lubomir Rintel
79ddef403c merge: branch 'wireguard-platform' of https://github.com/jbeta/NetworkManager
https://github.com/NetworkManager/NetworkManager/pull/143
2018-07-09 11:08:12 +02:00
Francesco Giudici
21e5e61655 man/trivial: fix heading comment in nm-openvswitch.xml 2018-07-06 17:28:28 +02:00
Olivier Gayot
d1a98d6892 device: fix order of params in nm_match_spec_device prototype
The following commit:

  b869d9cc0 device: add spec "driver:" to match devices

added two parameters ("driver" and "driver_version") to the
nm_match_spec_device() function.

However, the definition of the function and its declaration are not
consistent.

The prototype shows:
  nm_match_spec_device (const GSList *specs,
                        const char *interface_name,
                        const char *driver,
                        const char *driver_version,
                        const char *device_type,

But the definition shows:
  nm_match_spec_device (const GSList *specs,
                        const char *interface_name,
                        const char *device_type,
                        const char *driver,
                        const char *driver_version,

Since all parameters are pointers to const char, the type checking
succeeds at compile time.

All currently existing invocations of the function are correct and pass
the arguments in the order described in the definition/implementation.
This patch only changes the prototype so that potential future
invocations don't end up buggy.

Fixes: b869d9cc0d
2018-07-06 14:48:42 +02:00
Michael Biebl
7ab7dc9487 Increase timeout in test-nm-client to 30s
On slow architectures it can take longer then 3s for the test service to
start up.
2018-07-05 16:48:06 +02:00
Beniamino Galvani
f396826466 libnm: add (allow-none) annotations to nm_device_reapply()
The @connection argument can be NULL; add the (allow-none) annotation
otherwise calling the API with a NULL argument through GObject
introspection fails with:

 Argument 1 does not allow None as a value

Fixes: 278fd4fb0f
2018-07-04 14:01:53 +02:00
Beniamino Galvani
2ee76c88c1 merge: branch 'bg/ip-tunnel-gretap-bgo796645'
https://bugzilla.gnome.org/show_bug.cgi?id=796645
2018-07-02 20:39:47 +02:00
Beniamino Galvani
fc99aad378 ip-tunnel: allow wired setting for some tunnel modes
gretap and ip6gretap ip-tunnel interfaces encapsulate L2 packets over
IP. Allow adding a wired setting for such connections so that users
can change the interface MAC.
2018-07-02 17:55:14 +02:00
Beniamino Galvani
3f9f9f7fa2 ip-tunnel: add support for ip6gre and ip6gretap tunnel connections 2018-07-02 17:55:14 +02:00
Beniamino Galvani
f9199c7fb5 ip-tunnel: add support for gretap tunnel connections 2018-07-02 17:55:14 +02:00
Beniamino Galvani
09a868a24e platform: add ip6gre/ip6gretap tunnels support
Add platform support for IP6GRE and IP6GRETAP tunnels. The former is a
virtual tunnel interface for GRE over IPv6 and the latter is the L2
variant.

The platform code internally reuses and extends the same structure
used by IPv6 tunnels.
2018-07-02 17:55:14 +02:00
Beniamino Galvani
4c2862b958 platform: add gretap tunnels support
Add platform support for GRETAP tunnels (Virtual L2 tunnel interface
GRE over IPv4) partially reusing the existing GRE code.
2018-07-02 17:55:14 +02:00
Beniamino Galvani
cdad8c6df9 platform: uniform logging for link-add functions
Print all the platform-lnk attributes in a consistent manner.
2018-07-02 17:55:14 +02:00
Beniamino Galvani
4b46c74af7 platform: fix printing macvtap links 2018-07-02 17:55:14 +02:00