Commit graph

17088 commits

Author SHA1 Message Date
Lubomir Rintel e947739dd6 build: avoid passing enums-to-docbook.pl to itself on its command line 2017-03-16 17:11:29 +01:00
Lubomir Rintel 2198f73b0e build: delete unsuccessfully built artifacts
We use output redirection in numerous places; leaving the half-built
artifacts in place would cause the subsequent builds to succeed when it
should not.
2017-03-16 17:10:51 +01:00
Thomas Haller 6197c27f24 device,default-route-manager: merge branch 'th/default-route-resync' 2017-03-16 15:58:32 +01:00
Thomas Haller 82bfb6c46d default-route-manager: decryptify logging line for default-route-manager
The default route manager logs for each entry relevant information,
in a compact but cryptic way:

  default-route: entry[0/dev:0x5633d5528560:enp0s25:1:+sync]: record:add    0.0.0.0/0 via 192.168.0.1 dev 2 metric 100 mss 0 rt-src user (100)

The flag whether a route is configured or not, was only expressed
via 0|1. Change that to log instead:

  default-route: entry[0/dev:0x5633d5528560:enp0s25:+has:+sync]: record:add    0.0.0.0/0 via 192.168.0.1 dev 2 metric 100 mss 0 rt-src user (100)
2017-03-16 15:58:13 +01:00
Thomas Haller c3c251ea12 default-route-manager: alyways force a sync of the default route
Whenever we call update for a non-assumed, synced route, we must
force a resync with the platform. Even if according to our internal
book-keeping the route is already configured, the route may have
been removed externally. So we cannot assume that everything is
still up-to-date.

https://bugzilla.redhat.com/show_bug.cgi?id=1431268
2017-03-16 15:56:33 +01:00
Thomas Haller 0057dc332e default-route-manager: use nm_cmp_uint32_p_with_data() instead of reimplementation 2017-03-16 15:35:13 +01:00
Thomas Haller e181956fdd default-route-manager: add nm_default_route_manager_resync() function 2017-03-16 15:35:13 +01:00
Thomas Haller 70ab174e0e default-route-manager: simplify _platform_changed_cb() handling
There is only one caller of _platform_ipx_route_changed_cb(). Inline it,
it is simpler.
2017-03-16 15:35:13 +01:00
Thomas Haller 0b3ba99409 default-route-manager: simplify determining synced flag in _ipx_update_default_route()
No change in behavior at all. The same logic applies, but this should
be simpler to understand.
2017-03-16 15:35:13 +01:00
Thomas Haller 6466b5da6a device: force restart of IP method during reapply
Scenario:
Have a connection with DHCPv4 and a default-route. When externally
removing the default route (`ip route delete 0.0.0.0/0`) and issuing
`nmcli device reapply $IF`, the default route was not restored.
That was because when externally removing the default route,
we would remove the gateway from priv->con_ip4_config (see
update_ip4_config()). Later, when reapplying the connection,
the IP method doesn't actually change. So we would not restart
DHCP and thus there is no gateway around to add the default route.
The default route would only be restored after receiving a DHCP lease
in the far future.

Fix that, by always restarting the IP method.
2017-03-16 15:35:13 +01:00
Thomas Haller 624347baf7 device: on reapply reset commit_first_time flag
Based on this flag, we decide that:
  - if we are not gonna commit the first time and the
    connection is configured with never-default, we
    would not remove a default route added externally.

During a reapply, we however want to get rid of an externally
configured default route.
2017-03-16 15:35:12 +01:00
Thomas Haller c2dc1c6fa3 shared/trivial: minor style fixes in "nm-utils/nm-macros-internal.h" 2017-03-16 12:09:22 +01:00
Beniamino Galvani b278b2cd72 device: ethernet: fix handling of autoconnect retries for non-802.1x
Commit 4a6fd0e83e ("device: honor the connection.autoconnect-retries
for 802.1X") added a reset of the autoconnect retries when the device
changes state, because the retry logic for 802.1x is implemented in
NMDeviceEthernet. For other connections, we should not reset the
retries as NMPolicy handles them.

Fixes: 4a6fd0e83e
2017-03-15 16:45:49 +01:00
Beniamino Galvani 4987ec408a device: fail DHCPv6 if a link-local address is not present
Instead of throwing an assertion, fail DHCPv6 when a IPv6 link-local
address is not configured on the device. There are different reasons
why the assertion may fail: for example the address was removed
externally; or the device is gone (and thus the platform already
received the notification of addresses removal) but the device is still
connecting because its disposal happens in an idle callback.

None of these deserves an assertion, which should only be for
programming errors.

https://bugzilla.redhat.com/show_bug.cgi?id=1432251
2017-03-15 16:33:05 +01:00
Thomas Haller a1325ebd75 manager: don't schedule devices_inited_cb() a second time
The devices_inited_cb() callback is really supposed to only run
when there is nothing else left in the mainloop to dispatch.

But as we already schedule the idle action with G_PRIORITY_LOW+10
priority, it is very unlikely that there is anything else ready
to run (unless scheduled with an even lower priority, and then it
wouldn't help either because devices_inited_cb() would win again).
2017-03-15 12:16:08 +01:00
Thomas Haller 7cb3928c49 core: merge branch 'th/startup-complete-race-bgo779920'
https://bugzilla.gnome.org/show_bug.cgi?id=779920
2017-03-15 10:40:17 +01:00
Thomas Haller c8934fbe0d device: remove macro for logging in _set_unmanaged_flags()
The macro is used exactly once. It's simpler to just write the
logging statement down as is.
2017-03-15 10:33:44 +01:00
Thomas Haller 0d1c8bc9eb manager: disconnect NMSetting's startup-complete notification in check_if_startup_complete()
This doesn't really matter, because NMSetting's startup-complete never
switches back to FALSE once reached. Still, cleanup our signal handlers
when no longer needed.

And disconnect the signals before emitting "notify::startup".
2017-03-15 10:33:44 +01:00
Thomas Haller 59dc6298c0 manager: delay startup-complete and devices-inited until idle
As long as there are events in the mainloop that are ready
for dispatch, it's clear that startup-complete is not yet
reached.

https://bugzilla.gnome.org/show_bug.cgi?id=779920
2017-03-15 10:33:44 +01:00
Thomas Haller 4d71327c82 manager: process events of platform cache during nm_manager_start()
Possibly pending messages from the netlink socket were not processed
since the platform instance was created earlier. As nm_manager_start()
may take a long time to run, make sure that there are no pending
messages before querying the devices.
2017-03-15 10:33:44 +01:00
Thomas Haller 6845b9b80a device: delay startup complete until device is initialized in platform
Udev may be slow at startup and it may take a while until the
device is visible in udev. Before that, there are no pending
actions yet because the device is still in unmanaged state.

Hack nm_device_has_pending_action() to indicate a pending action
when the platform link is not yet initialized.
We don't bother using nm_device_add_pending_action() to schedule
a proper pending-action. It is simpler this way, also we precisely
log about the state of NM_UNMANAGED_PLATFORM_INIT flag. The pending
actions are implemented in their way mostly for logging purpose to
understand what blocks a device. For NM_UNMANAGED_PLATFORM_INIT we
have sufficient logging so no need for the overhead and effort.

https://bugzilla.gnome.org/show_bug.cgi?id=779920
2017-03-15 10:33:44 +01:00
Thomas Haller 22b7282d84 all: use "unsigned" instead of "unsigned int" 2017-03-14 11:26:29 +01:00
Thomas Haller b1eeb00937 all: use "unsigned long" instead of "long unsigned" 2017-03-14 11:23:46 +01:00
Thomas Haller e207e53450 all: use "static inline" instead of "inline static" 2017-03-14 11:23:46 +01:00
Thomas Haller 85468e39f1 device: clear deactivating_cancellable in dispose()
It is most likely not needed. Add it just to be sure.
2017-03-13 12:03:48 +01:00
Thomas Haller ec2681d4db all: use nm_clear_g_cancellable() 2017-03-13 12:00:23 +01:00
Lubomir Rintel e1ea22ca81 ifcfg-rh: drop an unused variable
nms-ifcfg-rh-reader.c:497:25: error: unused variable 'local_error' [-Werror,-Wunused-variable]
                gs_free_error GError *local_error = NULL;
                                      ^

Fixes: 40e1fd9531
2017-03-10 14:36:37 +01:00
Lubomir Rintel e3c87e80de build: allow longer manual page titles
Otherwise the docbook template chops off the "NM-SETTINGS-IFCFG-RH"
title; even in the middle of an escape sequence.
2017-03-10 14:35:18 +01:00
Thomas Haller 6aa4dc1958 platform: implement NM_LINUX_PLATFORM_GET_PRIVATE() via _NM_GET_PRIVATE_VOID() macro
We should implement all our private-getters with the very same pattern
(i.e. their type structure contains a field "_priv" and nm_assert()
with a GObject type check).

NM_LINUX_PLATFORM_GET_PRIVATE() was already doing all of that. Now just
use the _NM_GET_PRIVATE_VOID() macro which formally follows the
intended pattern.
2017-03-10 11:43:41 +01:00
Thomas Haller 7d88bd24f3 shared: add _NM_GET_PRIVATE_VOID() macro
_NM_GET_PRIVATE() macro is used to implement a standard private-getter, but it
requires that "self" is a pointer of either "const type *" or "type *". That
is great in most cases, but sometimes we have predominatly self pointers of
different type, so it would require a lot of casts.

Add a different form _NM_GET_PRIVATE_VOID() where self pointer can be any
non-const pointer and returns a non-const private pointer after casting.
2017-03-10 11:06:02 +01:00
Thomas Haller 3ce22c7319 platform/tests: use NMTST_WAIT_ASSERT() to wait for address 2017-03-09 23:06:08 +01:00
Beniamino Galvani 7ef2651d71 merge: branch 'bg/reapply-more-bgo779794'
https://bugzilla.gnome.org/show_bug.cgi?id=779794
2017-03-09 22:00:41 +01:00
Beniamino Galvani c4ca123a4a device: reapply proxy configuration
In order to support a reapply of proxy configuration, remember the PAC
URL received through DHCP and merge it again with configuration from
proxy setting on reapply.
2017-03-09 21:58:28 +01:00
Beniamino Galvani ad3fdcd90d device: allow reapply of MTU
The MTU is reapplied together with IP configuration: modify device
subclasses to announce they support the property in
can_reapply_change().
2017-03-09 21:58:28 +01:00
Beniamino Galvani 9cc9ce4bfa device: reapply connection.lldp property 2017-03-09 21:58:28 +01:00
Beniamino Galvani 3f5f5ed4eb device: ethernet: reapply link speed and wol settings 2017-03-09 21:58:28 +01:00
Beniamino Galvani 686fea6562 platform: tests: wait for non-tentative address before adding route
Wait that the address becomes non-tentative before adding the route
with RTA_PREFSRC.  Dummy interfaces are NOARP and thus don't do DAD,
but the kernel sets the address as tentative for a small amount of
time, which prevents the immediate addition of the route with
preferred source.

Fixes: 36d9e252d2
2017-03-09 19:01:59 +01:00
Thomas Haller 74f62d21ce platform/tests: add test code to initialize NMPCacheId with bogus data 2017-03-09 15:50:20 +01:00
Thomas Haller f0e295d3d7 platform: filter out invisible links for cache lookup by name
Fixes: ad1d74d142
2017-03-09 15:12:43 +01:00
Thomas Haller 3799874664 platform: fix check in NMP_CLASS_IS_VALID
Maybe it was not wrong before, but this looks more
correct.
2017-03-09 15:12:43 +01:00
Thomas Haller 2972fd55bf platform/trivial: remove obsolete code comment 2017-03-09 14:57:00 +01:00
Thomas Haller 831286df30 include: use double-quotes to include our own headers
In practice, this should only matter when there are multiple
header files with the same name. That is something we try
to avoid already, by giving headers a distinct name.

When building NetworkManager itself, we clearly want to use
double-quotes for including our own headers.
But we also want to do that in our public headers. For example:

  ./a.c
    #include <stdio.h>
    #include <nm-1.h>
    void main() {
        printf ("INCLUDED %s/nm-2.h\n", SYMB);
    }

  ./1/nm-1.h
    #include <nm-2.h>

  ./1/nm-2.h
    #define SYMB "1"

  ./2/nm-2.h
    #define SYMB "2"

$ cc -I./2 -I./1 ./a.c
$ ./a.out
INCLUDED 2/nm-2.h

Exceptions to this are
  - headers in "shared/nm-utils" that include <NetworkManager.h>. These
    headers are copied into projects and hence used like headers owned by
    those projects.
  - examples/C
2017-03-09 14:12:35 +01:00
Beniamino Galvani afd1bde366 device: ip-tunnel: free strings on dispose
Fixes: 570fdce93f
2017-03-09 12:05:59 +01:00
Thomas Haller fada1da80b systemd: merge branch systemd into master 2017-03-09 01:04:15 +01:00
Thomas Haller 41eae0d5bd systemd: update code from upstream (2017-03-08)
This is a direct dump from systemd git on 2017-03-08, git commit
37377227ff47aa88c698c4b704d68d600d695c9f.

======

SYSTEMD_DIR=../systemd
COMMIT=37377227ff47aa88c698c4b704d68d600d695c9f

(
  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"
2017-03-09 01:03:49 +01:00
Francesco Giudici b17d28cb42 test: platform: remove the source parameter from the ip6 route option test
The test fails on some kernels. Needs more investigations.
In the meanwhile, remove the src option from the test.

Fixes 45dc2feded
2017-03-08 19:04:48 +01:00
Thomas Haller 2ab946502d core/tests: add test for nm_match_spec_device() to match "except:*"
We also allow negative matches for plain "*", meaning to explicitly
not manage anything.
2017-03-08 16:34:52 +01:00
Thomas Haller ab6e370195 all/trivial: unify construct-only property comments
Unify marking GObject properties that are G_PARAM_CONSTRUCT_ONLY
with a comment

    /* construct-only */
2017-03-08 13:47:00 +01:00
Thomas Haller 556b7c3b45 libnm: add assertion to NMObject that a dbus-object is set
The libnm cache types don't have public _new() functions.
However, such types can be easily created using g_object_new()
directly from user code.

Such a usage is not supported. Add an assertion that a valid
dbus-object is present.
2017-03-08 08:16:44 +01:00
Thomas Haller 9ed0e3705e libnm: chain up NMRemoteConnection::constructed() function
Fixes: 0fdd71fe6e
2017-03-07 23:47:43 +01:00