Commit graph

841 commits

Author SHA1 Message Date
Beniamino Galvani
f9feddbcf0 device: cancel pending activation when slave is released
Since nm_device_slave_notify_release() is called from outside the
activation chain of the slave device (it gets called from the master
device) there might be pending activation sources scheduled, clear
them before queueing a state change.
2016-07-07 17:14:38 +02:00
Beniamino Galvani
f85941ee91 device: don't try to generate ipv6ll address for disconnected devices
If the device is disconnected because it can't be assumed due to lack
of IP configuration, don't try to generate an ipv6 link-local address,
as this requires a connection.

 #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
 #1  __GI_abort () at abort.c:89
 #2  g_assertion_message (domain=domain@entry=0x5f41b4 "NetworkManager", file=file@entry=0x5ef9b5 "devices/nm-device.c", line=line@entry=831,
     func=func@entry=0x5f3220 <__FUNCTION__.37383> "nm_device_get_ip_iface_identifier", message=message@entry=0x1e86100 "assertion failed: (connection)") at gtestutils.c:2429
 #3  g_assertion_message_expr (domain=domain@entry=0x5f41b4 "NetworkManager", file=file@entry=0x5ef9b5 "devices/nm-device.c", line=line@entry=831,
     func=func@entry=0x5f3220 <__FUNCTION__.37383> "nm_device_get_ip_iface_identifier", expr=expr@entry=0x5e65c6 "connection") at gtestutils.c:2452
 #4  nm_device_get_ip_iface_identifier (self=self@entry=0x1e612a0, iid=iid@entry=0x7fffce40e3d0, ignore_token=ignore_token@entry=1) at devices/nm-device.c:831
 #5  check_and_add_ipv6ll_addr (self=self@entry=0x1e612a0) at devices/nm-device.c:5983
 #6  queued_ip6_config_change (user_data=0x1e612a0) at devices/nm-device.c:9489
 #7  g_main_dispatch (context=0x1d3e060) at gmain.c:3154
 #8  g_main_context_dispatch (context=context@entry=0x1d3e060) at gmain.c:3769
 #9  g_main_context_iterate (context=0x1d3e060, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3840
 #10 g_main_loop_run (loop=0x1d3ab00) at gmain.c:4034
 #11 main (argc=1, argv=0x7fffce40e6a8) at main.c:411

https://bugzilla.redhat.com/show_bug.cgi?id=1351633
2016-07-06 12:17:13 +02:00
Thomas Haller
1bbc26a5c7 device: downgrade logging warning in nm_device_steal_connection()
<info>  [1467793329.6313] device (veth-guest): Activation: starting connection 'my-wired' (ca058ec5-8a47-4e1e-b38e-962b71c4699e)
    <debug> [1467793329.6313] device[0x55af2884bf90] (veth-guest): activation-stage: schedule activate_stage1_device_prepare,2 (id 510)
    <warn>  [1467793329.6314] device (veth-guest): disconnecting connection 'my-wired' for new activation request.
    <info>  [1467793329.6315] device (veth-guest): state change: disconnected -> deactivating (reason 'new-activation') [30 110 60

A warning is too verbose. This is not an unusual condition, it's just that
a new activation supersedes an other one.
2016-07-06 10:28:45 +02:00
Thomas Haller
e8518b2a37 device: tune down warning about failure to set userspace IPv6LL on non-existing device
When a device gets removed externally, we still try to clear userspace IPv6LL address handling.
That fails, due to non-existing device. Such a failure should not be logged as warning.

    <debug> [1467723214.2078] device[0x558c59335ca0] (enp0s25): disposing
    <debug> [1467723214.2079] device[0x558c59335ca0] (enp0s25): remove_pending_action (0): 'dhcp6' not pending (expected)
    <debug> [1467723214.2079] device[0x558c59335ca0] (enp0s25): remove_pending_action (0): 'autoconf6' not pending (expected)
    <debug> [1467723214.2079] device[0x558c59335ca0] (enp0s25): will disable userland IPv6LL
    <debug> [1467723214.2079] platform-linux: link: change 20: user-ipv6ll: set IPv6 address generation mode to eui64
    <trace> [1467723214.2080] platform-linux: delayed-action: schedule wait-for-nl-response (seq 92, timeout in 0.199998611)
    <trace> [1467723214.2080] platform-linux: delayed-action: schedule refresh-link (ifindex 20)
    <trace> [1467723214.2080] platform-linux: delayed-action: handle refresh-link (ifindex 20)
    <debug> [1467723214.2080] platform-linux: do-request-link: 20
    <trace> [1467723214.2080] platform-linux: netlink: recvmsg: new message type 2, seq 92
    <debug> [1467723214.2080] platform-linux: netlink: recvmsg: error message from kernel: No such device (19) for request 92
    <trace> [1467723214.2081] platform-linux: delayed-action: complete wait-for-nl-response (seq 92, timeout in 0.199895684, failure 19 (No such device))
    <trace> [1467723214.2081] platform-linux: delayed-action: schedule wait-for-nl-response (seq 93, timeout in 0.199999306)
    <trace> [1467723214.2081] platform-linux: delayed-action: handle wait-for-nl-response (any)
    <trace> [1467723214.2081] platform-linux: netlink: recvmsg: new message type 2, seq 93
    <debug> [1467723214.2081] platform-linux: netlink: recvmsg: error message from kernel: No such device (19) for request 93
    <trace> [1467723214.2082] platform-linux: delayed-action: complete wait-for-nl-response (seq 93, timeout in 0.199921142, failure 19 (No such device))
    <debug> [1467723214.2082] platform-linux: do-change-link[20]: failure changing link: failure 19 (No such device)
    <warn>  [1467723214.2082] device (enp0s25): failed to disable userspace IPv6LL address handling

https://bugzilla.redhat.com/show_bug.cgi?id=1323571
2016-07-05 23:11:57 +02:00
Thomas Haller
f9852821e3 core: don't warn when setting address of non-existing link
Trying to set a property on a device that does not exist is not something
necessarily wrong. Don't print error/warning messages.

    <trace> [1467707267.2887] device[0x55a74adbdaf0] (enp0s25): set-hw-addr: setting MAC address to 'AA:BB:CC:DD:EE:FF' (reset, unmanage)...
    <debug> [1467707267.2887] platform: link: setting '(null)' (2) hardware address
    <debug> [1467707267.2887] platform-linux: link: change 2: address: 68:F7:28:61:68:F7 (6 bytes)
    <debug> [1467707267.2887] platform-linux: do-request-link: 2
    <debug> [1467707267.2888] platform-linux: netlink: recvmsg: error message from kernel: No such device (19) for request 226
    <debug> [1467707267.2888] platform-linux: netlink: recvmsg: error message from kernel: No such device (19) for request 227
    <error> [1467707267.2888] platform-linux: do-change-link[2]: failure changing link: failure 19 (No such device)
    <warn>  [1467707267.2888] device (enp0s25): set-hw-addr: failed to reset MAC address to 68:F7:28:61:68:F7 (unmanage)
2016-07-05 23:08:22 +02:00
Thomas Haller
39e7c9e8fd device: fix logging message in nm_device_update_permanent_hw_address() 2016-07-05 14:42:15 +02:00
Thomas Haller
c5c9f0aad7 device/wifi: properly reset the initial hardware address on shutdown
During shutdown, we unmanage Wi-Fi devices, and during NMDevice:deactivate()
we would reset to initial MAC address.

However, NMDeviceWifi:deactivate() would reset it again to the scanning one.

Fix that to properly restore the initial MAC address on the device
when NetworkManager exits.

Fixes: 4b2e375b33
2016-06-30 12:01:42 +02:00
Thomas Haller
60a88fb575 device: don't regenerate MAC address on multiple _set_cloned() calls
Wi-Fi device first have a state-transition "disconnected -> prepare"
on which they run activate_stage1_device_prepare() and set the MAC
address the first time.

Later, after getting secrets, they have a state transition "need-auth ->
prepare" and end up calling nm_device_hw_addr_set_cloned() again. In this
case, we must not regenerate a new MAC address but bail out.

There is a small uncertainty there, because we are not sure that the previously
generated connection really entailed the same settings. But since we always
call nm_device_hw_addr_reset() during device deactivation, this cannot be
a left-over from a previous activation and is thus the same activation
request.
2016-06-30 08:35:45 +02:00
Thomas Haller
4b2e375b33 device: reset MAC address in NMDevice's deactivate()
Instead of letting different subclasses call reset in their
virtual deactivate() function, do it in the parent class.

This works nicely, because the parent know whether the MAC
address is currently modified.
2016-06-30 08:35:45 +02:00
Thomas Haller
96cabbcbb8 all: make MAC address randomization algorithm configurable
For the per-connection settings "ethernet.cloned-mac-address"
and "wifi.cloned-mac-address", and for the per-device setting
"wifi.scan-rand-mac-address", we may generate MAC addresses using
either the "random" or "stable" algorithm.

Add new properties "generate-mac-address-mask" that allow to configure
which bits of the MAC address will be scrambled.

By default, the "random" and "stable" algorithms scamble all bits
of the MAC address, including the OUI part and generate a locally-
administered, unicast address.

By specifying a MAC address mask, we can now configure to perserve
parts of the current MAC address of the device. For example, setting
"FF:FF:FF:00:00:00" will preserve the first 3 octects of the current
MAC address.

One can also explicitly specify a MAC address to use instead of the
current MAC address. For example, "FF:FF:FF:00:00:00 68:F7:28:00:00:00"
sets the OUI part of the MAC address to "68:F7:28" while scrambling
the last 3 octects.
Similarly, "02:00:00:00:00:00 00:00:00:00:00:00" will scamble
all bits of the MAC address, except clearing the second-least
significant bit. Thus, creating a burned-in address, globally
administered.

One can also supply a list of MAC addresses like
"FF:FF:FF:00:00:00 68:F7:28:00:00:00 00:0C:29:00:00:00 ..." in which
case a MAC address is choosen randomly.

To fully scamble the MAC address one can configure
"02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00".
which also randomly creates either a locally or globally administered
address.

With this, the following macchanger options can be implemented:

  `macchanger --random`
   This is the default if no mask is configured.
   -> ""
   while is the same as:
   -> "00:00:00:00:00:00"
   -> "02:00:00:00:00:00 02:00:00:00:00:00"

  `macchanger --random --bia`
   -> "02:00:00:00:00:00 00:00:00:00:00:00"

  `macchanger --ending`
   This option cannot be fully implemented, because macchanger
   uses the current MAC address but also implies --bia.
   -> "FF:FF:FF:00:00:00"
      This would yields the same result only if the current MAC address
      is already a burned-in address too. Otherwise, it has not the same
      effect as --ending.
   -> "FF:FF:FF:00:00:00 <MAC_ADDR>"
      Alternatively, instead of using the current MAC address,
      spell the OUI part out. But again, that is not really the
      same as macchanger does because you explictly have to name
      the OUI part to use.

  `machanger --another`
  `machanger --another_any`
  -> "FF:FF:FF:00:00:00 <MAC_ADDR> <MAC_ADDR> ..."
     "$(printf "FF:FF:FF:00:00:00 %s\n" "$(sed -n 's/^\([0-9a-fA-F][0-9a-fA-F]\) \([0-9a-fA-F][0-9a-fA-F]\) \([0-9a-fA-F][0-9a-fA-F]\) .*/\1:\2:\3:00:00:00/p' /usr/share/macchanger/wireless.list | xargs)")"
2016-06-30 08:32:50 +02:00
Thomas Haller
6829871c11 device: log more details when setting MAC address 2016-06-30 08:29:56 +02:00
Thomas Haller
df8cf1462a core: refactor unmanaging devices on shutdown and unmanage Wi-Fi devices
Add new virtual function nm_device_unmanage_on_quit() to determine
whether to unmanage the device on shutdown.

This allows Wi-Fi devices to always be unmanaged. We want that to
reset the initial MAC address.
2016-06-30 08:29:56 +02:00
Thomas Haller
767abfa690 wifi: implement MAC address randomization in NetworkManager instead of supplicant
'wireless.mac-address-randomization' broke 'wireless.cloned-mac-address',
because we would always set 'PreassocMacAddr=1'. The reason is that
supplicant would set 'wpa_s->mac_addr_changed' during scanning, and
later during association it would either set a random MAC address or
reset the permanent MAC address [1].

Anyway, 'wireless.mac-address-randomization' conflicts with
'wireless.cloned-mac-address'. Instead of letting supplicant set the
MAC address, manage the MAC addresses entirely from NetworkManager.
Supplicant should not touch it.

[1] https://w1.fi/cgit/hostap/tree/wpa_supplicant/wpa_supplicant.c?id=f885b8e97cf39b56fe7ca6577890f2d20df7ae08#n1663
2016-06-30 08:29:56 +02:00
Thomas Haller
8eed67122c device: extend MAC address handling including randomization for ethernet and wifi
Extend the "ethernet.cloned-mac-address" and "wifi.cloned-mac-address"
settings. Instead of specifying an explicit MAC address, the additional
special values "permanent", "preserve", "random", "random-bia", "stable" and
"stable-bia" are supported.

"permanent" means to use the permanent hardware address. Previously that
was the default if no explict cloned-mac-address was set. The default is
thus still "permanent", but it can be overwritten by global
configuration.

"preserve" means not to configure the MAC address when activating the
device. That was actually the default behavior before introducing MAC
address handling with commit 1b49f941a6.

"random" and "random-bia" use a randomized MAC address for each
connection. "stable" and "stable-bia" use a generated, stable
address based on some token. The "bia" suffix says to generate a
burned-in address. The stable method by default uses as token the
connection UUID, but the token can be explicitly choosen via
"stable:<TOKEN>" and "stable-bia:<TOKEN>".

On a D-Bus level, the "cloned-mac-address" is a bytestring and thus
cannot express the new forms. It is replaced by the new
"assigned-mac-address" field. For the GObject property, libnm's API,
nmcli, keyfile, etc. the old name "cloned-mac-address" is still used.
Deprecating the old field seems more complicated then just extending
the use of the existing "cloned-mac-address" field, although the name
doesn't match well with the extended meaning.

There is some overlap with the "wifi.mac-address-randomization" setting.

https://bugzilla.gnome.org/show_bug.cgi?id=705545
https://bugzilla.gnome.org/show_bug.cgi?id=708820
https://bugzilla.gnome.org/show_bug.cgi?id=758301
2016-06-30 08:29:56 +02:00
Thomas Haller
481cdc2706 device: let device specs match on permanent MAC address
Using the current, possibly non-permanent MAC address doesn't really
make sense.

Also, NM_DEVICE_HW_ADDRESS used to be writable and was set by NMDeviceBt
to the bdaddr. That is wrong, because bdaddr should not be the current
address, but the permanent one.
2016-06-30 08:29:55 +02:00
Thomas Haller
da3f608802 device: don't clear the current MAC address
When we were able to read a MAC address previously, we would not expect
a failure the next time.

Say a failure happens. Still, we should not clear the MAC address,
because we also determine hw_addr_len based on that address. And
hw_addr_perm and hw_addr_initial have the same length. When we allow
hw_addr to be reset (and possibly reset to a different address length),
we somehow have to re-fresh also the permanent and initial MAC address.

Just don't allow for that complexity, when it's not even clear what such
a scenario would mean and what do to in that case.
2016-06-30 08:29:55 +02:00
Thomas Haller
6db3c80aba device: implememnt "perm-hw-address" property in NMDevice
Both NMDeviceEthernet and NMDeviceWifi have a property "perm-hw-address".
As the hw_addr_perm property is tracked in the parent NMDevice class,
let it also implement the GObject property.

Then it knows better when to emit a notification about property
changes.
2016-06-30 08:29:55 +02:00
Thomas Haller
2a94587232 device: only set permanent hardware address once
While a device is realized, we only want to read the permanent
MAC address once. If that fails, we fallback to the current MAC
address. Thus, we want the permanent address be stable until
the device unrealizes.

While we want to fallback to the current MAC address, in some cases
the caller wants to know whether this was a "real" permanent MAC
address as read via ethtool.
For example, when matching an ethernet device against ethernet.mac-address
property, the fake (current) address should not be used in such case.
2016-06-30 08:29:55 +02:00
Thomas Haller
9fb5558f96 device/trivial: rename hw-addr related fields in NMDevicePrivate
Next I will add two more fields. Being able to efficiently grep the code
is important.

I want to be able to grep for "->hw_addr" or "\<hw_addr" to find
related stuff.

Unfortunately, prefixes often result in backward English names, e.g.
hw_addr_set/hw_addr_get. I still prefer that over get_hw_addr/set_hw_addr
though.
2016-06-30 08:29:55 +02:00
Thomas Haller
2f05353d9e device: re-read initial hw-address before activating connection
Previously, we would only once read the initial hardware address during
device realization.

When a device activates, NetworkManager always sets the MAC address as configured
in the cloned-mac-address setting -- or, if unspecified -- it falls back
to use the permanent hardware-address instead.

Later, when deactivating the device, the MAC address is reset to the
"inital MAC address".

This patch changes, that the "initial MAC address" is re-read every time
before activating the device, contrary to reading it once in the
beginning.

This allows for a user to first start NetworkManager and later change the
MAC address of the device. When activating the device, NM will reset the
MAC address for the time the device is active. But when disconnecting,
it resets to the user-changed value, not the value when NM was started.

https://bugzilla.gnome.org/show_bug.cgi?id=708820
2016-06-30 08:29:55 +02:00
Thomas Haller
3704197d87 device: re-read the current MAC address when the link changes
The current MAC address is part of NMPlatformLink in the platform cache.
When it changes, we must update the device's current value.

Also, the MAC address of NMDeviceEthernet is exposed on D-Bus. That
property should show the currently configured MAC address, not a state
that was read some time in the past.

Also, nm_device_hw_addr_set() compares the current MAC address before
resetting it. If that field is out-of-date, nm_device_hw_addr_set() will
behave wrongly.

NMDeviceEthernet had some special handling in link_changed() that would
re-read the MAC addresses and possibly bring up the interface. Move that
code to the parent device.
2016-06-30 08:29:55 +02:00
Thomas Haller
4bb1e2a536 device: cleanup logging for setting MAC address
Give all related messages a "set-hw-addr"/"hw-addr" prefix.
2016-06-30 08:29:55 +02:00
Thomas Haller
89d6dfdb96 device: split nm_device_update_permanent_hw_address() out of nm_device_update_initial_hw_address()
Either, the function is called different to reflect that it does
not only update the initial_hw_addres, or it is split.

Split it.
2016-06-30 08:29:55 +02:00
Thomas Haller
6947aedb6e device: initialize NMDevice's hw_addr at end of object construction
hw-addr is a constuct-only property. We should not do complex stuff in the property
setter before the object is sufficiently initialized. For example, the logging
macros access nm_device_get_iface(), which might be unset at that early
point.

Instead, initialize hw_addr and hw_addr_len later, at the end of the constructor()
function.

Also, ensure that @hw_addr_len is zero iff @hw_addr is unset.

Also, ensure that we always log a message when changing/setting the
hardware address -- except when clearing it during unrealize. It's
implicit that unrealize clears the hardware address.

Also, give all related logging messages a "hw-addr:" prefix.
2016-06-30 08:29:55 +02:00
Thomas Haller
e92b743ce9 device: don't use g_warning for differing hw-addr-len after reading permanent address
Accessing the platform cache might anytime yield unexpected results.
E.g. the link could be gone, or the ifindex could even be replaced
by a different interface (yes, that can happen when moving links
between network namespaces).

It's not clear how to handle such a case at runtime. It seems wrong to
me to just error out. Still, such case might happen under normal
conditions, so it's wrong to just warn and proceed.
2016-06-30 08:29:55 +02:00
Thomas Haller
fa5230e255 device: refactor setting HW address via nm_device_set_hw_addr()
This brings no real change in behavior, except getting rid of the
logging domain argument.
2016-06-30 08:29:55 +02:00
Thomas Haller
e5637dc089 device: clear initial_hw_addr in nm_device_update_initial_hw_address()
There was no leak here, because we would only call
nm_device_update_initial_hw_address() when @initial_hw_addr is unset.
However, still clear it to make it more robust against later changes.
2016-06-30 08:29:54 +02:00
Thomas Haller
89970b5ca6 device: refactor nm_device_get_applied_setting() 2016-06-30 08:29:54 +02:00
Thomas Haller
0a5af391e0 core: prefer connection.stable-id to generate IPv6 stable privacy addresses
The Network_ID for generating RFC 7217 stable privacy IPv6 addresses
is by default the UUID of the connection.

Alternatively, prefer "connection.stable-id" as Network_ID to generate
the stable addresses. This allows to configure a set of connections that
all use the same Network_ID for generating stable addresses.

Note that the stable-id and the UUID do no overlap, that is two
connections
    [connection]
    uuid=uuid1
    stable-id=
and
    [connection]
    uuid=uuid2
    stable-id=uuid1
generate distinct addresses.
2016-06-30 08:29:54 +02:00
Thomas Haller
171554d073 device: clearify behavior of NM_UNMANAGED_USER_SETTINGS in comment 2016-06-22 14:07:24 +02:00
Thomas Haller
bc1014a93d all: replace _nm_utils_string_in_list() with g_strv_contains() 2016-06-17 12:25:33 +02:00
Thomas Haller
466bf2f633 build: avoid compiler warnings about non-constant format strings (-Wformat-nonliteral) 2016-06-05 12:22:01 +02:00
Thomas Haller
8e54cfdb27 all: move NM_AUTH_PERMISSION_* defines to "nm-common-macros.h" header 2016-06-01 19:06:35 +02:00
Thomas Haller
d43a0459bc merge: merge branch systemd into master 2016-05-31 11:46:27 +02:00
Thomas Haller
63571b2666 device: reconfigure IP addressing after bringing up device
For changing the hardware address, we must bring the device down. When doing
that, IP addressing is lost and it must be re-configured after bringing the
device up again.

We already do something similar in device_link_changed(), but that might
not be sufficient, because device_link_changed() is run on an idle
handler, thus, while changing the hardware address it has no chance to
run (or notice that the device was shortly down).

https://bugzilla.redhat.com/show_bug.cgi?id=1309899
2016-05-30 18:11:55 +02:00
Thomas Haller
6fd1bf0749 device: accept failure to lookup link in get_ip_iface_identifier()
An assertion seems a bit harsh, especially, because the platform
cache cannot be always in sync with the device state.
2016-05-30 16:32:07 +02:00
Thomas Haller
6732e2a18b device: lookup platform data only once in get_ip_iface_identifier()
No need to perform multiple cache lookups.
2016-05-30 16:32:07 +02:00
Lubomir Rintel
9133dec2d9 device: set the iid to rdisc from connection's property
...as opposed to directly from the platform. If the token was set in
platform, it was picked up when generating a connection anyway.
2016-05-30 16:32:07 +02:00
Lubomir Rintel
6c018a283b device: use the token set in platform when generating a connection 2016-05-30 16:32:07 +02:00
Thomas Haller
e88f5a6c23 platform: remove nm_platform_link_get_ipv6_token()
No need for the extra cache lookup.
2016-05-30 16:32:06 +02:00
Lubomir Rintel
02f935c4cc all: fix the identfier typo 2016-05-30 16:14:04 +02:00
Lubomir Rintel
e96f0e6349 all: trivial: use g_value_dup_string () 2016-05-30 16:13:48 +02:00
Beniamino Galvani
52819b7c94 device: fix NM_DEVICE_GET_PRIVATE() macro
Fixes: adbba0fb39
2016-05-25 17:29:18 +02:00
Thomas Haller
4c7fbcc941 device: replace static zero_hwaddr by nm_ip_addr_zero.addr_eth
Instead of defining multiple all-zero-ethernet-address variables, use
nm_ip_addr_zero.addr_eth.
2016-05-24 16:01:59 +02:00
Thomas Haller
8e1443457d device: use NMSettings directly instead of NMConnectionProvider in subclasses
Instead of accessing the singleton getter nm_settings_get(), obtain
the settings instance from the device instance itself via
nm_device_get_settings().
2016-05-24 12:35:58 +02:00
Thomas Haller
b9fc9cd389 device: use NMSettings directly instead of NMConnectionProvider 2016-05-24 12:35:58 +02:00
Thomas Haller
adbba0fb39 device: assertion object in NM_DEVICE_GET_PRIVATE() 2016-05-24 12:35:57 +02:00
Thomas Haller
d71ba919af device: use NM_PLATFORM_GET instead of "nm_platform_get ()"
We use basically everywhere else the NM_PLATFORM_GET macro.
2016-05-22 14:20:05 +02:00
Beniamino Galvani
7dbabe9bdc device: wait for termination of IPv6 DAD before proceeding to IP_CHECK
Currently NM proceeds with the activation of a device just after the
IPv6 configuration is applied. Server applications will bind to IPv6
addresses as soon as NM signals the presence of network connectivity,
but since the addresses are still tentative the bind will fail. There
are a couple of solutions to this.

Linux kernel supports "optimistic DAD", which is a modification of
Neighbor Discovery and SLAAC processes that allows addresses to be
used (under certain contraints) while kernel is performing DAD on
them. However it is not feasible to let NM enable optimistic DAD for
the devices it controls for the following reasons:

 - it is not guaranteed to be always available since it can be turned
   off at compile time
 - RFC 4429 states that it should not be used for manually entered
   addresses
 - it works only with autoconf addresses generated by kernel

Therefore, use a different approach and handle this in NM by waiting
that the kernel completes DAD before continuing activation. We build a
list of addresses that are tentative just after the new configuration
is applied and then we asynchronously wait a platform address-change
event where all NM-configured addresses become non-tentative.

A similar solution has been adopted also by other network managing
tools:
  https://anonscm.debian.org/cgit/collab-maint/ifupdown.git/commit/?id=ec357a5d6cb5fa8b0004c727d7cc48253c59eb0f
  8012cd3919

https://bugzilla.redhat.com/show_bug.cgi?id=1243958
2016-05-22 14:20:05 +02:00
Thomas Haller
7c785a064e device/trivial: rename nm_device_set_unmanaged_by_user_config() to nm_device_set_unmanaged_by_user_settings()
After all, it sets NM_UNMANAGED_USER_SETTINGS flag, so the name should
match with the flag.
2016-05-17 12:12:50 +02:00