Commit Graph

18477 Commits

Author SHA1 Message Date
Beniamino Galvani
e89ed9b51e ifcfg-rh: write DEVICE only once
The plugin already writes DEVICE in write_connection_setting(), there
is no need to write it again elsewhere.
2017-09-25 22:36:43 +02:00
Thomas Haller
18f53a8b30 contrib/scripts: update coloring for platform messages in NM-log (2)
Fixes: 9344013977
2017-09-25 18:36:08 +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
Thomas Haller
9344013977 contrib/scripts: update coloring for platform messages in NM-log 2017-09-25 15:13:02 +02:00
Thomas Haller
5819988ac7 platform: cleanup logging for adding link
No need for duplicate log lines

  <debug> [1506146476.8462] platform: link: adding tap tap0 owner 107 group -1
  <debug> [1506146476.8462] platform-linux: link: add tap tap0 owner 107 group -1

Merge them.

Also, for consistency change the logging output for adding generic
interfaces in nm_platform_link_add().
2017-09-25 14:49:44 +02:00
Iain Lane
b18896f770 {vpn,remote}-connection: disconnect signal handlers when disposed
GNOME Settings 3.26 is crashing every time a VPN connection changed its
state. After some digging, a debug message was put on dispose, and this
issue was found:

libnm-Message: Object 0x55555633c070 disposed
libnm-Message: Object 0x55555633c730 disposed
libnm-Message: Object 0x55555633eae0 disposed
libnm-Message: Object 0x555556340a80 disposed

Thread 1 "gnome-control-c" received signal SIGSEGV, Segmentation fault.
g_type_check_instance_cast (type_instance=type_instance@entry=0x55555633c070, iface_type=93825006537856) at /.../glib/gobject/gtype.c:4057
4057		  node = lookup_type_node_I (type_instance->g_class->g_type);
(gdb) bt

NetworkManager is calling callbacks on disposed objects, which leads to
crashes in clients (e.g. GNOME Settings).

Fix this issue by disconnecting signal handlers when the objects are
disposed.

Patch originally by Georges Basile Stavracas Neto <georges.stavracas@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=787893
2017-09-22 14:16:50 +02:00
Iain Lane
91fa202379 manager: Disconnect from signals on the proxy when we're disposed
We're calling a callback on a proxy after it has been disposed. We
should make sure to disconnect from it when we go away.

https://bugzilla.gnome.org/show_bug.cgi?id=787897
2017-09-22 14:15:53 +02:00
Francesco Giudici
15344be0e1 device: avoid touching IPv6 on "external" connections without IPv6 conf
When a device managed by NetworkManager is configured manually (adding
ip addresses), NetworkManager will track the device configuration with
an in-memory only config, marking the device as "external".
Devices marked external should be just tracked but left untouched.
This does not happens on current code base: if an ipv4 address is added,
NM generates the in-memory connection, marking the ipv6.method as "ignore".
While activating the connection, NM will process the IPv6 "ignore" method:
this implies leaving the IPv6LL address generation to the kernel. To
trigger this NM will disable/enable IPv6 on the interface.
This not only may change the device configuration but may cause also
a potential race with an external IPv6 assignment on the device.

NetworkManager should do nothing to IPv6 when method is "ignore" and
connection is marked as "external": this commit fixes this behavior.
Note that if/once an IPv6 address is externally added, IPv6 method in the
tracked connection is changed to "manual" and a link local address will be
generated if needed.

https://bugzilla.redhat.com/show_bug.cgi?id=1462260
2017-09-22 13:19:10 +02:00
Beniamino Galvani
2f66fbf32d build: add missing header file to Makefile
Fixes: 734c5b38ad
2017-09-22 12:06:11 +02:00
Thomas Haller
734c5b38ad dhcp: use systemd defines for DHCP options 2017-09-21 15:49:48 +02:00
Thomas Haller
61f0f198bf systemd: merge branch systemd into master 2017-09-21 15:33:32 +02:00
Thomas Haller
eba874f859 systemd: update code from upstream (2017-09-21)
This is a direct dump from systemd git on 2017-09-21, git commit
f679ed61163468f4fb2d4a17fa0984c8c1f0ba36.

======

SYSTEMD_DIR=../systemd
COMMIT=f679ed61163468f4fb2d4a17fa0984c8c1f0ba36

(
  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/process-util.h"
nm_copy_sd "src/basic/process-util.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-09-21 15:08:50 +02:00
Lucas Rangit Magasweran
843ea77e93 examples: linker requires that library dependencies follow use
On modern distributions, ld runs with the '--as-needed' option
enabled by default, meaning library dependencies must come after
files that require them. Also, this allows indirect linking so the
build commands can be simplified.

The alternative is to add the '-Wl,--no-as-needed' gcc option or
use the top-level Makefile.

Tested on:
 * Ubuntu 16.04.3 with gcc Ubuntu 5.4.1-8ubuntu1
 * Fedora 24 with gcc Red Hat 6.1.1-3

Signed-off-by: Lucas Magasweran <lucas.magasweran@ieee.org>

https://mail.gnome.org/archives/networkmanager-list/2017-September/msg00022.html
https://mail.gnome.org/archives/networkmanager-list/2017-September/msg00023.html
https://mail.gnome.org/archives/networkmanager-list/2017-September/msg00025.html
2017-09-21 13:14:56 +02:00
Thomas Haller
8022ed3ab2 core: avoid maybe-uninitialized compiler warning with nmp_cache_iter_for_each()
CC       src/devices/src_libNetworkManager_la-nm-device.lo
  In file included from src/devices/nm-device.c:45:0:
  src/devices/nm-device.c: In function ‘_v4_has_shadowed_routes_detect’:
  ./src/platform/nmp-object.h:400:54: error: ‘o’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     _obj ? &_NM_CONSTCAST (NMPObject, _obj)->ip4_route : NULL; \
                                                        ^
  src/devices/nm-device.c:2774:19: note: ‘o’ was declared here
    const NMPObject *o;
                     ^
2017-09-21 13:14:56 +02:00
Thomas Haller
85e3f956ad contrib/rpm: update spec file with upstream source URL
This isn't useful for contrib/fedora/rpm itself because here
the __SOURCE__ gets set by the build scripts.

But this spec file is copied to Fedora downstream where the
SOURCE URL is used.
2017-09-20 14:29:53 +02:00
Beniamino Galvani
7af471919a cli: wifi: connect with PSK when the AP supports WPA-PSK and WPA-EAP
'nmcli device wifi connect' only supports WEP and WPA-PSK at the
moment, but not WPA-EAP. If the AP supports both WPA-PSK and WPA-EAP,
nmcli doesn't add the PSK to the connection, causing a connection
failure. Fix this.

https://bugzilla.redhat.com/show_bug.cgi?id=1492064
2017-09-20 09:23:54 +02:00
Beniamino Galvani
05618aaaf3 core: merge branch 'bg/manager-parent-warnings-rh1490157'
https://bugzilla.redhat.com/show_bug.cgi?id=1490157
2017-09-20 08:07:05 +02:00
Beniamino Galvani
b53f8de08b vlan: improve error message on missing parent ifindex
The message should only tell what went wrong.
2017-09-20 08:01:02 +02:00
Beniamino Galvani
41b0e8c5a5 manager: downgrade error message for missing dependencies
At startup the manager tries to create virtual devices without a
specific order and spits warnings when a device can't be realized
because the parent device is not yet created. These failures are not
something the user should worry about because the creation will be
retried when the parent appears.

A better approach is to return an error code from the device's
create_and_realize() telling that it failed because the parent doesn't
exist. In this way, the manager knows that the device isn't ready and
can avoid printing warning messages.
2017-09-20 08:01:02 +02:00
Beniamino Galvani
74845f80ec manager: try other connections only after the device is realized
After a device is created in system_create_virtual_device(), the
manager tries to activate connections that depend on the device
even if the device isn't realized, as in the following log:

 # team0 gets created
  <info>  manager: (team0): new Team device (/org/freedesktop/NetworkManager/Devices/7)

 # team0.23 gets created
  <debug> device[0x28079b0] (team0.23): constructed (NMDeviceVlan)
  <debug> manager: (team0-vlan23) create virtual device team0.23
  <debug> device[0x28079b0] (team0.23): unmanaged: flags set to [platform-init,!sleeping=0x10/0x11/unmanaged/unrealized], set-managed [sleeping
  <info>  manager: (team0.23): new VLAN device (/org/freedesktop/NetworkManager/Devices/8)

 # the manager tries to realize team0.23
  <debug> device[0x28079b0] (team0.23): create (is nm-owned)
  <warn>  manager: (team0-vlan23) couldn't create the device: cannot retrieve ifindex of interface team0 (Team): skip VLAN creation for now
  <debug> manager: (team0.23): removing device (allow_unmanage 1, managed 0)
  <debug> device[0x28079b0] (team0.23): ip4-config: update (commit=0, new-config=(nil))
  <debug> device[0x28079b0] (team0.23): ip6-config: update (commit=0, new-config=(nil))
  <debug> device[0x28079b0] (team0.23): disposing
  <debug> device[0x28079b0] (team0.23): ip4-config: update (commit=1, new-config=(nil))
  <debug> device[0x28079b0] (team0.23): ip6-config: update (commit=1, new-config=(nil))
  <debug> device[0x28079b0] (team0.23): finalize(): NMDeviceVlan

 # the manager realizes team0
  <debug> device[0x2800870] (team0): create (is nm-owned)
  <debug> platform: link: add link 'team0' of type 'team' (196610)

Change the order of operations and try the child connection only after
the parent has been realized.
2017-09-20 07:54:13 +02:00
Thomas Haller
03e1cc96a5 core: fix handling IPv6 device-route and use correct route metric
Before commit 6698bf58bb, we would rely on
kernel to add the device-route for manual IPv6 routes. We broke that and now
kernel would still add the device-route, however nm_platform_ip_route_sync()
would delete it immediately after.
That is because previously nm_platform_ip_route_sync() would ignore routes
with rtm_protocol RTPRO_KERNEL. Now, it will sync and delete those too.

Fix that by adding the device-route like we do it for IPv4. This also
fixes an actual issue where the automatically added route always had
route-metric 256. Instead, we now use the metric from ipv6.route-metric
setting.

Fixes: 6698bf58bb
2017-09-19 11:49:29 +02:00
Thomas Haller
39d30a170d man: fix docu of AUTOCONNECT_SLAVES variable in nm-settings-ifcfg-rh
Fixes: 6caafab258

https://bugzilla.redhat.com/show_bug.cgi?id=1492912
2017-09-19 08:35:16 +02:00
Thomas Haller
63104b7213 ifcfg-rh: merge branch 'th/ifcfg-route-parse'
https://github.com/NetworkManager/NetworkManager/pull/28
2017-09-18 20:15:07 +02:00
Thomas Haller
6d675a943b ifcfg-rh: refactor parsing of route options to be strict
The previous parsing was done using regex. One could implement a
complex regex to parse the setting. However, as it was implemented,
the regex would just pick out parts of the line that it expects,
and ignore unknown parts.

Let's be strict about what we parse. The only strong requirement
is that NM can parse everything that was written by NM itself.
Eventually, we could extend the parser to accept everything that
initscripts accept.

Initscripts split the line at $IFS and do filename globbing on the
arguments. That is ugly, because globbing is of coures wrong (we don't
do that). But also, the splitting at $IFS cannot be escaped, hence for
initscripts it is impossible to use '<space><tab><newline>'. We do that
too, as it makes it easy to parse. Later we may want to extend this to
allow a form of escaping/quoting.

Yes, we may now ignore routes that are not defined as we expect them.
2017-09-18 20:14:09 +02:00
Thomas Haller
62f2c4cf20 ifcfg-rh: write lock route attribute with zero value
Only specifying "lock" without a corresponding attribute shall have
the meaning of "$NAME lock 0".
2017-09-18 20:14:09 +02:00
Thomas Haller
e54fad0886 ifcfg-rh: refactor code to avoid unnecessary copies
svGetValueStr() is preferred over svGetValueStr_cp() because it may safe
an additional string copy (if the value needs no unescaping/unquoting).

Also, use nm_utils_strsplit_set() because it saves to copy each word.

There are some changes here. For example, read_8021x_list_value()
previously would not strip empty words. When switching from
g_strsplit_set() to nm_utils_strsplit_set(), empty words are implicitly
skipped.
2017-09-18 20:14:09 +02:00
Thomas Haller
b1029c6198 ifcfg-rh/trivial: rename function that are only for testing
We have similar functions, like _nmtst_ip4_config_del_route(). Rename testing
functions to have "_nmtst_" prefix for consistency.
2017-09-18 20:14:09 +02:00
Thomas Haller
daa4604c12 shared: add nm_utils_strsplit_set() helper
A replacement for g_strsplit_set(). While g_strsplit_set()
does (n+1) malloc and n slice allocations, this needs
roughtly (O(log(n))) mallocs.

Another difference from g_strsplit_set() is that this function
treats multiple delimiters as one (and thus never returns empty
words). While I can see that sometimes you may want to keep empty
words (like parsing a CSV file and preserve empty cells), we usually
use this function for splitting user input. In such case, we want
to treat multiple delimiters as one.
2017-09-18 20:14:09 +02:00
Thomas Haller
f6a727685e shared: add nm_utils_parse_inaddr_prefix_bin() helper 2017-09-18 20:14:09 +02:00
Thomas Haller
dd0617547d shared: add NMIPAddr struct 2017-09-18 20:14:09 +02:00
Thomas Haller
569b443233 shared: add nm-glib.h compat implementation for g_variant_new_printf() 2017-09-18 20:14:09 +02:00
Beniamino Galvani
3be7910520 bluetooth: drop unused function declaration 2017-09-18 18:56:50 +02:00
Beniamino Galvani
87e17d96df bluetooth: generate connections only for paired devices
It makes little sense to have a connection while the device is not
paired.

https://bugzilla.gnome.org/show_bug.cgi?id=787440
2017-09-18 18:50:08 +02:00
Francesco Giudici
dcaed616f7 dhcp: merge branch 'fg/persistent_dhcp_rh1350830'
https://bugzilla.redhat.com/show_bug.cgi?id=1350830
2017-09-18 18:45:48 +02:00
Francesco Giudici
e04c9af5fd nmcli: allow to set dhcp-timeout as "infinity"
DHCP timeout may now be explicitly disabled by setting the
ipv[4,6].dhcp-timeout options to "infinity".
This will set the DHCP timeout value to MAXINT32.
2017-09-18 18:44:43 +02:00
Francesco Giudici
a245554984 dhcp: consider a timeout equal to MAXINT32 as infinity
This will avoid to spawn internally a timer for the lease to complete.
2017-09-18 18:44:43 +02:00
Beniamino Galvani
239c59a627 src/devices: use macros for property and signal names 2017-09-18 15:40:31 +02:00
Thomas Haller
289f0f703f core: fix tracking default-route during device's merge and apply
If we don't commit the IP config, we must merge the currently tracked
default route. Otherwise, on every non-commit call of
ip4_config_merge_and_apply(), the default-route gets lost.

Fixes: 77ec302714
2017-09-18 09:58:58 +02:00
Thomas Haller
2cc1813340 core: workaround configuring IPv6 routes with "src" (RTA_PREFSRC)
Kernel does not allow to add IPv6 routes with "src", as long as the
corresponding address is still tentative (related bug rh#1457196).

The workaround for this is cumbersome. First, when we fail to add such a
route with "pref_src", we guess that it happend due to this issue. In
that case, nm_ip6_config_commit() returns the list of routes that could
not be added for the moment (but hopefully can be added later).

We track this list in NMDevice, and keep trying to merge the routes
back into ip6_config. In order to not try indefinitely, keep track of a
timestamp when we tried to add this route for the first time.

Another uglyness is that pending tentative routes don't explicitly block
activation. In practice they may do, because for these routes we also have
an IPv6 address that is still doing DAD, so the IP configuration is
still pending due to that.

https://bugzilla.redhat.com/show_bug.cgi?id=1452684
2017-09-15 17:28:48 +02:00
Francesco Giudici
1cb4832f09 dhcp: dhclient: remove the --timeout argument from the command line
the --timeout command line option is a custom feature added in some
linux distributions (fedora). Passing that command line argument will
make dhclient fail if the binary does not support it, preventing
activation of dhcp based connections.
Worse, the option has just been recently changed from "-timeout", so
that we are currently incompatibile with Centos, RedHat and older
versions of Fedora too.

Leverage the "timeout" option in dhclient config file: it will produce
the expected behavior and will be universally supported.

Fixes test: dhcp-timeout
Fixes: fa46736013

https://bugzilla.redhat.com/show_bug.cgi?id=1491243
2017-09-15 12:15:55 +02:00
Thomas Haller
8198a3abed man: merge branch 'bg/man-cli-rh1182772'
https://bugzilla.redhat.com/show_bug.cgi?id=1482772
2017-09-13 17:20:16 +02:00
Beniamino Galvani
3a3f4fb9f7 man: nmcli: add missing aliases 2017-09-13 16:38:34 +02:00
Beniamino Galvani
f4aee0c58b man: nmcli: improve description of type, ip4, ip6 aliases
Clarify that the description refers to the alias, not to the property.

https://bugzilla.redhat.com/show_bug.cgi?id=1482772
2017-09-13 16:38:34 +02:00
Thomas Haller
b4c249959d core: merge branch 'th/ip-config-route-id'
https://github.com/NetworkManager/NetworkManager/pull/27
2017-09-13 14:49:36 +02:00
Thomas Haller
6698bf58bb core: track routes with source RTPROT_KERNEL (rtm_protocol) in NMIP4Config/NMIP6Config
Let's not treat those routes special. I think this was originally done, because
we relied on kernel to add the IPv4 device route, so we would ignore RTPROT_KERNEL
routes and not delete them.

We want to track them for various reasons:

 - for consistency, there is nothing special except that they might be
   added by kernel.
 - we expose the routes of NMIP4Config/NMIP6Config on D-Bus. That should
   include also routes such as device routes. Note, this commit changes
   that we now expose device routes on D-Bus too.
2017-09-13 08:17:31 +02:00
Thomas Haller
9a3117f1d3 core: track IPv4 device routes in NMIP4Config
For IPv6, we create device routes when processing the RA and add it to
NMIP6Config like any other route. For IPv4 we didn't do that. Instead
we created the list of device routes during nm_ip4_config_commit() and
passed it to nm_platform_ip_route_sync().
2017-09-13 08:17:31 +02:00
Thomas Haller
4b4efac3ab core: fix merging IP addresses in NMIP4Config/NMIP6Config
When merging IP addresses, we keep the best addr_source and the internally
configured timestamps. Since the check for the timestamp considers addr_source,
we must move the check before merging addr_source.
2017-09-13 08:17:31 +02:00
Thomas Haller
aee48dfd44 core: adjust route equality for NMIP4Config/NMIP6Config to what kernel does
For kernel, route ID compare identical according to NM_PLATFORM_IP_ROUTE_CMP_TYPE_ID.
Well, mostly. In practice, NM ignores several route properties that
kernel considers part of the ID too. This leaves the possibility that
kernel allows addition of two routes that compare idential for
NetworkManager.

Anyway, NMIP4Config/NMIP6Config should use the same equality as platform
cache. Otherwise, there is the odd situation that ip-config merges routes
that are treated as different by kernel.

For IP addresses the ID operator already corresponded to what kernel
does. There is no change for addresses.

Note that NMSettingIPConfig also uses a different algorithm for
comparing routes. But that doesn't really matter here, it it differed
before too.
2017-09-13 08:17:31 +02:00
Thomas Haller
e730ae7600 core/tests: add checks in test for test_add_route_with_source() 2017-09-13 08:17:31 +02:00
Thomas Haller
79cb13bc5c platform: use distinct hash seed for nmp_object_id_hash() of routes 2017-09-13 08:17:31 +02:00