Commit Graph

18368 Commits

Author SHA1 Message Date
Thomas Haller
c4ef6f2d2f cli: fix assertion in tab completion for gen_property_names()
$ nmcli connection edit type ethernet
  nmcli> describe x.y<TAB>
  (process:29799): libnmc-CRITICAL **: nm_meta_setting_info_editor_find_by_name: assertion 'setting_name' failed
2017-06-29 09:46:21 +02:00
Yuri Chornoivan
5fad8aeb51 po: update Ukrainian (uk) translation (bgo#784166)
https://bugzilla.gnome.org/show_bug.cgi?id=784166
2017-06-29 09:34:36 +02:00
Lubomir Rintel
aa0707005c tools: fix the PowerPC build
On ppc archtecture the "nm_bt_vtable_network_server" symbol in the small
objects section instead of .bss, represencted by a "S" letter. Also
include "G" which is an equivalent thing for initialized data. We don't
seem to have such objects at the moment, but when we do it could result
in a nasty surprise.
2017-06-28 18:35:23 +02:00
Thomas Haller
8efeb3688c cli: fix returning no results in complete function
For consistency, never return an empty array @values.
If we have an empty array, instead return NULL.

Also fixes commit afac7621a "clients: return NULL array on
auto-completion failure", which claims that readline crashes
with empty strv arrays.

Fixes: afac7621ae
2017-06-28 14:46:15 +02:00
Thomas Haller
870f493853 cli: fix crash in complete function
$ nmcli --complete-args connection import type non-existing-<TAB>

Leads to a double-free of out_to_free, as we call g_free(v) in
nm_meta_abstract_info_complete().

Also fix a memleak when skipping over non-matching values.

Fixes: afac7621ae
2017-06-28 14:29:26 +02:00
Beniamino Galvani
699492c1a5 libnm-core: 8021x: fix check on private key password
Commit df0dc912cc ("8021x: don't request secrets if they are empty
and system owned") changed need_private_key_password() to return FALSE
when flags are NONE. This broke authentication using an encrypted
private key because after this the key password is never added to the
applied connection.

Don't require a password with NONE flags only for the PKCS11 scheme.

Fixes: df0dc912cc
2017-06-27 10:11:44 +02:00
Beniamino Galvani
65a0208ba0 core,cli: replace wrong pattern for clearing GError
Use gs_free_error instead of gs_free.
2017-06-27 09:42:28 +02:00
Mike Gorse
6405d17730 Move CONF_DHCP definition to nm-hostname-manager.c
It is only referenced from there. Fixes the build if HOSTNAME_PERSIST_SUSE
is defined.

Fixes: 5bfb7c3c89

https://bugzilla.gnome.org/show_bug.cgi?id=784225
2017-06-27 09:05:42 +02:00
Lubomir Rintel
d473b34745 cli: prioritize devices with default routes and addresses
This makes "nmcli" and "nmcli d" output slightly more useful.
2017-06-26 15:17:49 +02:00
Beniamino Galvani
2b405c98fb introspection: slightly improve checkpoint documentation
Fix CheckpointCreate() arguments formatting, add link to create flags
and capitalize sentences.
2017-06-26 09:59:35 +02:00
Beniamino Galvani
92fc109183 bond: ignore miimon option only when it is zero
The default value for miimon, when missing in the setting, is 0 if
arp_interval is != 0, and 100 otherwise. So, when generating a
connection, let's ignore miimon=0 (which means that miimon is
disabled) and accept any other value. Adding miimon=100 does not cause
any harm to the connection assumption.

While at it, slightly improve the code: ignore_if_zero() is not useful
for 'updelay','downdelay','arp_interval' because zero is their default
value, so introduce a new function that checks if the value is the
default (and specially handles 'miimon').

Reported-by: Taketo Kabe <rkabe@vega.pgw.jp>

https://bugzilla.redhat.com/show_bug.cgi?id=1463077
2017-06-23 11:18:51 +02:00
Beniamino Galvani
bfb4c248b6 cli: merge branch 'bg/cli-ask-fixes-rh1464001'
Fix some regressions in nmcli.

https://bugzilla.redhat.com/show_bug.cgi?id=1464001
2017-06-22 15:01:30 +02:00
Beniamino Galvani
f545ed486e cli: ask NMSettingConnection properties first in questionnaire mode
Since properties are asked only when the connection has the related
setting, ensure that the connection type is set early so that the base
type gets added to the connection before evaluating other settings.

After NMSettingConnection properties, ask properties for the base
setting and then all other settings.
2017-06-22 15:01:15 +02:00
Beniamino Galvani
46d2168393 clients: reorder properties of connection setting
The order matters for the 'nmcli connection show' output and for the
interactive mode of nmcli. Users should not rely on the order in both
cases, but since we have an extensive test suite for the interactive
mode, restore the order as it was in 1.8.
2017-06-22 15:01:15 +02:00
Beniamino Galvani
afac7621ae clients: return NULL array on auto-completion failure
readline crashes if we return an empty completion list; return NULL
instead.

This is reproducible, for example, with:

 $ nmcli --ask connection add
 Interface name [*]: doesnotexist<TAB>
 Segmentation fault (core dumped)

 $ nmcli --ask connection add
 Interface name [*]:
 Connection type: avian-carr<TAB>
 Segmentation fault (core dumped)
2017-06-22 15:01:15 +02:00
Thomas Haller
a84facb90c device: merge branch 'th/master-no-ignore-carrier-pr18'
https://github.com/NetworkManager/NetworkManager/pull/18
2017-06-22 13:27:09 +02:00
Nikolay Martynov
8c91422954 device: handle carrier changes for master device differently
For master devices, instead of ignoring loss of carrier entirely,
handle it.

First of all, master devices are now by default ignore-carrier=yes.
That means, without explict user configuration in NetworkManager.conf,
the previous behavior in carrier_changed() does not change.

If the user decides to configure the master device like

    [device-with-carrier]
    match-device=type:bond,type:bridge,type:team
    ignore-carrier=no

then, master device will disconnect on carrier loss like
regular devices.

https://github.com/NetworkManager/NetworkManager/pull/18

Co-authored-by: Thomas Haller <thaller@redhat.com>
2017-06-22 13:27:01 +02:00
Thomas Haller
b0f6baad90 device: renew IP addressing on carrier change also for master devices
Commit 348452f1e0 (device: renew DHCP
lease for active "ignore-carrier" devices on carrier-on (bgo #743368))
added this behavior for non-master devices.

The same reasoning applies here too.

https://github.com/NetworkManager/NetworkManager/pull/18

Based-on-patch-by: Nikolay Martynov <mar.kolya@gmail.com>
2017-06-22 13:26:53 +02:00
Thomas Haller
e9a917d619 device: refactor how master device's set is_available()
Previously, master device types like bridge, bond, and team
would overwrite is_available() and check_connection_available()
and always return TRUE.

The device already expresses via nm_device_is_master() that it
is of a master kind. Refactor the code, so, instead of having these
device types overwrite is_available() and check_connection_available(),
let the parents implementation react on nm_device_is_master().

There is no change in behavior at all. Instead, the knowledge how to
treat a master device moves from the device implementation to the
parent class.
2017-06-22 13:26:53 +02:00
Thomas Haller
98651b90a1 device: handle default for unset ignore-carrier option depending on device
Currently, device types like Bond hack around ignore-carrier
setting, as they always want to ignore-carrier.

Prepare so that also for such master types, we rely and honor the
ignore-carrier setting better. In the next commit, bond, bridge and
team devices they will get ignore-carrier turned on by default.
2017-06-22 13:26:53 +02:00
Beniamino Galvani
7ee1af5f8a libnm-core: setting-bond: add missing xmit_hash_policy values
Add the missing values "encap2+3" and "encap3+4".

https://bugs.centos.org/view.php?id=11467
2017-06-22 10:54:51 +02:00
Francesco Giudici
d4a033c4ad manager: when a connection is upped on a device, do an early update of its internal state
When a user forces up a connection on a device, mark earlier the
device as managed: this would allow proper clean-up on the device also
when it was previously unmanaged or assumed.
This would avoid skipping IPv6LL address generation when instead it was
needed.

Fixes: adbf383628

https://bugzilla.redhat.com/show_bug.cgi?id=1452046
2017-06-21 16:12:09 +02:00
Thomas Haller
6b1dcb3641 libnm: merge branch 'th/libnm-dbus-object-async-rh1450075'
https://bugzilla.redhat.com/show_bug.cgi?id=1450075
2017-06-19 17:28:35 +02:00
Thomas Haller
357fd6ba82 libnm: remove property getter for NMObject's "dbus-object" and "dbus-object-manager"
These properties are internal and shall not be publicly accessible.
Remove the getter.

We may later no longer use GDBusObjectManager. It should be an implementation
detail, not exposed in the public API of NMObject.
2017-06-19 17:20:34 +02:00
Thomas Haller
c5370ea71a libnm: refactor error handling in got_object_manager() 2017-06-19 17:20:34 +02:00
Thomas Haller
529d620a59 libnm: don't use async constructor for GDBusObjectManager
The current implementation of GDBusObjectManagerClient implements
GAsyncInitableIface, however it simply runs GInitableIface's
synchronous init on another thread.

I suspect that there are races in the way that is implemented.
For one, we see crashes and warnings (rh#1450075, rh#1457769,
rh#1457223). Also, it seems very wrong to me, how GDBusObjectManagerClient
mixes asynchronous signals (on_control_proxy_g_signal) with
synchronously getting all objects (process_get_all_result,
GetManagedObjects).

I think we should ditch GDBusObjectManager altogether, including the
gdbus-codegen skeletons. They add layers of code, for something that
should be simple to do directly. For now, just don't do asynchronous
initialization on another thread, so we at least avoid this kind of
multithreadding issue.

This may make the initialization of NMClient a bit slower.
2017-06-19 17:19:48 +02:00
Thomas Haller
c5a48b7a0b libnm: complete async result in got_object_manager() also when cancelled
Cancelling an operation shall not mean to not invoke the result callback.
The result callback is *always* to be invoked.
2017-06-19 17:19:17 +02:00
Beniamino Galvani
0922a17738 manager: avoid that auto-activations preempt user activations
In _internal_activate_device(), we try to find an existing master AC
for the slave AC, and we create a new one in case of failure. The
master AC may already exist, but it may not be detected by
find_master() because it is undergoing authorization.

The result is that we auto-activate the master when there is already a
user activation in place, and the auto-activation will cancel the user
one. This is bad, as user-activation should always have precedence.

To fix this, introduce a last-minute check before activating internal
connections.

https://bugzilla.redhat.com/show_bug.cgi?id=1450219
2017-06-19 15:56:05 +02:00
Thomas Haller
02d56ec87c dns: merge branch 'th/fix-dns-priority-for-resolved-bgo783569'
https://bugzilla.gnome.org/show_bug.cgi?id=783569
2017-06-19 15:14:01 +02:00
Thomas Haller
19a98c6f61 dns: don't clone DNS configs list for nm_dns_plugin_update()
No need to clone the list anymore. Unfortunately, GPtrArray is not NULL
terminated (without extra effort), so we have to pass on the GPtrArray
instance for the length.
2017-06-19 15:12:49 +02:00
Thomas Haller
70792e51d9 dns: fix negative ipv4.dns-priority for systemd-resolved
A negative ipv4.dns-priority and ipv6.dns-priority has the meaning to configure
the DNS information of the connection exclusively. With systemd-resolved, that means
we must explicitly unset the configuration from other interfaces.

https://bugzilla.gnome.org/show_bug.cgi?id=783569
2017-06-19 15:12:49 +02:00
Thomas Haller
d582176939 dns: make configs argument to update a const pointer 2017-06-19 15:12:49 +02:00
Thomas Haller
1c9285b06e dns/systemd: remove unused device lookup in add_interface_configuration() 2017-06-19 15:12:49 +02:00
Thomas Haller
c818e46d48 dns: add helper method to get DNS priority from NMDnsIPConfigData 2017-06-19 15:12:49 +02:00
Thomas Haller
aa347182bb dns: minor refactoring in _collect_resolv_conf_data()
The code was correct previously, but it was confusing to me,
because

  - once @skip gets set to TRUE, it stays TRUE for the rest
    of the loop.
  - in each additional skipped iteration, it would still set
    plugin_confs[i] to NULL. Which is not wrong, but confusing.
  - it would set "prev_prio = prio;" in each iteration.
    After @skip is set to TRUE, that doesn't matter anymore,
    but is confusing. Before @skip is set to TRUE it also
    doesn't really matter to set it more then once, because
    we only care about the very first priority.
  - @skip sounded to me like the current iteration would
    be skipped. But really all remaining will be skipped too.
2017-06-19 15:12:49 +02:00
Thomas Haller
f71195b102 device: merge branch 'th/device-reapply-external-rh1462223'
https://bugzilla.redhat.com/show_bug.cgi?id=1462223
2017-06-19 15:00:27 +02:00
Thomas Haller
10c0632df0 device: fix taking over device after modifying external connection
For externally managed interfaces, we create an in-memory connection
and keep the device with sys-iface-state=external.

When the user actively modifies the connection, we persist it to
storage. But we also must take over managing the device.

One problem is that nm_device_reapply() errors out if the device
is still activating. It's unclear how to reapply the connection
while the device is in the process of activation. So, if the user
modifies the created connection very quickly, reapplying the settings
will fail.

https://bugzilla.redhat.com/show_bug.cgi?id=1462223
2017-06-19 14:57:48 +02:00
Thomas Haller
b84da25713 core: fix registering notify-flags hook in NMActiveConnection
We react on changes to NMSettingsConnection.flags, so that we can update
from an external activation to a managed one.

However, previously we would only register the _settings_connection_notify_flags
callback during _set_settings_connection(). So, if via constructor properties
we first set PROP_SETTINGS_CONNECTION and later PROP_ACTIVATION_TYPE, we wouldn't
register the callback.
2017-06-19 14:28:00 +02:00
Thomas Haller
2656ba8d1d core: log changes to NMSettingsConnection's flags 2017-06-16 13:47:08 +02:00
Tom Gundersen
6c8fe5754c ifcfg-rh: refactor dbus policy
This drops some redundant rules and orderes the remaining ones by
precedence.

The 'root' rules take precedence over the 'default' rules, so order
the file accordingly.

It is not necessary to repeat send_destination rules, as the default
rules already allows everyone to send to the interface.

Moreover, it is not necessary to restrict the ownership of the name
in the default context, as this is already done by the system-wide
default rule.

Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
2017-06-15 13:20:55 +02:00
Beniamino Galvani
cd3a561251 cli: fix failed assertion in readline helper
The INT signal can arrive after a new line has been processed in
nmc_readline_helper(). In such case, the handler gets uninstalled by
readline_cb() and nmc_seen_sigint() returns TRUE. However it's an
error to call rl_callback_read_char() without handler, don't do it.

Fixes the following:
 "readline: readline_callback_read_char() called with no handler!"
 #0 __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
 #1 __GI_abort () at abort.c:90
 #2 rl_callback_read_char () at ../callback.c:116
 #3 nmc_readline_helper (prompt=prompt@entry=0x2aa0d229080 "nmcli> ") at clients/cli/common.c:1387
 #4 nmc_readline (prompt_fmt=prompt_fmt@entry=0x2aa0036ac9e "%s") at clients/cli/common.c:1448
 #5 do_connection_edit (connection=0x2aa0d215440, nmc=0x2aa00391298 <nm_cli>) at clients/cli/connections.c:7072

Fixes: 995229181c

https://bugzilla.redhat.com/show_bug.cgi?id=1458311
2017-06-15 10:03:58 +02:00
Thomas Haller
bd59b8ddf4 dhcp: merge branch 'th/sd-dhcp-domain-search-list-bgo783785'
https://bugzilla.gnome.org/show_bug.cgi?id=783785
2017-06-14 15:52:58 +02:00
Thomas Haller
203ffede01 dhcp/systemd: add support for DHCPv4 domain search list (option 119) 2017-06-14 15:49:39 +02:00
Thomas Haller
b55fba8fbd build: fix race creating "libnm-core/tests" directory for "nm-core-tests-enum-types.c"
https://bugzilla.gnome.org/show_bug.cgi?id=783783
2017-06-14 14:04:57 +02:00
Thomas Haller
e02f5454fd dhcp: cleanup formatting of LOG_LEASE() macro in lease_to_ip4_config()
and lease_to_ip6_config().

The use of a prefix should be done by LOG_LEASE() macro, instead
of each caller individually.
2017-06-14 14:04:57 +02:00
Thomas Haller
4fd023b617 dhcp: reuse string buffer in lease_to_ip4_config()
In lease_to_ip4_config() avoid creating multiple GString buffers. Just
reuse it.
2017-06-14 14:04:57 +02:00
Thomas Haller
3c1466b7de dhcp/trivial: rename local variables
lease_to_ip6_config() calls the GString temporary buffer "str".
That makes sense, use the same name in lease_to_ip4_config().

For that, we have to rename other local variables too.
2017-06-14 14:04:57 +02:00
Thomas Haller
bb53b46bd1 shared: add nm_gstring_prepare() util 2017-06-14 14:04:57 +02:00
Thomas Haller
6e5cc2b24f wifi: fix cancelling WPS during pending ProcessCredentials
When we cancel WPS, we must cancel the GCancellable. Otherwise,
ProcessCredentials will return and proceed with Start.

Fixes: 9bfb4f0d09
2017-06-14 13:52:40 +02:00
Thomas Haller
be3d897758 systemd: merge branch systemd into master
- adjust nm-sd-adapt.h to new LogRealm
- add support for DHCP search domain list
2017-06-14 13:10:05 +02:00