Commit graph

378 commits

Author SHA1 Message Date
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
Andrew Zaborowski a25d99f54b devices/wifi: Track IWD devices, match to NMDeviceIwd objects
Add the NMIwdManager singleton to be responsible for matching
NMDeviceIwd objects created from platform devices, to IWD Device dbus
objects when they appear/disappear.
2017-12-13 14:15:35 +01:00
Andrew Zaborowski ec1db966f7 devices/wifi: Add NMDeviceIwd class to support IWD backend
This is very similar to NMDeviceWifi but simplified to remove the things
currently unsupported and with calls to nm_platform_wifi_* and
nm_supplicant_* replaced with IWD DBus API calls.  Only unsecured
infrastructure-mode networks are supported here.

[bgalvani@redhat.com: fix compilation error after rebase for
  NMActRequestGetSecretsCallId]
[thaller@redhat.com: don't use _() macro strings server side.
  Translating strings only makes sense for clients that set environment
  variables accordingly.]
2017-12-13 14:15:35 +01:00
Thomas Haller 8c0dfd7188 systemd: merge branch systemd into master
Systemd instroduces a macro _fallthrough_, see
https://github.com/systemd/systemd/pull/7389.
However, it does not yet seem conclusive how to
handle this properly in ever situation.

While shared/nm-utils/siphash24.c makes use of
the new macro, don't do that in our fork. siphash24.h
does not include all systemd headers, hence _fallthrough_
is not defined. We could re-implement it as _nm_fallthrough,
but given the open questions, that doesn't seem the
2017-12-13 10:41:18 +01:00
Lubomir Rintel 8547387942 keyfile/tests: test tc qdisc reading and writing 2017-12-11 10:52:23 +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
Thomas Haller 79d5a06c8b build: don't link libnm against libjansson when building --without-json-validation
Also, don't add the CFLAGS for libjansson to dflt_cppflags_libnm_core.
dflt_cppflags_libnm_core is used also by core and libnm. But those
components do not (directly) link against libjansson. The cannot use
these flags.
2017-12-08 11:09:34 +01:00
Thomas Haller b1c65d32fe Revert "Makefile: rework team compilation flags"
I don't think we should do this.

- renamining/dropping configure options is still an annoyance,
  because it requires to different ./configure options depending
  on the version. The rename from --enable-teamctl to --enable-team
  might be theoretically nice, but more annoying then helpful.

- There is no strict dependency between --enable-team and
  --enable-json-validation. At most, one could argue that
  when enabling the team plugin (--enable-teamctl), then
  libnm must also be build with --enable-json-validation.
  But in fact, the team plugin will happily work with a
  libnm that doesn't link against libjansson.
  That is --enable-teamctl --disable-json-validation will work
  in practice just fine.
  On the other hand, libnm is a client library to create connection
  profiles, fully supporting team profiles also makes sense if the
  actual plugin is not installed (or build). Thus, --disable-teamctl
  --enable-json-validation certainly makes sense.

At this point, one might ask whether libnm is even still complete without
libjansson. Maybe libnm should *require* --enable-json-validation.
But that is not what the patch was doing, and it would also need
some careful consideration before doing so.

This reverts commit 9d5cd7eae8.
2017-12-08 09:07:30 +01:00
Francesco Giudici 9d5cd7eae8 Makefile: rework team compilation flags
Rename the team functionality enablement from 'teamdctl' to 'team'.
Force jansson lib requirement for team functionality: NetworkManager
requires the teamd daemon to manage team. As teamd depends upon jansson
lib, adding jansson requirement for teaming support in NetworkManager
seems reasonable.
Remove the jansson_validation flag, as the only generic json function in
nmcli (not related to team) was the one to check if a string was in json
format. Anyway, that function is used for team checks only. So, move
also json validation functions under the WITH_TEAM flag.
2017-12-08 00:46:27 +01:00
Lubomir Rintel 9bb30f86ec libnm-core: merge the settings tests into a single one
Thomas likes this more and who am I to argue.
2017-12-08 00:46:27 +01:00
Beniamino Galvani 9c27d73b2e build: fix path in Makefile
Fixes: 8e172eb984
2017-12-06 09:23:21 +01:00
Thomas Haller 8e172eb984 ifcfg-rh: move nm-inotify-helper to ifcfg-rh plugin
The helper is only used by ifcfg-rh. Move it to the plugin.
2017-12-05 19:57:24 +01:00
Thomas Haller 272439cb20 shared/compat: add compat for nm_setting_vpn_get_data_keys() and nm_setting_vpn_get_secret_keys() 2017-11-23 14:44:25 +01:00
Thomas Haller 1cb147663b shared: add nm-utils/nm-compat.h 2017-11-23 14:44:25 +01:00
Thomas Haller c512a01853 build: fix link failure of src/tests/test-systemd (2)
Actually, test-systemd only needs siphash24.c, not the
other parts.

Fixes: ac95f7da0b
2017-11-16 12:03:56 +01:00
Thomas Haller bfa7ae679a build: fix link failure of src/tests/test-systemd
Fixes: ac95f7da0b
2017-11-16 11:59:59 +01:00
Thomas Haller ac95f7da0b build: include "siphash24.c" source in "nm-hash-utils.c"
This allows the compiler to inline the siphash24*() functions
for nm_hash_ptr() and nm_hash_str() (even without LTO).

This of course only applies to nm_hash_ptr() and nm_hash_str(),
which are implemented in "nm-hash-utils.c" itself. All other
nm_hash_*() functions are inline functions in "nm-hash-utils.h",
and thus these functions can be inlined instead. That is, in
other cases, the nm_hash_*() function instead can be inlined.
For nm_hash_ptr() and nm_hash_str() instead we want to inline the
siphash24*() functions.

So, no longer compile "siphash24.c" directly. Instead, only
build "nm-hash-utils.c" which internally #include "siphash24.c".
2017-11-16 11:49:52 +01:00
Beniamino Galvani 30f679c444 build: fix 'make distcheck'
CC       src/systemd/src/basic/src_libsystemd_nm_la-string-table.lo
 ../../src/systemd/src/basic/parse-util.c:30:10: fatal error: 'errno-list.h' file not found
 #include "errno-list.h"
         ^~~~~~~~~~~~~~

Fixes: 1a2419a0c9
2017-11-15 18:49:09 +01:00
Thomas Haller 0ed49717ab all: support route-attribute "onlink" for IPv4
Kernel doesn't support it for IPv6.

This is especially useful, if you combine static routes
with DHCP. In that case, you might want to get the device-route
to the gateway automatically, but add a static-route for it.
2017-11-13 11:35:44 +01:00
Thomas Haller 11b241eb1c shared: add jansson.h compatibility and utils header 2017-11-09 17:32:22 +01:00
Beniamino Galvani c3efedf54b libnm: add checkpoint support 2017-11-09 10:12:30 +01:00
Beniamino Galvani b227198e92 build: fix make distcheck
Fixes the following errors in 'make distcheck':

1)
  GEN      libnm/fake-typelib/NMClient.typelib
 failed to open 'libnm/fake-typelib/NMClient.typelib.tmp': No such file or directory
 make[2]: *** [libnm/fake-typelib/NMClient.typelib] Error 1

2)
  GEN      libnm/fake-typelib/typelibs.c
 ../../libnm/fake-typelib/typelibs.gresource.xml: Failed to locate “NetworkManager.typelib” in any source directory.
 make[1]: *** [Makefile:17790: libnm/fake-typelib/typelibs.c] Error 1

3)
 ERROR: files left in build directory after distclean:
 ./libnm/fake-typelib/typelibs.c
 ./libnm/fake-typelib/NMClient.typelib
 ./libnm/fake-typelib/NetworkManager.typelib

Fixes: 4d1f090aed
2017-11-08 18:49:49 +01:00
Beniamino Galvani 29a576496e ifcfg-rh: persist the connection type for TeamPort connections
Currently the ifcfg-rh plugin doesn't explicitly store the connection
type for team slaves and is only able to read back ethernet and vlan
connections.

Leave this unchanged for ethernet and vlan slaves, but store the TYPE
variable for other connection types (Wi-Fi and Infiniband) so that we
can properly determine their type when the connection is read.
2017-11-06 16:40:57 +01:00
Thomas Haller 84878ac4e4 build: fix glib-compile-resources for unsupported --internal flag
Travis' version of glib-compile-resources does not support the
--internal flag:

    GEN      libnm/fake-typelib/typelibs.c
  Unknown option --internal
  make: *** [libnm/fake-typelib/typelibs.c] Error 1

We don't really need it anyway, because we have a linker version
script, that controls symbol visibility.

Fixes: 4d1f090aed
2017-11-06 14:47:27 +01:00
Lubomir Rintel a172b901d5 build: make dist with fake typelibs
Fixes: 4d1f090aed
2017-11-06 12:01:48 +01:00
Lubomir Rintel 4d1f090aed libnm: register empty NMClient and NetworkManager when loading libnm with GIR
Register empty "NMClient" and "NetworkManager" GIR modules as soon as libnm is
loaded witch gnome-introspection. This prevents the real modules from being
loaded because they would in turn load libnm-glib and abort() and crash.

In particular this prevents the GNOME shell from crashing with
libnm-glib abort and allows gracefully disabling the extensions which
use the obsolete library.

Test:

  $ cat test.js
  const NM = imports.gi.NM;
  print (NM.SecretAgentGetSecretsFlags.ALLOW_INTERACTION);

  const NMClient = imports.gi.NMClient;
  print (NMClient.SecretAgentGetSecretsFlags.ALLOW_INTERACTION);

Before:

  $ gjs test.js
  1

  (gjs:16253): libnm-util-ERROR **: libnm symbols detected; Mixing libnm with libnm-util/libnm-glib is not supported
  Trace/breakpoint trap (core dumped)
  $

After:

  $ gjs test.js
  1
  Gjs-Message: JS WARNING: [test.js 5]: reference to undefined property "SecretAgentGetSecretsFlags"

  (gjs:16228): Gjs-WARNING **: JS ERROR: TypeError: NMClient.SecretAgentGetSecretsFlags is undefined
  @test.js:5:1

  JS_EvaluateScript() failed
2017-11-06 11:47:05 +01:00
Beniamino Galvani a83ab252ee ifcfg-rh: add support for 802-1x.password-raw property
When the ifcfg-rh plugin writes a 802-1x setting it currently ignores
the password-raw property and so the password disappears when the
connection is saved. Add support for the property.
2017-10-31 10:19:49 +01:00
Lubomir Rintel b23f8ceb34 build: always include data/NetworkManager-ovs.conf in dist 2017-10-31 09:11:54 +01:00
Lubomir Rintel 6b532fed50 man: add OpenVSwitch overview 2017-10-30 21:46:55 +01:00
Lubomir Rintel 830a5a14cb device: add support for OpenVSwitch devices 2017-10-30 21:46:55 +01:00
Lubomir Rintel 3f74528a0b libnm: add support for ovs-bridge devices 2017-10-30 17:40:09 +01:00
Lubomir Rintel c536d7e666 libnm: add support for ovs-port devices 2017-10-30 17:40:09 +01:00
Lubomir Rintel e5c19377ec libnm: add support for ovs-interface devices 2017-10-30 17:40:08 +01:00
Lubomir Rintel b5925d693c introspection: add o.fd.NM.Device.OvsBridge interface 2017-10-30 17:40:08 +01:00
Lubomir Rintel 6748c44cb6 introspection: add o.fd.NM.Device.OvsPort interface 2017-10-30 17:40:08 +01:00
Lubomir Rintel b0f3dc0add introspection: add o.fd.NM.Device.OvsInterface interface 2017-10-30 17:40:08 +01:00
Lubomir Rintel cb9b024ddb libnm-core: add ovs-bridge setting 2017-10-30 17:40:08 +01:00
Lubomir Rintel 8a1ae40a80 libnm-core: add ovs-port setting 2017-10-30 17:40:08 +01:00
Lubomir Rintel 27790fa976 libnm-core: add ovs-interface setting 2017-10-30 17:40:08 +01:00
Lubomir Rintel d4a7fe4679 libnm-core: add ovs-patch setting 2017-10-30 17:40:08 +01:00
juga0 3aba3e38c3 dhcp: add support for dhcpcanon client
https://github.com/NetworkManager/NetworkManager/pull/31
2017-10-30 10:43:10 +01:00
Beniamino Galvani 5c2c7d37c3 build: create clients/common/ when building libnmc_base library
Fixes the following build error where gcc fails because the
client/common does not exist yet:

  CC       shared/nm-utils/clients_common_libnmc_base_la-nm-enum-utils.lo
 cc1: error: ./clients/common: No such file or directory [-Werror]
 cc1: all warnings being treated as errors
 make[4]: *** [shared/nm-utils/clients_common_libnmc_base_la-nm-enum-utils.lo] Error 1
 #

 libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I../shared -I./shared -I../libnm-core -I./libnm-core -I../libnm -I./libnm -I../clients/common -I./clients/common ... -c ../shared/nm-utils/nm-enum-utils.c  -fPIC -DPIC -o shared/nm-utils/.libs/clients_common_libnmc_base_la-nm-enum-utils.o
 cc1: error: ./clients/common: No such file or directory [-Werror]

Fixes: 3434261811
2017-10-19 14:21:59 +02:00
Thomas Haller ee76b0979f all: use siphash24 for hashing
siphash24() is wildly used by projects nowadays.

It's certainly slower then our djb hashing that we used before.
But quite likely it's fast enough for us, given how wildly it is
used. I think it would be hard to profile NetworkManager to show
that the performance of hash tables is the issue, be it with
djb or siphash24.

Certainly with siphash24() it's much harder to exploit the hashing
algorithm to cause worst case hash operations (provided that the
seed is kept private). Does this better resistance against a denial
of service matter for us? Probably not, but let's better be safe then
sorry.

Note that systemd's implementation uses a different seed for each hash
table (at least, after the hash table grows to a certain size).
We don't do that and use only one global seed.
2017-10-18 13:27:02 +02:00
Thomas Haller 3434261811 core,clients: use our own string hashing function nm_str_hash()
Replace the usage of g_str_hash() with our own nm_str_hash().

GLib's g_str_hash() uses djb2 hashing function, just like we
do at the moment. The only difference is, that we use a diffrent
seed value.

Note, that we initialize the hash seed with random data (by calling
getrandom() or reading /dev/urandom). That is a change compared to
before.

This change of the hashing function and accessing the random pool
might be undesired for libnm/libnm-core. Hence, the change is not
done there as it possibly changes behavior for public API. Maybe
we should do that later though.

At this point, there isn't much of a change. This patch becomes
interesting, if we decide to use a different hashing algorithm.
2017-10-18 13:05:00 +02:00
Thomas Haller 281d2d9fad shared: split random and hash utils
"nm-utils/nm-shared-utils.h" shall contain utility function without other
dependencies. It is intended to be used by other projects as-is.

nm_utils_random_bytes() requires getrandom() and a HAVE_GETRANDOM configure
check. That makes it more cumbersome to re-use "nm-shared-utils.h", in
cases where you don't care about nm_utils_random_bytes().

Split nm_utils_random_bytes() out to a separate file.

Same for hash utils, which depend on nm_utils_random_bytes(). Also, hash
utils will eventually be extended to use siphash24.
2017-10-17 20:02:59 +02:00
Beniamino Galvani aa964ae969 build: move nm-client-utils.c to libnmc-base.a
In a later commit we'll add a new generic client function used by
nmcli and nmtui. nm-client-utils.c seems the right place for it, so
move the file to the base library that is used by both clients.

While at it, also put in that file some functions that will be needed
by nmtui.
2017-10-16 17:25:35 +02:00
Thomas Haller 01677a3e40 build: cleanup style for toplevel Makefile.am
Use consistently $() instead of ${}.

Don't use the $(top_*) variables, because we don't do recursive make
and the toplevel directory is the same as the current directory.
For consistency, only use the non-toplevel versions of the variables.
2017-09-25 18:23:15 +02:00
Beniamino Galvani 2f66fbf32d build: add missing header file to Makefile
Fixes: 734c5b38ad
2017-09-22 12:06:11 +02:00
Thomas Haller 77ec302714 core: rework handling of default-routes and drop NMDefaultRouteManager
Remove NMDefaultRouteManager. Instead, add the default-route to the
NMIP4Config/NMIP6Config instance.

This basically reverts commit e8824f6a52.
We added NMDefaultRouteManager because we used the corresponding to `ip
route replace` when configuring routes. That would replace default-routes
on other interfaces so we needed a central manager to coordinate routes.
Now, we use the corresponding of `ip route append` to configure routes,
and each interface can configure routes indepdentently.

In NMDevice, when creating the default-route, ignore @auto_method for
external devices. We shall not touch these devices.

Especially the code in NMPolicy regarding selection of the best-device
seems wrong. It probably needs further adjustments in the future.
Especially get_best_ip_config() should be replaced, because this
distinction VPN vs. devices seems wrong to me.
Thereby, remove the @ignore_never_default argument. It was added by
commit bb75026004, I don't think it's
needed anymore.

This brings another change. Now that we track default-routes in
NMIP4Config/NMIP6Config, they are also exposed on D-Bus like regular
routes. I think that makes sense, but it is a change in behavior, as
previously such routes were not exposed there.
2017-09-08 11:11:21 +02:00
Thomas Haller 802ecd2e54 tui: link nm-utils/nm-shared-utils.c into nmtui 2017-09-05 14:12:19 +02:00