Commit graph

9252 commits

Author SHA1 Message Date
Thomas Haller
cd8f3cf09f tests: work around coverity false-positives
(cherry picked from commit c7c47575ce)
2017-06-02 20:21:11 +02:00
Thomas Haller
38fbdc8118 supplicant: work-around coverify false-positive for check_return: g_async_initable_init_finish()
NetworkManager-1.8.0/src/supplicant/nm-supplicant-interface.c:232: check_return: Calling "g_async_initable_init_finish" without checking return value (as is done elsewhere 7 out of 8 times).

(cherry picked from commit 6f1ea8b8ee)
2017-06-02 20:21:11 +02:00
Thomas Haller
2574393f08 supplicant/tests: work-around coverify false-positive in test
NetworkManager-1.8.0/src/supplicant/tests/test-supplicant-config.c:528: check_return: Calling "nm_setting_802_1x_set_ca_cert" without checking return value (as is done elsewhere 13 out of 16 times).

(cherry picked from commit 7087956870)
2017-06-02 20:21:11 +02:00
Thomas Haller
e984d9eb36 connectivity: fix scheduling periodic connectivity checks
commit a955639 (connectivity: don't do periodic checks on interval=0)
broke scheduling connectivity checks.

That is because the timer is on only scheduled if
nm_connectivity_check_enabled(), which in turn only returns TRUE
if curl_mhandle is set. However, nm_connectivity_init() would only
initialize curl_mhandle after update_config(), missing to schedule
the periodic task.

https://mail.gnome.org/archives/networkmanager-list/2017-May/msg00076.html

Fixes: a95563996f
(cherry picked from commit f1eb1619f1)
2017-06-02 19:42:44 +02:00
Francesco Giudici
1618717170 connectivity: fix typo in error message
(cherry picked from commit 7a2c31a54a)
2017-06-02 19:42:40 +02:00
Thomas Haller
92a277dc6f ifcfg-rh: fix preserving NETMASK key in write_ip4_setting()
To support legacy scripts, we want to write out the NETMASK
key whenever the ifcfg file has a NETMASK key previously.
Note, that we anyway always write the relevant PREFIX key.
The NETMASK is redundant, only there to help legacy scripts.

That was broken, because we would svUnsetValue("NETMASK") before
checking whether the NETMASK key is present.

Also, when saving a connection to ifcfg-rh file that was created
by other tools, we might mix up the numbering. E.g. we never
write out IPADDR0. Hence, turn on legacy mode whenever the ifcfg-rh
file has any key starting with "NETMASK".

(cherry picked from commit 844bf3d1a2)
2017-05-30 13:44:04 +02:00
Thomas Haller
7ebc132864 ifcfg-rh/tests: add test for reading NETMASK property
(cherry picked from commit ba05819c89)
2017-05-30 11:20:23 +02:00
Thomas Haller
3dfddc18a5 ifcfg-rh: add svFindFirstKeyWithPrefix() function
During backporting manually patched to use GList instead of CList.

(cherry picked from commit e9d960740a)
2017-05-30 11:17:44 +02:00
Thomas Haller
2bf3d590ce ifcfg-rh: fix writing NETMASK in write_ip4_setting()
(cherry picked from commit efd462d946)
2017-05-30 11:12:35 +02:00
Francesco Giudici
2c0865db25 device: when setting back a device to managed, update internal sys state
Otherwise a device which was set as unmanaged (updated to the REMOVED
internal sys-state) will never update its own sys-state if later set
back as managed.
Manage either when setting explictly the device to managed either when
just upping a connection on an unmanaged device.

(cherry picked from commit adbf383628)
2017-05-26 16:10:26 +02:00
Francesco Giudici
3c7c273836 device: add the internal interface state to the state change log message
(cherry picked from commit 55b8ba4ddc)
2017-05-26 16:10:18 +02:00
Beniamino Galvani
3fefef8594 core: add configuration flag to choose slaves activation order
Commits 39d0559d9a ("platform: sort links by name instead of
ifindex") and 529a0a1a7f ("manager: sort slaves to be autoconnected
by device name") changed the order of activation of slaves. Introduce
a system-wide configuration property to preserve the old behavior.

https://bugzilla.redhat.com/show_bug.cgi?id=1452585
(cherry picked from commit 31656a066b)
2017-05-24 15:59:58 +02:00
Beniamino Galvani
6110b11235 device: release removed devices from master on cleanup
On cleanup, unconditionally release a device from its master if the
link is missing or it doesn't have a master, otherwise the master
would later try to release the slave, hitting the following assertion:

 "nm_platform_link_release: assertion 'slave > 0' failed"
  #0  g_logv
  #1  g_log
  #2  g_return_if_fail_warning
  #3  nm_platform_link_release
  #4  release_slave
  #5  nm_device_master_release_one_slave
  #6  slave_state_changed
  #7  ffi_call_unix64
  #8  ffi_call
  #9  g_cclosure_marshal_generic
  #10 g_closure_invoke
  #11 signal_emit_unlocked_R
  #12 g_signal_emit_valist
  #14 _set_state_full
  #15 nm_device_state_changed
  #16 nm_device_unrealize
  #17 _platform_link_cb_idle
  #18 g_main_context_dispatch
  #19 g_main_context_dispatch
  #20 g_main_context_iterate
  #21 g_main_loop_run
  #22 main

Fixes: 9e8218f99a

https://bugzilla.redhat.com/show_bug.cgi?id=1448907
(cherry picked from commit 3355a2823b)
2017-05-24 13:44:46 +02:00
Lubomir Rintel
7851f1c595 bluetooth: unhook adapter properties callback when the adapter vanishes
https://bugzilla.redhat.com/show_bug.cgi?id=1454654
(cherry picked from commit 0aa2e0bad3)
2017-05-23 11:39:21 +02:00
Lubomir Rintel
390cfec792 device: capture the IP6 configuration on the IP interface
Fixes a crash with Bluetooth devices where the device is the BlueZ
device and iface stays 0 while the IP interface is the actual BNEP link.

https://bugzilla.gnome.org/show_bug.cgi?id=782545
(cherry picked from commit 30d06b2253)
2017-05-22 17:14:43 +02:00
Beniamino Galvani
4b6955095b device: fix capture of device config in ipX_config_merge_and_apply()
Use nm_device_get_ip_ifindex() to obtain the right ifindex for the
device. Fixes the following:

 nm_platform_ip4_address_get_all: assertion 'ifindex > 0' failed
 #0  _g_log_abort () from target:/lib64/libglib-2.0.so.0
 #1  g_logv () from target:/lib64/libglib-2.0.so.0
 #2  g_log () from target:/lib64/libglib-2.0.so.0
 #3  nm_platform_ip4_address_get_all (self=self@entry=0x1181020, ifindex=ifindex@entry=0) at src/platform/nm-platform.c:2640
 #4  nm_ip4_config_capture (platform=0x1181020, ifindex=ifindex@entry=0, capture_resolv_conf=capture_resolv_conf@entry=0) at src/nm-ip4-config.c:271
 #5  ip4_config_merge_and_apply (self=self@entry=0x1254a70, config=config@entry=0x0, commit=commit@entry=1) at src/devices/nm-device.c:5447
 #6  activate_stage5_ip4_config_commit (self=0x1254a70) at src/devices/nm-device.c:8299
 #7  activation_source_handle_cb (self=0x1254a70, family=family@entry=2) at src/devices/nm-device.c:4421
 #8  activation_source_handle_cb4 (user_data=<optimized out>) at src/devices/nm-device.c:4358
 #9  g_idle_dispatch () from target:/lib64/libglib-2.0.so.0
 #10 g_main_context_dispatch () from target:/lib64/libglib-2.0.so.0
 #11 g_main_context_iterate.isra () from target:/lib64/libglib-2.0.so.0
 #12 g_main_loop_run () from target:/lib64/libglib-2.0.so.0
 #13  main (argc=<optimized out>, argv=<optimized out>) at src/main.c:435

Fixes: a21b8882cc
(cherry picked from commit 6389d637a7)
2017-05-21 15:59:25 +02:00
Beniamino Galvani
cb5ba08f00 ifcfg-rh: omit empty next hop for routes in legacy format
Don't add "via (null)" if the next hop is missing.

https://bugzilla.redhat.com/show_bug.cgi?id=1452648
(cherry picked from commit af8aac9b54)
2017-05-19 17:45:46 +02:00
Thomas Haller
3a96772918 device: sanitze UTF-8 values for D-Bus
ip link add name $'d\xccf\\c' type dummy

Use nm_utils_str_utf8safe_escape() to sanitize non UTF-8 sequences
before exposing them on D-Bus. The operation can be reverted client
side via nm_utils_str_utf8safe_unescape() or simply g_strcompress().

Note that this preserves all valid UTF-8 sequences as-is, with exception
of the backslash escape character and ASCII control characters. Thus, this
is a change in behavior for strings that contain such characters.

Note that nmcli is not changed to somehow unescape the string before
printing. As the string is not valid UTF-8 (or contains ASCII characters
that need escaping), they are not printable as-is, so unescaping before
printing makes little sense.

(cherry picked from commit 0870906540)
2017-05-19 10:07:14 +02:00
Thomas Haller
c3b180198f device: make UDI property construct-only
(cherry picked from commit e216d5eac0)
2017-05-19 10:07:14 +02:00
Thomas Haller
4ae14d3677 device: fix setting device's UDI property
Fixes: e8139f56c2
(cherry picked from commit 5eac18b58d)
2017-05-19 10:07:14 +02:00
Beniamino Galvani
bf28e0845f device: fix crash in ip6_config_merge_and_apply()
nm_ip6_config_capture() returns NULL for slaves. Fixes the following:

 nm_ip6_config_new_cloned: assertion 'NM_IS_IP6_CONFIG (src)' failed

 #0 g_logv () at /lib64/libglib-2.0.so.0
 #1 g_log () at /lib64/libglib-2.0.so.0
 #2 nm_ip6_config_new_cloned (src=0x0) at src/nm-ip6-config.c:2272
 #3 ip6_config_merge_and_apply (self=self@entry=0x200d8f0, commit=commit@entry=1) at src/devices/nm-device.c:6192
 #4 nm_device_bring_up (self=self@entry=0x200d8f0, block=block@entry=1, no_firmware=no_firmware@entry=0x0) at src/devices/nm-device.c:10369
 #5 _hw_addr_set (self=self@entry=0x200d8f0, addr=addr@entry=0x2095ea0 "6A:1C:00:2A:68:7C", operation=operation@entry=0x64f8ba "set", detail=detail@entry=0x67369d "restore") at src/devices/nm-device.c:13225
 #6 nm_device_hw_addr_set (self=self@entry=0x200d8f0, addr=addr@entry=0x2095ea0 "6A:1C:00:2A:68:7C", detail=detail@entry=0x67369d "restore", set_permanent=set_permanent@entry=0) at src/devices/nm-device.c:13255
 #7 release_slave (device=0x200d8f0, slave=0x1ef2990, configure=<optimized out>) at src/devices/nm-device-bond.c:463
 #8 nm_device_master_release_one_slave (self=self@entry=0x200d8f0, slave=slave@entry=0x1ef2990, configure=1, reason=reason@entry=NM_DEVICE_STATE_REASON_CONNECTION_REMOVED) at src/devices/nm-device.c:2041
 #9 slave_state_changed (slave=0x1ef2990, slave_new_state=NM_DEVICE_STATE_DEACTIVATING, slave_old_state=NM_DEVICE_STATE_ACTIVATED, reason=NM_DEVICE_STATE_REASON_CONNECTION_REMOVED, self=0x200d8f0)
     at src/devices/nm-device.c:3366
 ...

Fixes: a21b8882cc
(cherry picked from commit 1e78f50b8e)
2017-05-17 09:52:53 +02:00
Beniamino Galvani
bf5407992f device: update external configuration before commit
If the platform signaled that the external configuration changed (and
thus update_ipX_config() is scheduled) and we are doing a commit of
the new configuration, update priv->ext_ipX_config. Without this, the
commit will remove addresses added externally but not yet captured in
the external configuration.

https://bugzilla.redhat.com/show_bug.cgi?id=1449873
(cherry picked from commit a21b8882cc)
2017-05-16 11:42:48 +02:00
Beniamino Galvani
cbf5a776f7 dhcp: don't add route to DHCP4 server
This basically reverts commit 31fe84e467 "core: Add host route for
DHCP4 server if outside assigned subnet (bgo #721767)" because the
additional route added by NM does more harm than good.

First, the code does not consider routes pushed by the server and thus
it can add a route conflicting with the ones from the network
administrator.

Second, there is no specification on what a DHCP client should do when
the server is not reachable via unicast, and adding arbitrary logic
into the client is likely to break things in specific cases. If
network administrators want to make the DHCP server reachable from a
client in a different subnet, they should push proper routes with the
lease.

In any case, if the DHCP server is not reachable through unicast,
before the lease expiration (after timeout T2) the client will resort
to broadcast and so there won't be any network disruption; the renewal
will only happen at a later time.

Fixes: 31fe84e467

https://bugzilla.redhat.com/show_bug.cgi?id=1448987
(cherry picked from commit 36e97f5d7b)
2017-05-16 11:42:47 +02:00
Thomas Haller
51a1fc3cd9 device: fix delaying startup complete waiting for carrier
platform: signal: link changed: 2: eth0 <DOWN;broadcast,multicast> mtu ...
    ...
    device[0x7f90c29c64d0] (eth0): bringing up device
    ...
    platform: signal: link changed: 2: eth0 <UP,LOWER_UP;broadcast,multicast,up,running,lowerup> mtu ...
    ...
    device (eth0): link connected
    ...
    device[0x7f90c29c64d0] (eth0): add_pending_action (2): 'carrier wait'

Note how we schedule the pending action 'carrier-wait', although the device
already has carrier. That means, the pending action will not be removed
until timeout, 5 seconds later.

Avoid scheduling 'carrier-wait' if we already have carrier.

However, don't just add the pending action 'carrier-wait' only during
nm_device_bring_up(). Instead, always schedule the carrier_wait timeout.
This gives a grace period during which we keep setting 'carrier-wait' whenever
we have no carrier. This should prevent two cases:
  - during nm_device_bring_up() the platform state might not yet have
    caught up. If we don't add the pending action there, we will add
    it a moment later when carrier goes away.
  - bringing the interface up might cause carrier to get lost for a
    moment (flapping). If that happens within the timeout, also add the
    pending action.

(cherry picked from commit 9f874d166d)
2017-05-15 17:44:44 +02:00
Thomas Haller
3786e17c0f device: cleanup nm_device_set_carrier_from_platform()
nm_device_set_carrier_from_platform() is only called from two places.

- both check for NM_DEVICE_CAP_CARRIER_DETECT, so move that check
  inside the function.
- drop the logging in realize_start_setup(). nm_device_set_carrier() already
  does logging.
- always set the fake carrier in nm_device_set_carrier_from_platform().
  For the fake carrer, we anyway expect it to be already TRUE in most
  case, so usually this should have no effect.
  Also emit a property changed signal. That is necessary to refresh the
  D-Bus property.

(cherry picked from commit 02bb4ce7eb)
2017-05-15 17:44:44 +02:00
Thomas Haller
83c2243d80 device: rename and minor refactoring of check_carrier()
The name should mirror what we already have: nm_device_set_carrier().
Also, move the code closer to nm_device_set_carrier() and refactor
it a bit.

(cherry picked from commit 7e472b4eb3)
2017-05-15 17:44:44 +02:00
Thomas Haller
f4600c7fa5 device: downgrade logging messages about (non) pending action
Adding/Removing a pending action with assert_not_yet_pending/
assert_is_pending means that we expect that no action is taken.

Downgrade the logging level in those cases to <trace>.

(cherry picked from commit eaba285375)
2017-05-15 17:44:44 +02:00
Thomas Haller
62f1875766 device: minor cleanup of carrier_disconnected_action_cancel()
(cherry picked from commit 6c5d883a4b)
2017-05-15 17:44:44 +02:00
Thomas Haller
0ed6b5bfff device/trivial: rename functions related to "carrier"
(cherry picked from commit a07c6255a0)
2017-05-15 17:44:44 +02:00
Thomas Haller
e9aa3cc357 device: don't call virtual function carrier_changed() directly
Don't give the subclass the ability to override the parents
behavior. The parent implementation is not intended to allow
for that. Instead, restrict the flexibility of how the virtual
function integrates with the larger picture. That means, the
virtual function is only called at one place, and there is only
one implementation in NMDeviceEthernet (and it doesn't really
matter whether the implementation chains up the parent implementation
or not).

(cherry picked from commit 5a7374d8be)
2017-05-15 17:44:44 +02:00
Thomas Haller
7f139c8ea8 connectivity: avoid compiler warning for argument of curl_easy_getinfo()
libcurl employs some typechecking via "curl/typecheck-gcc.h". When
compling with --enable-lto, compilation fails otherwise with:

    make[2]: Entering directory '/data/src/NetworkManager'
      CC       src/src_libNetworkManager_la-nm-connectivity.lo
      CCLD     src/libNetworkManager.la
      CCLD     src/libNetworkManagerTest.la
      CCLD     src/dhcp/tests/test-dhcp-dhclient
    src/nm-connectivity.c: In function 'curl_check_connectivity':
    src/nm-connectivity.c:147:10: error: call to '_curl_easy_getinfo_err_string' declared with attribute warning: curl_easy_getinfo expects a pointer to char * for this info [-Werror]
       eret = curl_easy_getinfo (msg->easy_handle, CURLINFO_PRIVATE, &cb_data);
              ^
    lto1: all warnings being treated as errors
    lto-wrapper: fatal error: /usr/bin/gcc returned 1 exit status
    compilation terminated.
    /usr/bin/ld: error: lto-wrapper failed

(cherry picked from commit 7f8815a9c3)
2017-05-12 09:56:58 +02:00
Thomas Haller
33d3ec3b3e core: fix reading device state file
For manged=unknown, we don't write the value to the
device state keyfile. The results in an empty file,
or at least, a keyfile that doesn't have device.managed
set.

On read, we must treat a missing device.managed flag as
unknown, and not as unmanaged. Otherwise, on restart
a device becomes marked as explicitly unmanaged.

This was broken by commit 142ebb1 "core: only persist explicit managed
state in device's state file", where we started conditionally
to no longer write the managed state.

Reported-by: Michael Biebl <mbiebl@debian.org>
Fixes: 142ebb1037
(cherry picked from commit 348ffdec18)
2017-05-11 20:09:37 +02:00
Thomas Haller
8da225283b core: cleanup logging reading device-state
- print string value instead of numerical "managed"
- for missing state, print the same format. After all,
  some defaults apply and it is interesting to know what
  they are.

(cherry picked from commit 81008c90ac)
2017-05-11 20:09:37 +02:00
Thomas Haller
6cfd927962 proxy: fix passing cancellable to async D-Bus operations
We must not cancel pacrunner_cancellable when the D-Bus proxy is
created. Instead, keep it around and use it later for the asynchronous
D-Bus operations.

This doesn't really matter at the moment, because the pacrunner manager
is only destroyed when NetworkManager is about to terminated. That is
the only time when we actually cancel the asynchronous request. Also,
at that time we no longer iterate the mainloop, so the pending requests
are never completed anyway.

(cherry picked from commit a08540d967)
2017-05-11 18:55:23 +02:00
Thomas Haller
10373de907 proxy: fix refcount handing for DestroyProxyConfiguration operation
Fixes: e895beb0da
(cherry picked from commit df137fdf9a)
2017-05-11 18:55:22 +02:00
Nikolay Martynov
888a6ae029 platform: ignore RTM_GETLINK messages sent by wireless extentions
We listen to all RTM_GETLINK messages to get updates on interfaces statuses.
Unfortunately wireless code in the kernel sends those messages with wireless information included
and all other information excluded. When we receive such message we wipe out our valid cached entry
with new object that is almost empty because netlink message didn't contain any information.

Solution to this is to check that incoming message contains MTU field: this field is always
set for complete messages about interfaces and is not set by wireless code.

Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>

https://github.com/NetworkManager/NetworkManager/pull/17
(cherry picked from commit 58f7813283)
2017-05-11 17:42:13 +02:00
Thomas Haller
89af3b3e34 firewall: avoid invalid -Werror=maybe-uninitialized warning in _handle_dbus_start()
../../src/nm-firewall-manager.c: In function ‘_handle_dbus_start’:
    ../../src/nm-firewall-manager.c:318:2: error: ‘dbus_method’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      g_dbus_proxy_call (priv->proxy,
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         dbus_method,
                         ~~~~~~~~~~~~
                         arg,
                         ~~~~

Fixes: d8bf05d3e6
(cherry picked from commit 3ba614d696)
2017-05-10 13:55:33 +02:00
Lubomir Rintel
5d9ff0fd3f connectivity: don't do periodic checks on interval=0
https://bugzilla.redhat.com/show_bug.cgi?id=1449296

Fixes: 7307dea9c4
(cherry picked from commit a95563996f)
2017-05-10 13:18:02 +02:00
Lubomir Rintel
c271d78d6b device: don't await for IPv6 DAD to finish if we are ignoring that there's no carrier
It's not the correct thing to do, but is the same behavior we've done
previously.

DAD is not even going to start until there's carrier and the client would
just wait indefinitely. Ideally, the client would choose not to waiat, but
it currently there's no way the client would discover what is going on.

https://bugzilla.redhat.com/show_bug.cgi?id=1446367
(cherry picked from commit bd9988f984)
2017-05-10 13:18:01 +02:00
Beniamino Galvani
75884c3aff dhcp: allow FQDNs in ipv4.dhcp-hostname
If users wrote a FQDN in ipv4.dhcp-hostname presumably it's because
they really want to send the full value, not only the host part, so
let's send it as-is.

This obviously is a change in behavior, but only for users that have a
FQDN in ipv4.dhcp-hostname, where it's not clear if they really want the
domain to be stripped.

When the property is unset, we keep sending only the host part of the
system hostname to maintain backwards compatibility.

This commit aligns NM behavior to initscripts.

(cherry picked from commit cf5fab8f55)
2017-05-09 22:43:02 +02:00
Beniamino Galvani
099b790d2b dhcp: simplify how hostname and FQDN are passed down to backends
Since they are mutually exclusive, pass a string and a boolean to
indicate whether we want to use the hostname or the FQDN option.

(cherry picked from commit d286aa9dfa)
2017-05-09 22:42:29 +02:00
Francesco Giudici
f4226e750f manager: avoid generating in memory connections during startup for managed devices
Commit #acf1067a allowed to assume connections on already managed
devices. Anyway, in complex scenario with layered connections, during
the startup of NetworkManager, this could interfere with the connection
assumption based on saved state.
So, avoid to re-assume connections on already managed devices during
startup.

Fixes: acf1067a45
(cherry picked from commit b6b7d909f7)
2017-05-09 10:57:29 +02:00
Beniamino Galvani
179ad1ee2e dhcp: set @was_active flag for external activations
Set the @was_active flag for external activations with DHCP, so that
DHCP is retried multiple times in case of failure, as we do for
managed connections when the lease expires and for assumed
connections.

Fixes test: renewal_gw_after_dhcp_outage_for_assumed_var1
Fixes: e3113fdc4b

(cherry picked from commit ddfeed4530)
2017-05-08 15:44:14 +02:00
Beniamino Galvani
e6ff7f211d platform: fix double initialization
(cherry picked from commit 708ee92c29)
2017-05-08 15:05:01 +02:00
Beniamino Galvani
2aeb8dbadd device: fix check in addrconf6_start()
We check the return value of _get_stable_id(); when it is NULL
priv->ndisc would stay NULL too and we would crash when dereferencing
@error.

Actually, _get_stable_id() can never return NULL, so replace the check
with an assertion.

(cherry picked from commit 8b73812062)
2017-05-08 15:04:59 +02:00
Beniamino Galvani
5adf360e97 ip-tunnel: fix coverity warnings
src/devices/nm-device-ip-tunnel.c:257:8: warning: Branch condition evaluates to a garbage value
                        if (local4)
                            ^~~~~~

src/devices/nm-device-ip-tunnel.c:264:8: warning: Branch condition evaluates to a garbage value
                        if (remote4)
                            ^~~~~~~

(cherry picked from commit aaaefd827e)
2017-05-08 15:04:58 +02:00
Beniamino Galvani
a65e102472 device: synchronize IPv6 configuration in stage3 (take 2)
Most of the IPv6 methods require a non-tentative link local address
configured on the interface; we look at priv->ip6_config to determine
if such address exist. If the configuration is out-of-sync, we may
proceed with configuration when the link-local address does not exist
or is still tentative, especially because we toggle the "disable_ipv6"
sysctl parameter just before, which clears all IPv6 addresses on the
interface.

Ensure that priv->ext_ip6_config_captured is up-to-date before
continuing with the IPv6 configuration, and use it to determine
whether suitable addresses are present.

Fixes test: @ipv6_set_ra_announced_mtu
Fixes: 8f4caab601

(cherry picked from commit 0461da2690)
2017-05-06 19:34:00 +02:00
Beniamino Galvani
98b4b4754e Revert "device: synchronize IPv6 configuration in stage3"
update_ip6_config() also removes addresses and routes no longer
present externally from the configuration, so it can't be called
before the changes are committed.

This reverts commit 8f4caab601.

(cherry picked from commit d626298b48)
2017-05-06 19:33:57 +02:00
Thomas Haller
ead512e6c8 ifcfg: add read/write support for user-data
The user data values are encoded in shell variables named
prefix "NM_USER_". The variable name is an encoded form of the
data key, consisting only of upper-case letters, digits, and underscore.

The alternative would be something like

  NM_USER_1_KEY=my.keys.1
  NM_USER_1_VAL='some value'
  NM_USER_2_KEY=my.other.KEY.42
  NM_USER_2_VAL='other value'

contary to

  NM_USER_MY__KEYS__1='some value'
  NM_USER_MY__OTHER___K_E_Y__42='other value'

The advantage of the former, numbered scheme is that it may be easier to
find the key of a user-data entry. With the current implementation, the
shell script would have to decode the key, like the ifcfg-rh plugin
does.

However, user data keys are opaque identifers for values. Usually, you
are not concerned with a certain name of the key, you already know it.
Hence, you don't need to write a shell script to decode the key name,
instead, you can use it directly:

  if [ -z ${NM_USER_MY__OTHER___K_E_Y__42+x} ]; then
      do_something_with_key "$NM_USER_MY__OTHER___K_E_Y__42"
  fi

Otherwise, you'd first have to search write a shell script to search
for the interesting key -- in this example "$NM_USER_2_KEY", before being
able to access the value "$NM_USER_2_VAL".

(cherry picked from commit 79be44d990)
2017-05-06 14:53:09 +02:00
Beniamino Galvani
1d08391ed1 all: fix typo 'entires' -> 'entries'
(cherry picked from commit a4cbfe6f0a)
2017-05-05 19:16:39 +02:00