Commit graph

16285 commits

Author SHA1 Message Date
Lubomir Rintel 172e7f100b valgrind: two more gdbus suppressions
The GDBusObjectManagerClient's control proxy seems to leak some bits. Not sure
why; but certainly not our fault since it's a private object and the
manager object itself gets finalized.
2016-11-14 20:22:23 +01:00
Lubomir Rintel 5b3a39ddce valgrind: suppression for a lazy GTask type initialization 2016-11-14 20:22:23 +01:00
Lubomir Rintel 4b7b518958 libnm: avoid leaking the interface proxies
_nm_object_get_proxy()'s semantics changed with the object-manager
branch merge: it now takes a reference.
2016-11-14 20:22:23 +01:00
Lubomir Rintel 446858cf8d libnm/client: unref all the objects on dispose
We created them, we own them.
2016-11-14 20:22:23 +01:00
Lubomir Rintel dfa90861e8 libnm/tests: increase timeout in nm-client test
Otherwise the test may fail in valgrind.
2016-11-14 20:22:23 +01:00
Lubomir Rintel afd48fbdbe valgrind: adjust one gdbus suppression
In Fedora 25 the actual frame was called "fun:g_main_context_iterate.isra.24".
2016-11-14 20:22:23 +01:00
Beniamino Galvani 5dfc571971 libnm: initialize @device_type of device objects
Before switching to the ObjectManager, the D-Bus property was used to
decide the actual type of the device and the property set manually by
each subclass in its _init() function. Now we determine objects type
based on their D-Bus interface and therefore we can handle the
property like all others, ensuring that we return a known value in
get_property() to avoid warnings in GLib.

This fixes the missing initialization of the property which causes
regressions on clients as nm-applet.

Fixes: 1f5b48a59e
2016-11-14 13:38:26 +01:00
Thomas Haller ce28e6ab30 man: clarify dns=default setting in NetworkManager.conf manual
https://bugzilla.gnome.org/show_bug.cgi?id=774399
2016-11-14 12:34:28 +01:00
Thomas Haller 34eb8d513f libnm/trivial: move hexstr<>bin conversion functions
nm_utils_hexstr2bin() is quite similar to hwaddr_aton(), and
nm_utils_bin2hexstr() is similar to _bin2str_buf().

Move them close to each other. Maybe one day they should be
consolidated. But their API is slightly different, so the
consolidation would require some effort.

For now, just move them close to each other, so that it's
clearer that two similar (but distinct) functions exists.
2016-11-13 16:01:18 +01:00
Thomas Haller 13a95c363c device: drop factory-no-default global arrays
On some architectures, it seems we don't properly expose
the symbol of these static variables from NetworkManager
binary.

Just avoid that and don't instead use a static array
inside the device plugin itself.

While at it, make the arrays all const, which possibly allows
the linker to put those symbols in the read-only section.
2016-11-13 15:06:57 +01:00
Thomas Haller a791a9aa4b systemd: merge branch systemd into master 2016-11-13 14:16:42 +01:00
Thomas Haller e68056a229 systemd: update code from upstream
This is a direct dump from systemd git on 2016-11-12, git commit
1f8c78a1bab2e06a462894fa89d842ffc313832d.

======

SYSTEMD_DIR=../systemd
COMMIT=1f8c78a1bab2e06a462894fa89d842ffc313832d

(
  cd "$SYSTEMD_DIR"
  git checkout "$COMMIT"
  git reset --hard
  git clean -fdx
)

git ls-files :/src/systemd/src/ | xargs -d '\n' rm -f

nm_copy_sd() {
    mkdir -p "./src/systemd/$(dirname "$1")"
    cp "$SYSTEMD_DIR/$1" "./src/systemd/$1"
}

nm_copy_sd "src/basic/alloc-util.c"
nm_copy_sd "src/basic/alloc-util.h"
nm_copy_sd "src/basic/async.h"
nm_copy_sd "src/basic/escape.c"
nm_copy_sd "src/basic/escape.h"
nm_copy_sd "src/basic/ether-addr-util.c"
nm_copy_sd "src/basic/ether-addr-util.h"
nm_copy_sd "src/basic/extract-word.c"
nm_copy_sd "src/basic/extract-word.h"
nm_copy_sd "src/basic/fileio.c"
nm_copy_sd "src/basic/fileio.h"
nm_copy_sd "src/basic/fd-util.c"
nm_copy_sd "src/basic/fd-util.h"
nm_copy_sd "src/basic/fs-util.c"
nm_copy_sd "src/basic/fs-util.h"
nm_copy_sd "src/basic/hash-funcs.c"
nm_copy_sd "src/basic/hash-funcs.h"
nm_copy_sd "src/basic/hashmap.c"
nm_copy_sd "src/basic/hashmap.h"
nm_copy_sd "src/basic/hexdecoct.c"
nm_copy_sd "src/basic/hexdecoct.h"
nm_copy_sd "src/basic/hostname-util.c"
nm_copy_sd "src/basic/hostname-util.h"
nm_copy_sd "src/basic/in-addr-util.c"
nm_copy_sd "src/basic/in-addr-util.h"
nm_copy_sd "src/basic/io-util.c"
nm_copy_sd "src/basic/io-util.h"
nm_copy_sd "src/basic/list.h"
nm_copy_sd "src/basic/log.h"
nm_copy_sd "src/basic/macro.h"
nm_copy_sd "src/basic/mempool.h"
nm_copy_sd "src/basic/mempool.c"
nm_copy_sd "src/basic/parse-util.c"
nm_copy_sd "src/basic/parse-util.h"
nm_copy_sd "src/basic/path-util.c"
nm_copy_sd "src/basic/path-util.h"
nm_copy_sd "src/basic/prioq.h"
nm_copy_sd "src/basic/prioq.c"
nm_copy_sd "src/basic/random-util.c"
nm_copy_sd "src/basic/random-util.h"
nm_copy_sd "src/basic/refcnt.h"
nm_copy_sd "src/basic/set.h"
nm_copy_sd "src/basic/signal-util.h"
nm_copy_sd "src/basic/siphash24.c"
nm_copy_sd "src/basic/siphash24.h"
nm_copy_sd "src/basic/socket-util.c"
nm_copy_sd "src/basic/socket-util.h"
nm_copy_sd "src/basic/sparse-endian.h"
nm_copy_sd "src/basic/stdio-util.h"
nm_copy_sd "src/basic/string-table.c"
nm_copy_sd "src/basic/string-table.h"
nm_copy_sd "src/basic/string-util.c"
nm_copy_sd "src/basic/string-util.h"
nm_copy_sd "src/basic/strv.c"
nm_copy_sd "src/basic/strv.h"
nm_copy_sd "src/basic/time-util.c"
nm_copy_sd "src/basic/time-util.h"
nm_copy_sd "src/basic/umask-util.h"
nm_copy_sd "src/basic/unaligned.h"
nm_copy_sd "src/basic/utf8.c"
nm_copy_sd "src/basic/utf8.h"
nm_copy_sd "src/basic/util.c"
nm_copy_sd "src/basic/util.h"
nm_copy_sd "src/libsystemd-network/arp-util.c"
nm_copy_sd "src/libsystemd-network/arp-util.h"
nm_copy_sd "src/libsystemd-network/dhcp6-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp6-lease-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp6-network.c"
nm_copy_sd "src/libsystemd-network/dhcp6-option.c"
nm_copy_sd "src/libsystemd-network/dhcp6-protocol.h"
nm_copy_sd "src/libsystemd-network/dhcp-identifier.c"
nm_copy_sd "src/libsystemd-network/dhcp-identifier.h"
nm_copy_sd "src/libsystemd-network/dhcp-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp-lease-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp-network.c"
nm_copy_sd "src/libsystemd-network/dhcp-option.c"
nm_copy_sd "src/libsystemd-network/dhcp-packet.c"
nm_copy_sd "src/libsystemd-network/dhcp-protocol.h"
nm_copy_sd "src/libsystemd-network/lldp-internal.h"
nm_copy_sd "src/libsystemd-network/lldp-neighbor.c"
nm_copy_sd "src/libsystemd-network/lldp-neighbor.h"
nm_copy_sd "src/libsystemd-network/lldp-network.c"
nm_copy_sd "src/libsystemd-network/lldp-network.h"
nm_copy_sd "src/libsystemd-network/network-internal.c"
nm_copy_sd "src/libsystemd-network/network-internal.h"
nm_copy_sd "src/libsystemd-network/sd-dhcp6-client.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp6-lease.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp-client.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp-lease.c"
nm_copy_sd "src/libsystemd-network/sd-ipv4ll.c"
nm_copy_sd "src/libsystemd-network/sd-ipv4acd.c"
nm_copy_sd "src/libsystemd-network/sd-lldp.c"
nm_copy_sd "src/libsystemd/sd-event/sd-event.c"
nm_copy_sd "src/libsystemd/sd-id128/id128-util.c"
nm_copy_sd "src/libsystemd/sd-id128/id128-util.h"
nm_copy_sd "src/libsystemd/sd-id128/sd-id128.c"
nm_copy_sd "src/shared/dns-domain.c"
nm_copy_sd "src/shared/dns-domain.h"
nm_copy_sd "src/systemd/_sd-common.h"
nm_copy_sd "src/systemd/sd-dhcp6-client.h"
nm_copy_sd "src/systemd/sd-dhcp6-lease.h"
nm_copy_sd "src/systemd/sd-dhcp-client.h"
nm_copy_sd "src/systemd/sd-dhcp-lease.h"
nm_copy_sd "src/systemd/sd-event.h"
nm_copy_sd "src/systemd/sd-ndisc.h"
nm_copy_sd "src/systemd/sd-id128.h"
nm_copy_sd "src/systemd/sd-ipv4acd.h"
nm_copy_sd "src/systemd/sd-ipv4ll.h"
nm_copy_sd "src/systemd/sd-lldp.h"
2016-11-13 14:11:33 +01:00
Beniamino Galvani 35b32e5825 ndisc/lndp: fix unregistration of receive handler
Fixes: 6387856602
2016-11-12 19:25:40 +01:00
Lubomir Rintel 32d60ccc6f libnm/nm-object: gracefully skip unknown objects
They indicate a server bug (a dangling path of an object that does not
exist). The best we can do probably is to just ignore them and warn.

Based-on-patch-by: Dan Williams <dcbw@redhat.com>
2016-11-11 17:57:09 +01:00
Lubomir Rintel 9d31d09bcb libnm/manager: don't fail the object if we can't get the permissions
It's not fatal and the NMObject's initialization shouldn't fail. Just
write out a polite warning and leave the permissions in UNKNOWN state.
2016-11-11 17:42:07 +01:00
Lubomir Rintel 00dbf6e90a auth-utils: don't fail the auth chain if we can't get a single permissions
It could be that the client is just newer and it's just too harsh to
fail the whole request. Leave the unknown permission in unknown and
possibly proceed filling in the rest.
2016-11-11 17:41:43 +01:00
Lubomir Rintel f5c5565d3f merge: branch 'lr/async-client'
https://bugzilla.gnome.org/show_bug.cgi?id=771190
2016-11-11 16:18:22 +01:00
Lubomir Rintel f2099f5b79 cli/general: defer printing the permissions until we know them
The async client might be constructed before we know the permissions.
2016-11-11 16:18:03 +01:00
Lubomir Rintel 32dfa563d1 libnm/nm-manager: don't block the object creation on permissions
The GetPermissions call is very expensive (~400ms here, an extra
NM->polkit call for every known permission while polkit being really
slow to answer) yet seldom needed.

There's no methods to access the permissions -- they're only
communicated via signals.

Unfortunately, we don't know when a signal is hooked, so we still need
to kick of the call. Nevertheless, we don't need to wait for it to
finish.
2016-11-11 16:18:03 +01:00
Lubomir Rintel 01a20015e0 cli: use nmc_do_cmd to get the client and check if the daemon is running
The makes use of asynchronous client initialization, making things a bit
faster and reduces code duplication too.
2016-11-11 16:18:03 +01:00
Lubomir Rintel 3ee03afecc cli: make it possible to call sub-commands with client obtained asynchronously 2016-11-11 16:18:03 +01:00
Lubomir Rintel 6499bb893f cli: get rid of client-global connections list
Caching it in the NmCli object is unnecessary, ugly and would be cumbersome in
future when we'll be creating the client object only when needed.
2016-11-11 16:18:03 +01:00
Lubomir Rintel 0cde514252 cli/trivial: fix some whitespace errors 2016-11-11 16:18:03 +01:00
Beniamino Galvani 00ce005e51 device: properly handle MTU for devices with @iface != @ip_iface
When the device has an IP interface different from the main one, we
previously took the MTU saved in priv->mtu (which is the MTU initially
set on the underlying interface) and applied it to the IP interface.

This is wrong as it forces the two MTUs to be equal and breaks
connectivity for devices with encapsulation (as PPP). Instead, track
the two MTUs in different variables.

https://bugzilla.redhat.com/show_bug.cgi?id=1385198
2016-11-11 15:52:25 +01:00
Lubomir Rintel 7b589e2b72 man: use <filename> to mark file names
This gives the templates a chance to do something extra clever with the
formatting. The templates, of course, choose not to :(
2016-11-11 14:42:27 +01:00
Lubomir Rintel 42e1e669bc man: link to some online resources 2016-11-11 14:42:27 +01:00
Lubomir Rintel 063d714a3c man: get rid of the extra capitalization in docbook source
The temaplates capitalize the names if they wish.
2016-11-11 14:42:26 +01:00
Thomas Haller 88e18c9de8 ifcfg-rh: improve handling of empty strings in svUnescape()
- a key
    FOO=''
  would still allocate a temporary GString and return the allocated
  empty string. Don't do that. This saves the g_free() in
  svGetValueString() for this common case. We should return
  an allocated string only if it is necessary. It is not necessary
  for the "" case, and it is inconsistent.

- when returning an empty string, always return the static string "".
  No need to seek to the end of value, and return a pointer to that
  string.
  This happens for example in the case
    FOO= # empty value, but trailing stuff
    FOO=""
    FOO=$'\Uxhallo'
2016-11-11 12:55:01 +01:00
Beniamino Galvani 9430cf3e6b ifcfg-rh: accept 802.1x connection with empty EAP-TLS identity
An identity is not needed for EAP-TLS.

https://bugzilla.redhat.com/show_bug.cgi?id=1391477
2016-11-11 11:03:57 +01:00
Jiří Klimeš 5aa4d778c9 merge: nm-import-openvpn script improvements 2016-11-10 20:59:48 +01:00
Jiří Klimeš c391fb299b nm-import-openvpn: sort the options alphabetically 2016-11-10 20:56:44 +01:00
Jiří Klimeš 3219bb3b76 nm-import-openvpn: remove old code for 'dev' option 2016-11-10 20:56:44 +01:00
Jiří Klimeš 79643ce28a nm-import-openvpn: parse quoted string as a single word
It is necessary, for example, for this to work:
verify-x509-name "C=US, L=Cambridge, CN=GNOME, emailAddress=networkmanager-list@gnome.org" subject
2016-11-10 20:56:44 +01:00
Jiří Klimeš c4ed2483b2 nm-import-openvpn: import 'verify-x509-name' option
https://git.gnome.org/browse/network-manager-openvpn/commit/?id=b51b3562ce079cc0be426e968fe1c90faadc0efd
2016-11-10 20:56:44 +01:00
Jiří Klimeš bc446c3ab8 nm-import-openvpn: improve importing 'comp-lzo' option
https://bugzilla.gnome.org/show_bug.cgi?id=769177
https://bugzilla.redhat.com/show_bug.cgi?id=1355688
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833166
https://git.gnome.org/browse/network-manager-openvpn/commit/?id=62bdd278d69cc396479af9d05a0b776d5ad386bf
2016-11-10 20:56:44 +01:00
Jiří Klimeš e58cfa4fc1 nm-import-openvpn: improve parsing and checking 'route' option 2016-11-10 20:56:44 +01:00
Jiří Klimeš f7e4b748e1 nm-import-openvpn: import 'ns-cert-type' option
https://bugzilla.gnome.org/show_bug.cgi?id=719430
https://git.gnome.org/browse/network-manager-openvpn/commit/?id=644e55ed404edbc953e323d13c57297b53cc0f8b
2016-11-10 20:56:44 +01:00
Jiří Klimeš 978328712b nm-import-openvpn: import 'tls-cipher' option
https://bugzilla.gnome.org/show_bug.cgi?id=763484
https://git.gnome.org/browse/network-manager-openvpn/commit/?id=d7a84afe1d1948c7990a08b18913e65550c222a0
2016-11-10 20:56:44 +01:00
Jiří Klimeš 367d13a7dd nm-import-openvpn: import 'max-routes' option
https://bugzilla.gnome.org/show_bug.cgi?id=720097
https://git.gnome.org/browse/network-manager-openvpn/commit/?id=c4d45e51280d5b0cb8c5e8f826d68c3262162080
2016-11-10 20:56:44 +01:00
Jiří Klimeš 966e0fb50e nm-import-openvpn: import 'tun-ipv6' option
https://bugzilla.gnome.org/show_bug.cgi?id=761907
https://git.gnome.org/browse/network-manager-openvpn/commit/?id=ffda527d8a932f2e3419d6c64623540e5b190d9e
2016-11-10 20:56:44 +01:00
Thomas Haller febbeb4dc9 build: merge branch 'th/build-create-exports' 2016-11-10 18:31:15 +01:00
Thomas Haller 7b78a931df build: generate src/NetworkManager.ver during build
This adds 0.4 seconds to the build time.

You can disable it by setting $NM_BUILD_NO_CREATE_EXPORTS environment
variable. This is useful in the unexpected case that the script
is broken.
Or, if you just want to use a different, non-generated version-script.
Or, if you want to save 0.4 seconds build-time.
2016-11-10 18:30:38 +01:00
Thomas Haller aa3e44984a build: don't change directory in tools/create-exports-NetworkManager.sh
We shall call it from the makefile, thus the current directory is
$(top_builddir), which is just what we need.
2016-11-10 18:30:38 +01:00
Thomas Haller f71d1dfffb build: improve tools/create-exports-NetworkManager.sh script
- include symbols from the "B" section.
- improve the script, to use libNetworkManager.a instead
  of the NetworkManager binary. The former is before stripping
  symbols.
2016-11-10 18:30:38 +01:00
Thomas Haller dc8ed66a19 build: fix symbol version file for _nm_device_factory_no_default_settings
Strange, didn't get this failure before...

    ./src/NetworkManager: symbol lookup error: ./src/devices/wifi/.libs/libnm-device-plugin-wifi.so: undefined symbol: _nm_device_factory_no_default_settings
2016-11-10 18:30:38 +01:00
Thomas Haller 5f00a20f38 contrib/rpm: fix wrong configure options in spec file 2016-11-10 18:30:38 +01:00
Lubomir Rintel 7700efad18 build: don't build the wimax nsp bindings
Added accidentally by the object-manager branch.
2016-11-10 18:11:24 +01:00
Lubomir Rintel d441271109 libnm/client: drop some unneeded includes 2016-11-10 18:11:15 +01:00
Lubomir Rintel b9f9864bc4 merge: branch 'lr/object-manager'
https://bugzilla.gnome.org/show_bug.cgi?id=771191
2016-11-10 16:54:46 +01:00
Lubomir Rintel 1f5b48a59e libnm: use the o.fd.DBus.ObjectManager API for object management
This speeds up the initial object tree load significantly. Also, it
reduces the object management complexity by shifting the duties to
GDBusObjectManager.

The lifetime of all NMObjects is now managed by the NMClient via the
object manager. The NMClient creates the NMObjects for GDBus objects,
triggers the initialization and serves as an object registry (replaces
the nm-cache).

The ObjectManager uses the o.fd.DBus.ObjectManager API to learn of the
object creation, removal and property changes. It takes care of the
property changes so that we don't have to and lets us always see a
consistent object state.  Thus at the time we learn of a new object we
already know its properties.

The NMObject unfortunately can't be made synchronously initializable as
the NMRemoteConnection's settings are not managed with standard
o.fd.DBus Properties and ObjectManager APIs and thus are not known to
the ObjectManager.  Thus most of the asynchronous object property
changing code in nm-object.c is preserved. The objects notify the
properties that reference them of their initialization in from their
init_finish() methods, thus the asynchronously created objects are not
allowed to fail creation (or the dependees would wait forever). Not a
problem -- if a connection can't get its Settings, it's either invisible
or being removed (presumably we'd learn of the removal from the object
manager soon).

The NMObjects can't be created by the object manager itself, since we
can't determine the resulting object type in proxy_type() yet (we can't
tell from the name and can't access the interface list). Therefore the
GDBusObject is coupled with a NMObject later on.

Lastly, now that all the objects are managed by the object manager, the
NMRemoteSettings and NMManager go away when the daemon is stopped. The
complexity of dealing with calls to NMClient that would require any of
the resources that these objects manage (connection or device lists,
etc.) had to be moved to NMClient. The bright side is that his allows
for removal all of the daemon presence tracking from NMObject.
2016-11-10 16:48:48 +01:00