Commit Graph

15847 Commits

Author SHA1 Message Date
Thomas Haller
eb3dd9b679 policy: refactor auto_activate_device() to get rid of "out" cleanup label 2016-09-26 17:10:32 +02:00
Thomas Haller
7a5537ee86 policy: fix owner-ship of specific_object in can_auto_connect()
NMPolicy:auto_activate_device() would wrongly not free the
specific_object, although it is documented as transfer-full.

The only implementation of can_auto_connect() that returned
a specific-object is NMDeviceWifi:can_auto_connect(). So, there
wasn't any actual bug or memory leak.

Fixes: 4c028c7cef
2016-09-26 17:10:07 +02:00
Thomas Haller
ee86069601 shared: add test for NM_SET_OUT() 2016-09-26 17:00:38 +02:00
Beniamino Galvani
d27ae4a8fe checkpoint: merge branch 'bg/checkpoint-improvements-bgo770315'
https://bugzilla.gnome.org/show_bug.cgi?id=770315
2016-09-26 15:10:44 +02:00
Beniamino Galvani
45f72c8cc1 checkpoint: restore both applied and settings connections 2016-09-26 15:10:39 +02:00
Beniamino Galvani
1ab616b59c checkpoint: make python example accept multiple devices and timeout
Add a timeout parameter and allow passing multiple interfaces to make
the script more useful for testing purposes.
2016-09-26 15:10:39 +02:00
Beniamino Galvani
8b9ea0b7c6 checkpoint: consider all devices when an empty list is passed
First, consider all devices and not only realized and managed ones
when an empty list is passed. Also, move the list evaluation to the
checkpoint manager, since the check for device conflicts is done
there.

Fixes: 3e09aed2a0
2016-09-26 15:10:39 +02:00
Beniamino Galvani
c76e218877 checkpoint: use UUID instead of path to match connections
The path can change, while the UUID should univocally identify the
connection.
2016-09-26 15:10:39 +02:00
Beniamino Galvani
637e31bc1f checkpoint: better handle unmanaged and unrealized devices
In order to better restore the previous system state, allow the
inclusion of unmanaged devices in a checkpoint and try to revert to
the old state taking also the realized/managed state into account.
2016-09-26 15:10:39 +02:00
Beniamino Galvani
5754a05605 core: allow passing an applied connection to nm_act_request_new()
This is useful for the checkpoint/restore functionality to revert both
the applied and the settings connections.
2016-09-26 15:10:39 +02:00
Beniamino Galvani
1a6e3e0a57 manager: add nm_manager_get_device_paths() 2016-09-26 15:10:39 +02:00
Thomas Haller
5b8c092d6b device: initialize nm_plugin_missing via constructor property
No need for the setter/getter of this property.

Immutable properties are so much nicer. Remove the setter and
ensure that the nm_plugin_missing property is only set during
object construction.
2016-09-26 13:27:00 +02:00
Thomas Haller
5db62eb51d core: merge branch 'th/device-state-bgo771890'
https://bugzilla.gnome.org/show_bug.cgi?id=771890
2016-09-26 13:16:16 +02:00
Thomas Haller
93396b8d52 config: store and load device runtime state to file
The data is still unused, the actual fields might change.

Note that the actual state we store is subject to change,
according to which data we need. The file format is non stable,
as the files don't survive reboot. So there is no backward
compatibility to maintain and the format can be changed later.
2016-09-26 13:12:02 +02:00
Thomas Haller
1eca446c8c main: create /run/NetworkManager/devices runtime directory 2016-09-26 10:52:12 +02:00
Thomas Haller
1a257a6752 config: use logging macros
For some logging lines we used the wrong logging domain
LOGD_SETTINGS instead of LOGD_CORE.
2016-09-26 10:52:12 +02:00
Thomas Haller
e152eea218 build: fix breakage of enums-to-docbook.pl script for NMCapability enum
GEN      nm-dbus-types.xml
    Documentation for value '*' missing at ../tools/enums-to-docbook.pl line 134, <> line 95.
    Makefile:1579: recipe for target 'nm-dbus-types.xml' failed

Fixes: 93a753e311
2016-09-23 19:11:45 +02:00
Beniamino Galvani
0e96d23733 crypto: don't try to decrypt PKCS#8 key if no password is supplied
crypto_verify_private_key_data() must try to decrypt the key only when
a password is supplied.

Previously the decrypt test always passed because we detected an
unsupported cipher and faked success. Now since version 3.5.4 gnutls
supports PBES1-DES-CBC-MD5 and the key is actually decrypted when a
password is supplied.

Also, don't assert that a wrong password works because we're now able
to actually verify it (only with recent gnutls).

https://bugzilla.gnome.org/show_bug.cgi?id=771623
2016-09-23 18:05:54 +02:00
Thomas Haller
93a753e311 capabilities: add comment about capability range 2016-09-23 16:09:06 +02:00
Thomas Haller
0b48ad4e48 capabilities: merge branch 'th/caps-rh1375967'
https://github.com/NetworkManager/NetworkManager/pull/9
https://bugzilla.redhat.com/show_bug.cgi?id=1375967
2016-09-23 15:50:43 +02:00
Thomas Haller
e80b0a98c0 core: use binary-search for nm_manager_set_capability()
And drop the unused function nm_manager_check_capability().
I don't think we need such a function server-side, as the
server usually has better ways to check whether a capability
is supported.
2016-09-23 15:49:52 +02:00
Thomas Haller
9d00736527 capabilities: fix destroying capabilities in dispose()
dispose() must be re-entrant. Thus, at the very least it must clear the
priv->capabilities after freeing the array.

While at it, move it to finalize (which is only called once) and
move initialization of the array from "constructed" to nm_manager_init()
which is called first.
2016-09-23 15:49:52 +02:00
Thomas Haller
ab26248080 capabilities: fix number for NM_CAPABILITY_TEAM
The enum defines should name their numerical value explicitly,
so that it can be easily seen by looking at the code. Also,
they are public, stable API. They must not change.

Anyway, the capability 0 shall be reserved. Change NM_CAPABILITY_TEAM
to value 1.
2016-09-23 15:49:52 +02:00
Thomas Haller
ede4b1c5e5 libnm: fix symbol versioning
Already released versions must not be extended or modified.
The new symbol is part of upcomming 1.6.0 release.
2016-09-23 15:49:52 +02:00
Thomas Haller
4a6c07d4e5 capabilities: fix data type to "u" / uint32
The property NM_MANAGER_CAPABILITIES was already "au".
The types must be used consistently.
2016-09-23 15:49:52 +02:00
Marius Vollmer
2ca1ce5d88 team: Add NM_CAPABILITY_TEAM 2016-09-23 15:49:52 +02:00
Marius Vollmer
1bb00ae66a manager: Add "Capabilities" property 2016-09-23 15:49:52 +02:00
Thomas Haller
c3ecca225c core: add _nm_utils_array_find_binary_search()
Also add nm_cmp_uint32_p_with_data(). Will be used later.
2016-09-23 15:49:29 +02:00
Thomas Haller
08f5681b0e core: const arguments for _nm_utils_ptrarray_find_*() functions 2016-09-23 15:34:17 +02:00
Lubomir Rintel
e59ed6451f contrib/rpm: require at least the version of glib we built against
glib neither versions its symbols nor bumps SONAME on API changes, so rpm can't
figure out the correct dependencies itself.

https://bugzilla.redhat.com/show_bug.cgi?id=1378809
2016-09-23 12:20:23 +02:00
Beniamino Galvani
36f561ead0 cli: merge branch 'bg/cli-readline-async-rh1368353'
https://bugzilla.gnome.org/show_bug.cgi?id=732097
https://bugzilla.redhat.com/show_bug.cgi?id=1368353
2016-09-23 09:48:32 +02:00
Beniamino Galvani
995229181c cli: remove editor thread
Currently the editor runs in a dedicated thread so that the blocking
call to readline() doesn't stop the processing of D-Bus events in the
main loop. The editor thread can access objects concurrently with the
main thread and this can cause races and crashes.

Remove the editor thread and use the non-blocking readline API.

https://bugzilla.gnome.org/show_bug.cgi?id=732097
https://bugzilla.redhat.com/show_bug.cgi?id=1368353
2016-09-23 09:46:28 +02:00
Beniamino Galvani
a2dac38174 cli: clear source when progress callback terminates 2016-09-23 09:46:28 +02:00
Beniamino Galvani
3ea5efd008 cli: fix wrong memory allocation size
Fixes: 8d9718bd0f
2016-09-23 09:46:28 +02:00
Thomas Haller
c6ac2310dc dhcp: add FIXME comment to nm-dhcp-helper.c 2016-09-23 09:37:21 +02:00
Thomas Haller
0fb723e720 libnm: relax comparison of bond-option for INFERRABLE match
When comparing the bond-settings of an activated device against
the settings from the connection, some properties might easily
differ. Hack them around in NMSettingBond:compare_property().

For example:

the setting in the connection has:
    [bond]
    mode=active-backup

later, the device gets:
    [bond]
    active_slave=inf_ib0
    fail_over_mac=active
    mode=active-backup

Note that the fail_over_mac changes due to:
  kernel: nm-bond: enslaved VLAN challenged slave inf_ib0. Adding VLANs will be blocked as long as inf_ib0 is part of bond nm-bond
  kernel: nm-bond: The slave device specified does not support setting the MAC address
  kernel: nm-bond: Setting fail_over_mac to active for active-backup mode

https://bugzilla.redhat.com/show_bug.cgi?id=1375558
2016-09-22 18:32:54 +02:00
Thomas Haller
78957c0d39 device: fix nm_utils_match_connection() for NMSettingInfiniband:mac-address
<debug> [1474469475.3318] Connection 'inf_ib0' differs from candidate 't-inf' in infiniband.mac-address
    <debug> [1474469475.3318] manager: (inf_ib0): generated connection 'inf_ib0'

https://bugzilla.redhat.com/show_bug.cgi?id=1375558
2016-09-22 16:48:27 +02:00
Thomas Haller
b1fd5a06c4 macros: simplify NM_IN_SET() and NM_IN_STRSET() macros
and support up to 16 arguments.
2016-09-22 16:34:22 +02:00
Beniamino Galvani
f1165cc290 device: rework state transition after IP configuration
Unify the two check_ip_done() and check_ip_failed() functions into a
single one to have all the state transition logic in the same place.

This also fixes a regression introduced by commit 553717bb1c
("device: don't set ip4_state=IP_FAIL for ipv4.method=disabled").
After that commit the device immediately proceeded to IP_CHECK when
there was a disabled/ignore method. Now we wait for the termination of
the other method, like it used to be.

Fixes: 553717bb1c

https://bugzilla.gnome.org/show_bug.cgi?id=771579
2016-09-22 14:12:06 +02:00
Beniamino Galvani
dbf0b343ec device: fix NULL pointer dereference in dhcp6_start()
Don't crash when nm_device_dhcp6_renew() calls dhcp6_start() with NULL
@reason.

Fixes: d1295b12e9
2016-09-22 11:34:23 +02:00
Christian Kirbach
899d5e5c82 po: update German (de) translation (bgo#771732)
https://bugzilla.gnome.org/show_bug.cgi?id=771732
2016-09-21 11:24:27 +02:00
Beniamino Galvani
58349c3885 man: NetworkManager.conf: better document dns=dnsmasq
It's potentially unexpected by user that dnsmasq works differently
from the libc resolver and doesn't try the servers in order. Add a
paragraph to explain that and how to tweak the resolution order.
2016-09-20 15:32:37 +02:00
Beniamino Galvani
b1bf2671b2 build: fix build with address sanitizer
Every program run during the build which loads a NM library must
preload libasan.so if the address sanitizer is enabled.

Add a macro to set the needed environment variables and use it when
performing the shared object link tests.
2016-09-20 13:44:04 +02:00
Beniamino Galvani
fb40060ac1 build: add macro to check shared objects symbols 2016-09-20 13:43:20 +02:00
Beniamino Galvani
a875603355 cli: merge branch 'jk/nmcli-complete-regression-rh1375933'
https://bugzilla.redhat.com/show_bug.cgi?id=1375933
2016-09-19 16:58:40 +02:00
Jiří Klimeš
52723bd743 cli: fix yes/no completion in questionnaire mode 2016-09-19 16:58:18 +02:00
Jiří Klimeš
08a74c272b cli: tab-complete "Interface name [*]" in questionnaire mode 2016-09-19 16:58:18 +02:00
Jiří Klimeš
c2ef397867 cli: enable bash completion for some more properties of add/modify
connection.interface-name
mavclan.tap
mavclan.parent
ip-tunnel.parent
vxlan.parent
2016-09-19 16:58:18 +02:00
Jiří Klimeš
61a56aa3db cli: fix completion/add missing functions for '--complete-args' (rh #1375933)
This makes bash completion work again for 'nmcli connection add'.

Fixes: 8b39090597

https://bugzilla.redhat.com/show_bug.cgi?id=1375933
2016-09-19 16:55:40 +02:00
Jiří Klimeš
1f0ba2e487 cli: (trivial) move gen_func_ifnames() from devices.c to common.c
and rename it to nmc_rl_gen_func()
2016-09-19 16:55:39 +02:00