Commit graph

635 commits

Author SHA1 Message Date
Lubomir Rintel 7f7207f36b libnm/vpn-plugin: avoid bad function pointer type casts
This makes GCC 8.0 unhappy and it is probably right about that -- it's more
difficult to get things wrong when the function prototypes actually match.
2018-02-08 17:11:46 +01:00
Thomas Haller e4839accf5 all: replace non-leading tabs with spaces
We commonly only allow tabs at the beginning of a line, not
afterwards. The reason for this style is so that the code
looks formated right with tabstop=4 and tabstop=8.
2018-02-07 13:32:04 +01:00
Thomas Haller aed6e28461 trivial: avoid XXX tag and replace by NOTE or FIXME
XXX was used to either raise attention (NOTE) or to indicate
that this is ugly code that should be fixed (FIXME). The usage
was inconsistent.

Let's avoid XXX and use either NOTE or FIXME.
2018-01-23 12:55:33 +01:00
Pavel Šimerda c4f655579c libnm: fix empty statements that were supposed to return NULL
Discovered thanks to `-Wunused-value` when building on openSUSE Leap 42.3.
2018-01-17 19:20:03 +01:00
Masashi Honma b4bbe5179f wifi: add support for FILS
The FILS(Fast Initial Link Setup) is a specification defined by IEEE 802.11ai to
speed up roaming. This patch adds support of it.

I have tested with these cases.
+-----+-------------------------+----------------+
| STA |            AP           |                |
|FILS |         key-mgmt        |     result     |
+-----+-------------------------+----------------+
|  1  | WPA-EAP                 |       O        |
+-----+-------------------------+----------------+
|  1  | WPA-EAP-SHA256          |       O        |
+-----+-------------------------+----------------+
|  1  | FILS-SHA256             |       X        |
+-----+-------------------------+----------------+
|  1  | FILS-SHA384             |       X        |
+-----+-------------------------+----------------+
|  1  | WPA-EAP WPA-EAP-SHA256  |       O        |
|     | FILS-SHA256 FILS-SHA384 | WPA-EAP-SHA256 |
+-----+-------------------------+----------------+
|  2  | WPA-EAP                 |       O        |
+-----+-------------------------+----------------+
|  2  | WPA-EAP-SHA256          |       O        |
+-----+-------------------------+----------------+
|  2  | FILS-SHA256             |       O        |
+-----+-------------------------+----------------+
|  2  | FILS-SHA384             |       O        |
+-----+-------------------------+----------------+
|  2  | WPA-EAP WPA-EAP-SHA256  |       O        |
|     | FILS-SHA256 FILS-SHA384 | FILS-SHA384    |
+-----+-------------------------+----------------+
|  3  | WPA-EAP                 |       X        |
+-----+-------------------------+----------------+
|  3  | WPA-EAP-SHA256          |       X        |
+-----+-------------------------+----------------+
|  3  | FILS-SHA256             |       O        |
+-----+-------------------------+----------------+
|  3  | FILS-SHA384             |       O        |
+-----+-------------------------+----------------+
|  3  | WPA-EAP WPA-EAP-SHA256  |       O        |
|     | FILS-SHA256 FILS-SHA384 | FILS-SHA384    |
+-----+-------------------------+----------------+

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2018-01-16 15:01:59 +01:00
Thomas Haller e428252935 libnm: add nm_vpn_service_plugin_shutdown() API
Otherwise, the only way to disconnect the NMVpnServicePlugin
instance is by completely unrefing it. However, often it is
not so easy to ensure that nobody else is still keeping the
instance alive, after the point where we no longer want to
handle D-Bus requests. nm_vpn_service_plugin_shutdown() to the
rescue.
2018-01-16 14:39:09 +01:00
Thomas Haller e89e5edcf8 libnm: cleanup resource handling in NMVpnServicePlugin:init_sync() 2018-01-16 14:38:06 +01:00
Thomas Haller 929f36c56f libnm/vpn: unexport and destroy D-Bus glue instance with NMVpnServicePlugin
Otherwise, we might still be called back with D-Bus requests, after
the NMVpnServicePlugin instance is already destroyed.
2018-01-15 13:30:36 +01:00
Thomas Haller 34cb6f9877 build/meson: use variables for ldflags and linker-script 2018-01-11 12:46:01 +01:00
Thomas Haller 98b46537fa build/meson: remove unnecessary square brackets 2018-01-11 12:29:31 +01:00
Lubomir Rintel 603daa5b25 secret-agent: construct the dbus proxy for async agent with the correct bus name
The asynchronous secret agent initialization doesn't work at all due to a
rather silly typo. Oops.

While at it, fix a whitespace error too.
2018-01-11 11:52:40 +01:00
Thomas Haller 349861ceec build/meson: unconditionally use linker version scripts
We also unconditionally use them with autotools.
Also, the detection for have_version_script does
not seem correct to me. At least, it didn't work
with clang.
2018-01-10 12:31:44 +01:00
Thomas Haller 32e989b5a7 build/meson: fix gir dependency with building without fake-typelibs 2018-01-10 12:30:48 +01:00
Iñigo Martínez 50930ed19a meson: Use string variables extensively
The strings holding the names used for libraries have also been
moved to different variables. This way they would be less error
as these variables can be reused easily and any typing error
would be quickly detected.
2018-01-10 12:22:55 +01:00
Iñigo Martínez 5e16bcf268 meson: Improve dependency system
Some targets are missing dependencies on some generated sources in
the meson port. These makes the build to fail due to missing source
files on a highly parallelized build.

These dependencies have been resolved by taking advantage of meson's
internal dependencies which can be used to pass source files,
include directories, libraries and compiler flags.

One of such internal dependencies called `core_dep` was already in
use. However, in order to avoid any confusion with another new
internal dependency called `nm_core_dep`, which is used to include
directories and source files from the `libnm-core` directory, the
`core_dep` dependency has been renamed to `nm_dep`.

These changes have allowed minimizing the build details which are
inherited by using those dependencies. The parallelized build has
also been improved.
2018-01-10 12:20:17 +01:00
Ismo Puustinen 2e2ff6f27a mdns: add new connection property.
Add support for mDNS as a connection-level property. Update ifcfg-rh and
keyfile plugins to support it.
2018-01-09 14:24:53 +01:00
Thomas Haller fc8d1d6f9f libnm: fix building libnm without WITH_FAKE_TYPELIBS and without gir
Fixes: 4d1f090aed
2018-01-08 16:56:59 +01:00
Thomas Haller 22ef6a507a build: refine the NETWORKMANAGER_COMPILATION define
Note that:

 - we compile some source files multiple times. Most notably those
   under "shared/".

 - we include a default header "shared/nm-default.h" in every source
   file. This header is supposed to setup a common environment by defining
   and including parts that are commonly used. As we always include the
   same header, the header must behave differently depending
   one whether the compilation is for libnm-core, NetworkManager or
   libnm-glib. E.g. it must include <glib/gi18n.h> or <glib/gi18n-lib.h>
   depending on whether we compile a library or an application.

For that, the source files need the NETWORKMANAGER_COMPILATION #define
to behave accordingly.

Extend the define to be composed of flags. These flags are all named
NM_NETWORKMANAGER_COMPILATION_WITH_*, they indicate which part of the
build are available. E.g. when building libnm-core.la itself, then
WITH_LIBNM_CORE, WITH_LIBNM_CORE_INTERNAL, and WITH_LIBNM_CORE_PRIVATE
are available. When building NetworkManager, WITH_LIBNM_CORE_PRIVATE
is not available but the internal parts are still accessible. When
building nmcli, only WITH_LIBNM_CORE (the public part) is available.
This granularily controls the build.
2018-01-08 12:38:53 +01:00
Beniamino Galvani da4c9e51a0 ip-tunnel: add support for tunnel flags
Implement support for IP tunnel flags. Currently only some IPv6 tunnel
flags are supported. Example:

 # nmcli connection add type ip-tunnel mode ip6ip6 \
   ip-tunnel.flags ip6-ign-encap-limit,ip6-use-orig-tclass \
   ifname abc ip-tunnel.parent ens8 ipv4.method disabled \
   ipv6.method manual ipv6.address ::8888 remote ::42

 # ip -d l
  61: abc@ens8: <NOARP,UP,LOWER_UP> mtu 1460 qdisc noqueue ...
    link/tunnel6 :: brd ::42 promiscuity 0
    ip6tnl ip6ip6 remote ::42 local :: dev ens8 encaplimit none
    hoplimit 0 tclass inherit ...

https://bugzilla.gnome.org/show_bug.cgi?id=791846
2018-01-05 18:25:08 +01:00
Iñigo Martínez 03ba0f1b3a build: Remove default install directories
The install directories of those targets that match the default
install directories have been removed because they are redundant.

This also allows a simple meson build files and it is unnecessary
to create some paths.

https://mail.gnome.org/archives/networkmanager-list/2017-December/msg00078.html
2018-01-02 10:44:05 +01:00
Iñigo Martínez cc692a6976 build: Remove documentation generation workarounds
Documentation was not working in meson due to problems with files
generated in `libnm`. To avoid these problems, workarounds were
used. This problems have been recently fixed so these workarounds
are not necessary anymore.

https://mail.gnome.org/archives/networkmanager-list/2017-December/msg00061.html
2017-12-18 20:46:03 +01:00
Lubomir Rintel 6672c5e92e all: get rid of a handful of unused-but-set variables 2017-12-18 13:29:32 +01:00
Iñigo Martínez 0735b35dd0 build: use template files for enum types' sources generation
Source files for enum types are generated by passing segments of the
source code of the files to the `glib-mkenums` command.

This patch removes those parameters where source code is used from
meson build files by moving those segmeents to template files.

https://mail.gnome.org/archives/networkmanager-list/2017-December/msg00057.html
2017-12-18 11:25:06 +01:00
Iñigo Martínez e2562d2bfa build: Merge no introspection headers with public headers
There are three headers `nm-secret-agent-old.h`,
`nm-vpn-plugin-old.h`, and `nm-vpn-service-plugin.h`, which are
named as no introspection headers. However, these files also
join to the rest headers to generate introspection data.

This patch merges those no introspection headers with the public
headers.
2017-12-16 15:12:39 +01:00
Iñigo Martínez 28914f6a68 build: Make generate-plugin-docs.pl independent of autotools
`generate-plugin-docs.pl` script which is used to parse
`nm-setting-c*.c` files depends on autotools. This is because it
parses the `Makefile.am` in order to figure out the setting files
it needs to parse.

This patch makes the script independent of autotools by passing
the necessary setting files by command line instead of parsing the
`Makefile.am` file. It also changes the autotools' and meson's
accordingly.
2017-12-16 15:12:33 +01:00
Iñigo Martínez d849366230 build: rename unit tests with the test- pattern
There are some tests located in different directories which are
using the same name. To avoid any confussion a prefix was used to
name the test and the target.

This patch uses the prefix just for the target, to avoid any
collision that may happen, and uses the `test-` pattern as the
name.

https://mail.gnome.org/archives/networkmanager-list/2017-December/msg00051.html
2017-12-14 20:07:38 +01:00
Iñigo Martínez 48d4cda9d4 build: fix targets generated by generate-settings-docs.py
generate-settings-docs.py script is used to generate the
`nm-settings-docs.xml` and `nm-property-docs.xml` files. However,
to generate these files properly, the path where `libnm` shared
library is built must be passed to the script.

This patch uses the recently added `--lib-path` parameter to
pass the `libnm`'s built directory, which allows the proper
generation of the files in meson.

https://mail.gnome.org/archives/networkmanager-list/2017-December/msg00045.html
2017-12-14 15:19:01 +01:00
Iñigo Martínez 9fc990e8a9 build: library paths as parameters for generate-settings-docs.py
generate-settings-docs.py script uses the `LD_LIBRARY_PATH` to
prepend directories to the library search path, which is useful to
load a just built libnm shared library, when generating the
`nm-settings-docs.xml` and `nm-property-docs.xml` files.

However, this is a problem for meson, which is not able to set
environment variables when executing the script.

This patch adds a new optional parameter, `-l` or `--lib-path` that
can be used to pass different paths to be prepended without using
the `LD_LIBRARY_PATH` environment, which can still be used.

[thaller@redhat.com: fix script to handle None lib_path argument]

https://mail.gnome.org/archives/networkmanager-list/2017-December/msg00044.html
2017-12-14 15:18:48 +01:00
Iñigo Martínez 03637ad8b5 build: add initial support for meson build system
meson is a build system focused on speed an ease of use, which
helps speeding up the software development. This patch adds meson
support along autotools.

[thaller@redhat.com: rebased patch and adjusted for iwd support]

https://mail.gnome.org/archives/networkmanager-list/2017-December/msg00022.html
2017-12-13 15:48:50 +01:00
Lubomir Rintel 9c03a813e0 libnm: move symbols that were backported to 1.10.2 before 1.12 to libnm_1_10_2
See also: ae5af6b368
2017-12-11 20:22:30 +01:00
Lubomir Rintel de41c45e61 libnm-core: add functionality for dealing with tc-style traffic filter specifiers
Tailored to fit both nmcli and keyfile needs.
2017-12-11 11:02:04 +01:00
Lubomir Rintel e035cb7be0 libnm-core: add traffic filter support to NMSettingTCConfig 2017-12-11 11:02:04 +01:00
Lubomir Rintel 733464ada3 libnm-core: add functionality for dealing with tc-style action specifiers
Tailored to fit both nmcli and keyfile needs.
2017-12-11 11:02:04 +01:00
Lubomir Rintel 7c8ce778fb libnm-core: add action support to NMSettingTCConfig
The actions are not too useful my themselves, but it will be possible to
embed them into traffic filters in subsequent commits.
2017-12-11 10:52:23 +01:00
Lubomir Rintel 92f8f30d47 clients: add tc qdisc support
What works:

  nmcli c add con-name dum0 ifname dum0 type dummy \
      tc.qdiscs 'ingress, root pfifo_fast'
  nmcli c modify dum0 -tc.qdiscs 'root pfifo_fast'
  nmcli c modify dum0 +tc.qdiscs 'root handle 666: fq_codel'
2017-12-11 10:52:23 +01:00
Lubomir Rintel 7c1de05f41 libnm-core: add functionality for dealing with tc-style qdisc specifiers
Tailored to fit both nmcli and keyfile needs.
2017-12-11 10:52:22 +01:00
Lubomir Rintel da13c7a1a4 libnm-core: add NMSettingTCConfig with qdisc support
Currently is only able to hold the queueing disciplines.
2017-12-11 10:52:22 +01:00
Lubomir Rintel 273fb58e35 generate-setting-docs: document aa{sv} type
Will be useful for tc qdiscs.
2017-12-11 10:30:26 +01:00
Thomas Haller ae5af6b368 libnm: adjust symbol versioning after backporting team API to 1.10.2
The team API was backported to nm-1-10 branch.
It will be released both as 1.12.0 and 1.10.2.

To ensure the upgrade path from 1.10.2+ to 1.12+ works, the symbols
in libnm must be present on both versions.

Usually, we would duplicate the symbols on master via
NM_BACKPORT_SYMBOL() macro.

However, as we are sure that we will release 1.10.2 before 1.12.0,
we can just update the linker version of these symbols. So, although
the symbols will be first released on major release 1.12.0, their linker
version tag is libnm_1_10_2, to ease upgrade and to avoid duplicating the
symbols.
2017-12-08 13:48:58 +01:00
Thomas Haller 41803aac2d libnm: fix libnm.ver file to export libnm_1_10_2 ABI
Fixes: cb9facdfef
2017-12-08 13:43:49 +01:00
Francesco Giudici f094837d73 libnm-core: team-port: expose the new link-watchers property
It will allow explicit configuration of link-watchers in the team port
configuration.
2017-12-08 00:46:26 +01:00
Francesco Giudici ca816ae10e libnm-core: team: expose the new link-watchers property
It will allow explicit configuration of link-watchers in the team
configuration.
2017-12-08 00:46:26 +01:00
Francesco Giudici ba4ce843fa libnm-core: add backend for GVariant de/serialization of link_watchers. 2017-12-08 00:46:26 +01:00
Francesco Giudici 72f6d08714 libnm-core: team: add NMTeamLinkWatcher boxed type
Team allows to specify multiple link watchers for each link.
Define a link watcher object in order to allow to specify multiple ones
for each Team configuration.
2017-12-08 00:46:26 +01:00
Thomas Haller cb9facdfef build: adjust libnm symbol versioning after backporting update2 API for 1.10.2
The update2 API was backported to nm-1-10 branch, with commit
ad7f1d18a0. It will be released
both as 1.12.0 and 1.10.2.

To ensure the upgrade path from 1.10.2+ to 1.12+ works, the symbols
in libnm must be present on both versions.

Usually, we would duplicate the symbols on master via
NM_BACKPORT_SYMBOL() macro.

However, as we are sure that we will release 1.10.2 before 1.12.0,
we can just update the linker version of these symbols. So, although
they are first released on major release 1.12.0, their linker version
tag is libnm_1_10_2, to ease upgrade and to avoid duplicating the
symbol.
2017-12-06 09:46:42 +01:00
Thomas Haller d00eb95c55 libnm: add nm_remote_connection_update2()
- only add an async version. I think sync requests are fundamentally flawed
  because they mess up the order of D-Bus messages. Hence, also don't
  call the function *_async(), like we do for other functions. As there
  is only the async form, it doesn't have a suffix.

- Don't accept a NMConnection as @settings argument, but a GVariant.
  In general, keep the libnm API closer to the D-Bus API and don't hide
  the underlying function with a less powerful form. The user still can
  conveniently call the function with

    nm_remote_connection_update2 (connection,
                                  nm_connection_to_dbus (NM_CONNECTION (connection),
                                                         NM_CONNECTION_SERIALIZE_ALL),
                                  save_to_disk
                                    ? NM_SETTINGS_UPDATE2_FLAG_TO_DISK
                                    : NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY,
                                  NULL,
                                  cancellable,
                                  callback,
                                  user_data);

  I believe the parts of libnm that invoke D-Bus methods, should be
  close to the D-Bus API. Not like nm_remote_connection_commit_changes()
  which has no corresponding D-Bus method.
2017-12-05 19:57:24 +01:00
Thomas Haller 98ee18d888 all: add new D-Bus API org.freedesktop.NetworkManager.Settings.Connection.Update2()
We already have Update(), UpdateUnsaved() and Save(), which serve
similar purposes. We will need a form of update with another argument.

Most notably, to block autoconnect while doing the update.

Other use cases could be to prevent reapplying connection.zone and
connection.metered, to to reapply all changes.

Instead of adding a specific update function that only serves that
new use-case, add a extensible Update2() function. It can be extended
to cope with future variants of update.
2017-12-05 11:50:52 +01:00
Thomas Haller b6efac9ec2 c-list: re-import latest version of c-list.h from upstream
Most notably, it renames
  c_list_unlink_init() -> c_list_unlink()
  c_list_unlink() -> c_list_unlink_stale()

  $ sed -e 's/\<c_list_unlink\>/c_list_unlink_old/g' \
        -e 's/\<c_list_unlink_init\>/c_list_unlink/g' \
        -e 's/\<c_list_unlink_old\>/c_list_unlink_stale/g' \
        $(git grep -l c_list_unlink -- ':(exclude)shared/nm-utils/c-list.h') \
        -i
2017-11-28 11:26:39 +01:00
Thomas Haller 2be6515dd0 libnm: add nm_setting_vpn_get_data_keys() and nm_setting_vpn_get_secret_keys() API
It's rather limiting that the only API to access *all* keys
is nm_setting_vpn_foreach_data_item() and nm_setting_vpn_foreach_secret().

API like nm_setting_vpn_get_num_secrets() is not useful, at least as
long as you cannot access the item by index.
2017-11-23 14:44:25 +01:00
Thomas Haller c09a069ca3 libnm: use cleanup attribute in nm_vpn_service_plugin_read_vpn_details() 2017-11-23 14:44:24 +01:00