Commit Graph

7207 Commits

Author SHA1 Message Date
Thomas Haller
325faa2379 ifcfg-rh: add svSetValueInt64() utility 2015-11-18 15:37:42 +01:00
Dan Williams
b023d0754b exported-object: add support for DBus ObjectManager interface
NMExportedObject now derives from GDBusObjectSkeleton, which is what
GDBusObjectManagerServer wants.  The main GDBusConnection and each
private server connection now gets a new GDBusObjectManagerServer,
and exported objects are registered with that instead of individually
exporting each GDBusInterfaceSkeleton.

Previously exported objects were not referenced by the BusManager,
but instead removed from the exports hash via weak references.  The
GDBusObjectManagerServer instead references exported objects, which
can make them live much longer than they did before.

Co-Authored-By: Thomas Haller <thaller@redhat.com>
2015-11-18 15:15:05 +01:00
Lubomir Rintel
83b8b9e1f6 bus-manager: drop private socket
With ObjectManager we can not export ObjectSkeletons to multiple connections --
the manager would unexport the InterfaceSkeletons upon its destruction.

It seems easiest to just drop the private socket altogether; It was broken for
broken for some time and noone noticed anyway. Also startup before D-Bus is
still broken: NetworkManager would reconnect to the bus but multiple managers
won't notice the bus is around (we'll never see firewalld or policykit come up).

We should probably just stop pretending we support operation without a real
D-Bus server. With the advent of kdbus this makes even more sense.
2015-11-18 15:15:05 +01:00
Thomas Haller
16afb3a31a platform/tests: fix fake-platform test running in debug-mode
In debug-mode, test_ip4_address_peer_zero() used to print the
result of `ip address show`. That fails for fake-platform
because the device does not exists.

Just don't do that.
2015-11-18 14:01:15 +01:00
Jiří Klimeš
f902444325 ifcfg: fix a possible double-free error on invalid WEP key (rh #1281324)
https://bugzilla.redhat.com/show_bug.cgi?id=1281324
2015-11-18 09:15:39 +01:00
Thomas Haller
914d875dc2 wifi: fix handling APs list using string-hashing
Commit d518278011 changed
the hashing for the APs to use direct-hashing.

That was wrong because get_ap_by_path() needs a full
string-comparison.

Fixes: d518278011
2015-11-16 16:51:54 +01:00
Beniamino Galvani
f1b4eb9558 core: fix failed assertion when D-Bus service is already taken
When exiting after an error we must set the quitting flag in
nm-exported-object.c because during program destruction there can be
still exported objects which get disposed.

Fixes the following assertion:

 NetworkManager[14241]: (nm-exported-object.c:826):nm_exported_object_dispose: code should not be reached

 Process terminating with default action of signal 5 (SIGTRAP)
    at 0x7ACFD3B: _g_log_abort (gmessages.c:315)
    by 0x7ACFD3B: g_logv (gmessages.c:1041)
    by 0x7ACFEAE: g_log (gmessages.c:1079)
    by 0x7AD0196: g_warn_message (gmessages.c:1112)
    by 0x20F5B0:  nm_exported_object_dispose (nm-exported-object.c:826)
    by 0x316FC4:  dispose (nm-settings.c:2222)
    by 0x7841A5B: g_object_unref (gobject.c:3137)
    by 0x2330F3:  dispose (nm-manager.c:5249)
    by 0x7841A5B: g_object_unref (gobject.c:3137)
    by 0x23C511:  _nm_singleton_instance_destroy (NetworkManagerUtils.c:174)
    by 0x400FBE6: _dl_fini (in /usr/lib64/ld-2.21.so)
    by 0x8009647: __run_exit_handlers (in /usr/lib64/libc-2.21.so)
    by 0x8009694: exit (in /usr/lib64/libc-2.21.so)
2015-11-13 18:01:33 +01:00
Glenn Washburn
61948913c5 build: add backward compatibility define for missing CLOCK_BOOTTIME
[thaller@redhat.com: modified original patch]

https://bugzilla.gnome.org/show_bug.cgi?id=757911
2015-11-13 17:19:40 +01:00
Glenn Washburn
6263703286 build: disable Pragmas for pre 4.6 gcc
Gcc 4.6 introduced Pragma "GCC diagnostic" (https://gcc.gnu.org/gcc-4.6/changes.html)
Don't use them for older gcc.

[thaller@redhat.com: modified original patch]

https://bugzilla.gnome.org/show_bug.cgi?id=757910
2015-11-13 17:19:40 +01:00
Lubomir Rintel
faae84370f dispatcher: don't abort when VPN connections have no IPv4
They don't need it. Also, we shouldn't assert on something that can be
done via a D-Bus API.
2015-11-13 16:13:40 +01:00
Dan Williams
46b46fd1ca wifi: clean up removal of current AP if it fails during association (bgo #733105)
Now that NM follows the supplicant's scan list and CurrentBSS, any AP that isn't
known to the supplicant will be 'fake', and priv->current_ap always tracks
CurrentBSS.

We can then simplify link_timeout_cb() because any AP that would have been
force-removed before will now be marked "fake" if it's unknown to the supplicant,
and will always be removed by set_current_ap(), so we can remove the force
argument.  To better fix #733105 we never want to remove an AP known to
the supplicant, even if it we failed to connect to it.

https://bugzilla.gnome.org/show_bug.cgi?id=733105
2015-11-12 13:32:45 -06:00
Lubomir Rintel
ec4d653532 agent-manager: add a missing break in case 2015-11-12 14:24:57 +01:00
Lubomir Rintel
9f92bb1f63 device: don't try to re-add addresses that vanish on device disconnection
They are not DAD failures. Also, we must not try adding link-local address when
disconnecting.
2015-11-12 13:37:31 +01:00
Lubomir Rintel
f8973a7f42 nm-device: only progress with ip-config if the device is still in IP_WAIT
The device might be a slave and not need any L3 configuration in which case it
will move to IP_DONE:

  Running test bridge_manipulation_with_1000_slaves
  ...
  <debug> [1446834482.545396] [nm-dispatcher.c:304] dispatcher_results_process(): (121) 12-dhcpd succeeded
  <debug> [1446834482.545404] [nm-dispatcher.c:304] dispatcher_results_process(): (121) 20-chrony succeeded
  <debug> [1446834482.545481] [devices/nm-device.c:5374] nm_device_activate_stage3_ip_config_start(): [0x7fc77e1c0fc0] (port120): Activation: Stage 3 of 5 (IP Configure Start) started...
  <info>  (port120): device state change: config -> ip-config (reason 'none') [50 70 0]
  <debug> [1446834482.545578] [devices/nm-device.c:1683] slave_state_changed(): [0x7fc77df77020] (bridge0): slave port120 state change 50 (config) -> 70 (ip-config)
  <debug> [1446834482.545629] [devices/nm-device.c:7955] nm_device_add_pending_action(): [0x7fc77e1c0fc0] (port120): add_pending_action (2): 'queued state change to secondaries'
  <debug> [1446834482.545642] [devices/nm-device.c:8806] nm_device_queue_state(): [0x7fc77e1c0fc0] (port120): queued state change to secondaries due to none (id 11380)
  ** NetworkManager:ERROR:devices/nm-device.c:5250:nm_device_activate_stage3_ip4_start: assertion failed: (priv->ip4_state == IP_WAIT)

  5250            g_assert (priv->ip4_state == IP_WAIT);
  (gdb) print priv->ip4_state
  $1 = IP_DONE
  (gdb) print priv->master
  $3 = { ...  master = 0x7fc77df77020, enslaved = 1, master_ready_handled = 1,
    master_ready_id = 0, is_master = 0, slaves = 0x0, ...}
2015-11-11 19:42:17 +01:00
Thomas Haller
99ff6681b7 wifi: minor refactoring logging BSSID in supplicant_iface_new_bss_cb() 2015-11-11 18:07:34 +01:00
Thomas Haller
d5373959f9 Revert "wifi: do no crash when getting BSSID fails"
Since commit 7cb323d923,
nm_ap_new_from_properties() will always return an
AP with BSSID set. Restore the assertion during
try_fill_ssid_for_hidden_ap().

This reverts commit e9bc18d2a7.
2015-11-11 18:05:22 +01:00
Dan Williams
7cb323d923 wifi: don't accept any BSSes with missing BSSIDs (rh #1276426)
The supplicant should never be sending us BSSes without BSSIDs.

https://bugzilla.redhat.com/show_bug.cgi?id=1276426
2015-11-11 17:49:53 +01:00
Beniamino Galvani
a74e98bfc6 systemd/adapt: return G_SOURCE_REMOVE in time event callback
Differently from GLib timeout sources, systemd ones are always
one-shot and therefore we must return G_SOURCE_REMOVE in the callback,
otherwise the timer will be scheduled again.

In most cases things were working correctly because usually the
callback also unreferences the source event, but when this doesn't
happen the timer will trigger multiple times as reported in the bug
below.

https://bugzilla.redhat.com/show_bug.cgi?id=1278506

Fixes: 1b1222ffdf
2015-11-11 17:24:39 +01:00
Jiří Klimeš
98b0b4b402 wifi: fix a crash while attempting to connect hidden AP (bgo #757814)
Triggered with
$ nmcli dev wifi connect 00:22:6B:EB:1D:CA hidden yes

where 00:22:6B:EB:1D:CA was BSSID of the AP with hidden SSID.

 Program received signal SIGSEGV, Segmentation fault.
 nm_ap_utils_complete_connection (ap_ssid=0x0, bssid=0xc9e6b0 "00:22:6B:EB:1D:CA", ap_mode=NM_802_11_MODE_INFRA, ap_flags=1, ap_wpa_flags=0, ap_rsn_flags=0,
     connection=0x994ae0, lock_bssid=0, error=0x7fffffffdba0) at nm-wifi-ap-utils.c:551
 551		ap_ssid_bytes = g_bytes_new (ap_ssid->data, ap_ssid->len);
 (gdb) bt
 #0  0x00007fffe2ea18ef in nm_ap_utils_complete_connection (ap_ssid=0x0, bssid=0xc9e6b0 "00:22:6B:EB:1D:CA", ap_mode=NM_802_11_MODE_INFRA, ap_flags=1, ap_wpa_flags=0, ap_rsn_flags=0, connection=0x994ae0, lock_bssid=0, error=0x7fffffffdba0) at nm-wifi-ap-utils.c:551
 #1  0x00007fffe2ea178f in nm_ap_complete_connection (self=self@entry=0x8add20 [NMAccessPoint], connection=connection@entry=0x994ae0, lock_bssid=0, error=error@entry=0x7fffffffdba0) at nm-wifi-ap.c:854
 #2  0x00007fffe2e9e22c in complete_connection (device=0x8c39f0 [NMDeviceWifi], connection=0x994ae0, specific_object=<optimized out>, existing_connections=0xb2ef10 = {...}, error=0x7fffffffdba0) at nm-device-wifi.c:839
 #3  0x000000000045f7a1 in nm_device_complete_connection (self=<optimized out>, connection=connection@entry=0x994ae0, specific_object=specific_object@entry=0xc31850 "/org/freedesktop/NetworkManager/AccessPoint/11", existing_connections=existing_connections@entry=0xb2ef10 = {...}, error=error@entry=0x7fffffffdba0)
    at devices/nm-device.c:2603
 #4  0x00000000004e0a66 in impl_manager_add_and_activate_connection (self=0x8b81f0 [NMManager], context=0x7fffe804bde0 [GDBusMethodInvocation], settings=<optimized out>, device_path=<optimized out>, specific_object_path=0xc31850 "/org/freedesktop/NetworkManager/AccessPoint/11") at nm-manager.c:3426
 #5  0x0000003bf6c05db0 in ffi_call_unix64 () at ../src/x86/unix64.S:76
 #6  0x0000003bf6c05818 in ffi_call (cif=cif@entry=0x7fffffffde10, fn=<optimized out>, rvalue=0x7fffffffdd70, avalue=avalue@entry=0x7fffffffdcf0)
    at ../src/x86/ffi64.c:525
 #7  0x0000003bf7010464 in g_cclosure_marshal_generic (closure=closure@entry=0x8d4ae0, return_gvalue=return_gvalue@entry=0x0, n_param_values=n_param_values@entry=5, param_values=param_values@entry=0xb508f0, invocation_hint=invocation_hint@entry=0x7fffffffe020, marshal_data=0x4e0890 <impl_manager_add_and_activate_connection>)
    at gclosure.c:1448
 #8  0x00000000004c6038 in nm_exported_object_meta_marshal (closure=0x8d4ae0, return_value=0x7fffffffdfd0, n_param_values=5, param_values=0xc2a240, invocation_hint=0x7fffffffe020, marshal_data=<optimized out>) at nm-exported-object.c:346

https://bugzilla.gnome.org/show_bug.cgi?id=757814
2015-11-11 09:45:53 +01:00
Thomas Haller
cf146e9a0d ifcfg-rh: use distinct D-Bus connection for ifcfg-rh service
Prevsiouly, the ifcfg-rh service and the regular NetworkManager
were both exported on the same D-Bus connection. That had the
effect, that on both services ("com.redhat.ifcfgrh1" and
"org.freedesktop.NetworkManager") all objects were visible.

This is also problematic later when we use GDBusObjectManager
for the org.freedesktop.NetworkManager service.

Export the ifcfg service on a separate bus connection.

One downside is, that we don't bother exporting the service
on the private socket and thus the service is not available
without D-Bus daemon.
Also, if the bus disconnects, we don't retry or recover. Instead
the D-Bus service is dead until restart.
2015-11-10 18:12:12 +01:00
Thomas Haller
57128494e0 exported-object: split out the creation of interface skeletons
Will be reused for ifcfg-rh plugin, which also has a skeleton,
but will not implement NMExportedObject.
2015-11-10 18:12:12 +01:00
Dan Williams
f9ee20a7b2 core: explicitly unexport objects when we're done with them
Previously most objects were implicitly unexported when they were
destroyed, but since refcounts may make the object live longer than
intended, we should explicitly unexport them when they should no
longer be present on the bus.

This means we can assume that objects will always be un-exported
already when they are destroyed, *except* when quitting where most
objects will live until exit because NM leaves interfaces up and
running on quit.
2015-11-10 18:12:12 +01:00
Thomas Haller
d518278011 wifi/ap: use direct-hashing for aps hash
The @aps hash has the D-Bus path of the exported
object as key. It already rightly saved to additionally
copy the string and relied on the path being stable.

When doing that, we can just go one step further and
use direct-hashing instead of string-hashing.

Note that NMExportedObject already promises that
the path will not change as long as the object is
exported. See code comments in the export/unexport
functions.
2015-11-10 18:12:12 +01:00
Thomas Haller
96f40dcdcd wifi/ap: explicitly unexport AP and refactor add/remove AP
For future use of ObjectManager, we must explicitly unexport
the AP and no longer depend on having it unexported during
deconstruction (because object manager keeps the instance alive).

Also refactor adding/removal of APs and move the export/unexport
calls to the place where we emit the signal.
2015-11-10 18:12:12 +01:00
Thomas Haller
0c1e290c97 wifi/ap: set the current-ap after adding the new AP
First add the new AP, before setting it as current.

Also set the AP *after* thawing the notifications. Otherwise
it is not clear which notification gets raised first as their
order is undefined. But we want that the client first sees
the new AP and later gets a notification about having a new
current.
2015-11-10 18:12:12 +01:00
Thomas Haller
8a8ecc46ca core: fix wrongly exporting object before instance is fully constructed
Exporting the object already in the *_init() function will later
break because the object is not yet fully initialized at that point.

Add a convenient flag so that the NMExportedObject parent implementation
automatically can export itself. This saves the derived class from
overwriting the constructed() method.

Also add an assertion to catch such bugs.
2015-11-10 18:12:12 +01:00
Thomas Haller
ae5cfba05c ifcfg-rh: fix chaining constructed() method for SettingsPluingIfcfg 2015-11-10 18:12:12 +01:00
Dan Williams
09a2be3b65 core: fix builds with older gcc (like 4.4.x) 2015-11-10 11:10:03 -06:00
Lubomir Rintel
4ce43fd5e6 device: don't call into rdisc when there's none 2015-11-10 16:48:17 +01:00
Lubomir Rintel
e02afcff09 device: fix a dad6_failed_addrs use-after-free 2015-11-10 16:48:17 +01:00
Lubomir Rintel
833e126cf8 device: avoid removing a list element while iterating it 2015-11-10 16:48:17 +01:00
Thomas Haller
caa2de563d build: avoid invalid compiler warning
NetworkManagerUtils.c:3308:93: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare]
   key_len = (((key_len) > (((guint32) 0xffffffff))) ? (((guint32) 0xffffffff)) : (((key_len) < (0)) ? (0) : (key_len)));
                                                                                    ~~~~~~~~~ ^ ~~~

Fixes: e603c86926
2015-11-10 15:31:49 +01:00
Beniamino Galvani
ff31171a1c lldp: add test case
Add a test for the LLDP listener to ensure that things don't
accidentally break when we import new code from systemd upstream.

https://bugzilla.gnome.org/show_bug.cgi?id=757005
2015-11-10 14:25:05 +01:00
Beniamino Galvani
6bfa0674c1 lldp: decouple NMLldpListener from platform
Make NMLldpListener independent from platform code so that it can be
tested more easily.
2015-11-10 14:17:42 +01:00
Lubomir Rintel
553c15410e agent-manager: cancel pending auth chain for the disappearing agent
If the current agent disappears and we already triggered the permission check
for it then the callback for that permission check will fire after we
progressed to the next agent:

  # nmcli c --wait 0 up vpn

When another agent, such as GNOME Shell is registered, then get_done_cb() for
the nmcli will be called after we started the permission check for GNOME Shell,
resulting in an assertion fail:

  get_done_cb: assertion 'call_id == parent->current_call_id' failed
2015-11-06 17:17:58 +01:00
Lubomir Rintel
aa05d25bef device: set a reason when device enslave fails
Otherwise we'd hit an assert and rightly so!

  Program received signal SIGTRAP, Trace/breakpoint trap.
  g_logv (log_domain=0x5555556b2f80 "NetworkManager", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=args@entry=0x7fffffffcd10) at gmessages.c:1046
  1046              g_private_set (&g_log_depth, GUINT_TO_POINTER (depth));
  (gdb) bt
  #0  g_logv (log_domain=0x5555556b2f80 "NetworkManager", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=args@entry=0x7fffffffcd10) at gmessages.c:1046
  #1  0x00007ffff4a4ea3f in g_log (log_domain=log_domain@entry=0x5555556b2f80 "NetworkManager", log_level=log_level@entry=G_LOG_LEVEL_WARNING, format=format@entry=0x7ffff4ac1e4c "%s") at gmessages.c:1079
  #2  0x00007ffff4a4ed56 in g_warn_message (domain=domain@entry=0x5555556b2f80 "NetworkManager", file=file@entry=0x5555556aca93 "devices/nm-device.c", line=line@entry=1101,
      func=func@entry=0x5555556b22e0 <__FUNCTION__.35443> "nm_device_release_one_slave", warnexpr=warnexpr@entry=0x0) at gmessages.c:1112
  #3  0x00005555555ba80a in nm_device_release_one_slave (self=self@entry=0x5555559ec4c0, slave=slave@entry=0x5555559f7800, configure=configure@entry=1, reason=reason@entry=NM_DEVICE_STATE_REASON_NONE)
      at devices/nm-device.c:1101
  #4  0x00005555555c264b in slave_state_changed (slave=0x5555559f7800, slave_new_state=NM_DEVICE_STATE_FAILED, slave_old_state=NM_DEVICE_STATE_IP_CONFIG, reason=NM_DEVICE_STATE_REASON_NONE, self=0x5555559ec4c0)
      at devices/nm-device.c:1700
  #5  0x00007ffff339cdac in ffi_call_unix64 () at ../src/x86/unix64.S:76
  #6  0x00007ffff339c6d5 in ffi_call (cif=cif@entry=0x7fffffffd1c0, fn=<optimized out>, rvalue=0x7fffffffd130, avalue=avalue@entry=0x7fffffffd0b0) at ../src/x86/ffi64.c:522
  #7  0x00007ffff4d45678 in g_cclosure_marshal_generic (closure=0x5555559b0160, return_gvalue=0x0, n_param_values=<optimized out>, param_values=<optimized out>, invocation_hint=<optimized out>, marshal_data=0x0)
      at gclosure.c:1454
  #8  0x00007ffff4d44e38 in g_closure_invoke (closure=0x5555559b0160, return_value=return_value@entry=0x0, n_param_values=4, param_values=param_values@entry=0x7fffffffd3c0,
      invocation_hint=invocation_hint@entry=0x7fffffffd360) at gclosure.c:768
  #9  0x00007ffff4d5675d in signal_emit_unlocked_R (node=node@entry=0x55555598a6f0, detail=detail@entry=0, instance=instance@entry=0x5555559f7800, emission_return=emission_return@entry=0x0,
      instance_and_params=instance_and_params@entry=0x7fffffffd3c0) at gsignal.c:3553
  #10 0x00007ffff4d5e4c1 in g_signal_emit_valist (instance=instance@entry=0x5555559f7800, signal_id=signal_id@entry=72, detail=detail@entry=0, var_args=var_args@entry=0x7fffffffd5f8) at gsignal.c:3309
  #11 0x00007ffff4d5ecc8 in g_signal_emit_by_name (instance=instance@entry=0x5555559f7800, detailed_signal=detailed_signal@entry=0x5555556c0405 "state-changed") at gsignal.c:3405
  #12 0x00005555555bd0e0 in _set_state_full (self=self@entry=0x5555559f7800, state=state@entry=NM_DEVICE_STATE_FAILED, reason=reason@entry=NM_DEVICE_STATE_REASON_NONE, quitting=quitting@entry=0)
      at devices/nm-device.c:8580
  #13 0x00005555555be0e7 in nm_device_state_changed (self=self@entry=0x5555559f7800, state=state@entry=NM_DEVICE_STATE_FAILED, reason=reason@entry=NM_DEVICE_STATE_REASON_NONE) at devices/nm-device.c:8741
  #14 0x00005555555c0a45 in queued_set_state (user_data=<optimized out>) at devices/nm-device.c:8765
  #15 0x00007ffff4a4779a in g_main_dispatch (context=0x5555559433c0) at gmain.c:3109
  #16 g_main_context_dispatch (context=context@entry=0x5555559433c0) at gmain.c:3708
  #17 0x00007ffff4a47ae8 in g_main_context_iterate (context=0x5555559433c0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3779
  #18 0x00007ffff4a47dba in g_main_loop_run (loop=0x555555943480) at gmain.c:3973
  #19 0x000055555559713d in main (argc=1, argv=0x7fffffffdb78) at main.c:512
  (gdb)
2015-11-06 15:43:27 +01:00
Thomas Haller
9587867349 logging: swap names of logging macros _LOGT() and _LOGt()
Previsously, _LOGT() could be disabled at compile time. Thus it
was different then the other macros _LOGD(), _LOGI(), etc.

OTOH, _LOGt() was the macro that always was compiled in.

Swap the name of the macros. Now the upper-case macros are always
enabled, while the lower-case macro _LOGt() is enabled depending
on compile configuration.
2015-11-06 14:16:41 +01:00
Jiří Klimeš
b9da3d9320 policy: fix looping through list while removing elements (rh #1175446)
When g_slist_remove() was called, iter2 became invalid and accessing it
could cause a crash. The same was true for iter.
Fix the problem by getting the next list item before an element removal.

See a similar fix in bluez
http://git.kernel.org/cgit/bluetooth/bluez.git/commit/?id=be8c5be809875ba449a10ca29f5244f0231f6b63

https://bugzilla.redhat.com/show_bug.cgi?id=1175446
https://bugzilla.redhat.com/show_bug.cgi?id=1277247
2015-11-05 12:51:17 +01:00
Lubomir Rintel
7fa51f4dca linux-platform: don't overwrite network with preferred source
A typo, likely.
2015-11-05 11:54:54 +01:00
Lubomir Rintel
73ad7baace device: fix switched ip6_config_subtract arguments
Came up during review and received less thought than deserved.
2015-11-05 11:54:15 +01:00
Lubomir Rintel
f558502278 agent-manager: don't try to cancel requests that already finished
Fixes: 5d1cac81a0
2015-11-04 14:29:18 +01:00
Beniamino Galvani
c8e2339091 device: terminate the activation chain when entering the failed state
Device activation normally fails during one of the stages and in that
case the activation chain is implicitly interrupted.

But in some cases the device fails for external events (as a failure
of master connection) while the activation sequence is still running
and so we need to ensure that any pending activation source gets
cleared upon entering the failed state.

https://bugzilla.redhat.com/show_bug.cgi?id=1270814
2015-11-03 22:38:55 +01:00
Beniamino Galvani
faa44768c0 rdisc/tests: initialize iid passed to nm_rdisc_set_iid()
Fixes: b3e0811b81
2015-11-03 22:25:19 +01:00
Lubomir Rintel
fd8d0562eb test-link: skip test if iproute2 is not capable enough
Older iproute2 as shipped with Ubuntu 14 doesn't support vxlan dstport.
2015-11-03 14:01:30 +01:00
Jiří Klimeš
212b3e6713 core: fix assuming a connection without S390 properties (rh #1276343)
When a connection should be assumed and the generated connection did not
contain a wired setting, the connection did not match due to S390 properties.
Such a connection should be allowed to match to a connection with a wired
setting with default (empty) S390 properties.

This can happen when there is a VLAN profile configured that contains a wired
setting in it and NetworkManager is (re)started.

Example/reproducer:
$ nmcli con add type vlan con-name vlan-test autoconnect no dev em1 id 44
$ nmcli con mod vlan-test eth.mtu 1450   (modify the connection, so that it has a wired setting)
$ nmcli con up vlan-test                 (activate the connection)
$ sudo systemctl restart NetworkManager
$ nmcli device
check that 'vlan-test' connection is active on em1.44 device
(and not the auto-generated em1.44)

https://bugzilla.redhat.com/show_bug.cgi?id=1276343
2015-11-03 08:31:04 +01:00
Lubomir Rintel
e9dfdfe9fe libnm-core: default to ip6.addr-gen-mode=stable-privacy
Take a missing value in keyfile/ifcfg-rh as EUI-64 to keep the compatibility
with the old conneciton. Nevertheless, the new connections should default to
the RFC7217 addresses.
2015-11-02 20:27:36 +01:00
Lubomir Rintel
e603c86926 core: add support for RFC7217 stable privacy addressing
RFC7217 introduces an alternative mechanism for creating addresses during
stateless IPv6 address configuration. It's supposed to create addresses whose
host part stays stable in a particular network but changes when the hosts
enters another network to mitigate possibility of tracking the host movement.

It can be used alongside RFC 4941 privacy extensions (temporary addresses)
and replaces the use of RFC 4862 interface identifiers.

The address creation mode is controlld by ip6.addr_gen_mode property
(ADDR_GEN_MODE in ifcfg-rh), with values of "stable-privacy" and "eui-64",
defaulting to "eui-64" if unspecified.

The host part of an address is computed by hashing a system-specific secret
salted with various stable values that identify the connection with a secure
hash algorithm:

  RID = F(Prefix, Net_Iface, Network_ID, DAD_Counter, secret_key)

For NetworkManager we use these parameters:

* F()
  SHA256 hash function.

* Prefix
  This is a network part of the /64 address

* Net_Iface
  We use the interface name (e.g. "eth0"). This ensures the address won't
  change with the change of interface hardware.

* Network_ID
  We use the connection UUID here. This ensures the salt is different for
  wireless networks with a different SSID as suggested by RFC7217.

* DAD_Counter
  A per-address counter that increases with each DAD failure.

* secret_key
  We store the secret key in /var/lib/NetworkManager/secret_key. If it's
  shorter than 128 bits then it's rejected. If the file is not present we
  initialize it by fetching 256 pseudo-random bits from /dev/urandom on
  first use.

Duplicate address detection uses IDGEN_RETRIES = 3 and does not utilize the
IDGEN_DELAY delay (despite it SHOULD). This is for ease of implementation
and may change in future. Neither parameter is currently configurable.
2015-11-02 20:27:36 +01:00
Lubomir Rintel
f85728ecff core: support IPv6 duplicate address detection
NMDevice detects the DAD failures by watching the removal of tentative
addresses (happens for DAD of addresses with valid lifetime, typically
discovered addresses) or changes to addresses with dadfailed flag (permanent
addresses, typically link-local and manually configured addresses).
It retries creation of link-local addresses itself and lets RDisc know about
the rest so that it can decide if it's rdisc-managed address and retry
with a new address.

Currently NMDevice doesn't do anything useful about link-local address DAD
failures -- it just fails the link-local address addition instead of just
timing out, which happened before. RDisc just logs a warning and removes
the address from the list.

However, with RFC7217 stable privacy addresses the use of a different address
and thus a recovery from DAD failures would be possible.
2015-11-02 20:27:35 +01:00
Lubomir Rintel
b3e0811b81 rdisc: move address generation into NMRDisc from NMLNDPRdisc
It makes more sense in the generic place. It will make it possible for the
NMRDisc to retry the address generation upon DAD failures.
2015-11-02 20:27:00 +01:00
Lubomir Rintel
60d2504291 ifcfg-rh: add support for addr-gen-mode property 2015-11-02 20:27:00 +01:00