Commit Graph

17250 Commits

Author SHA1 Message Date
Francesco Giudici
a62b72272f nmcli: fix missing CONNECTIONS section name from nmcli -f all -m tab dev show <dev>
When a full section is specified as the field parameter in terse tabular
mode, the section name should be printed followed by all the field values
belonging to that section separated by ':'. The NAME of section CONNECTIONS
was missing.

sample command:
$ nmcli -m tab -t -f CONNECTIONS device show ens3
previous output was:
/org/freedesktop/NetworkManager/Settings/{1}:5059XXX-XXXX.. | ens3-dhcp
now:
CONNECTIONS:/org/freedesktop/NetworkManager/Settings/{1}:5059XXX-XXXX.. | ens3-dhcp
2017-03-28 10:55:00 +02:00
Francesco Giudici
7d96f1f17d nmcli: don't enforce anymore the -f(ields) option in -t(erse) mode 2017-03-28 10:55:00 +02:00
Francesco Giudici
4fa2e1422d nmcli: (trivial) add comment 2017-03-28 10:55:00 +02:00
Francesco Giudici
7b589a0aef nmcli: refactor print_required_fields
When only the main header should be printed and output mode
is 'pretty' skip the construction of the string containing
field values as it will not be used.
2017-03-28 10:55:00 +02:00
Francesco Giudici
cf39ef52da nmcli: remove redundant check 2017-03-28 10:55:00 +02:00
Francesco Giudici
6520cf1171 nmcli: always print "--" for empty or unset values in normal/pretty output
This was already true for tabular ouput mode.
Align to this behavior when printing in multiline mode.
2017-03-28 10:55:00 +02:00
Francesco Giudici
39f1d44ec8 nmcli: output just the raw value of vlan.flags when in terse mode 2017-03-28 10:55:00 +02:00
Francesco Giudici
3e3d36450c nmcli: don't substitute empty strings with "--" in terse mode 2017-03-28 10:55:00 +02:00
Francesco Giudici
623d888801 nmcli: output property values in "parsable" mode when the "--terse" option is specified
Don't print value output in the "PRETTY" format when the --terse option
has been specified.
This should allow to feed back the output from "nmcli show" to "nmcli
modify" without changes.
2017-03-28 10:55:00 +02:00
Alfonso Sánchez-Beato
76cf0e590f Remove assertion for empty DHCP options
It turns out that some routers return responses to DHCP6
Information-request messages that do not contain any of the options
that we insert in the "options" table. When that happened and the
info-only flag for DHCP6 was set, the assertion was triggered and
NetworkManager crashed. We remove the assertion as having empty options
is a possibility and is harmless anyway. This happened while using the
internal dhclient.
2017-03-28 06:50:54 +02:00
Beniamino Galvani
1db6c80cee merge: branch 'bg/slaves-order-rh1420708'
https://bugzilla.redhat.com/show_bug.cgi?id=1420708
2017-03-27 21:52:39 +02:00
Beniamino Galvani
529a0a1a7f manager: sort slaves to be autoconnected by device name
Autoconnect slaves based on device name order instead of activation
timestamp.
2017-03-27 21:51:55 +02:00
Beniamino Galvani
826f510303 manager: rework find_slaves() to return the matching device
Perform the lookup for a matching device earlier, so that in
autoconnect_slaves() we already know which device a connection is
being activated on. This will be needed to sort the returned
connections by interface name.
2017-03-27 21:51:55 +02:00
Beniamino Galvani
7fd987f7be manager: change nm_manager_get_best_device_for_connection() signature
Add a @unavailable_devices argument that specifies an hash table of
devices to be excluded from the search.
2017-03-27 21:51:55 +02:00
Beniamino Galvani
39d0559d9a platform: sort links by name instead of ifindex
We should try to guarantee a stable activation order of connections
across reboots; this is required, for example, for bonds because they
get assigned the MAC address of the first device enslaved, and thus
changing the activation order of slaves means also changing the MAC
address of the bond. Since we activate connections in the order links
are discovered, having a stable sorting of links returned by platform
is enough.

The ifindex of interfaces can change between reboots as it depends on
the order in which kernel discover interfaces. Provided that the
system uses a mechanism to enforce persistent interface naming (as
udev rules or systemd-udevd predictable names), and that NM starts
after all interfaces have been announced by udev, using the interface
name instead of ifindex will guarantee a consistent order.
2017-03-27 21:51:55 +02:00
Beniamino Galvani
52b1f0415d manager: check that slaves connection have a compatible device
When slave connections are autoactivated as dependency to master we
don't check if a compatible device is available before trying to
activate them, leading to the following failed assertion:

 nm_act_request_new: assertion 'NM_IS_DEVICE (device)' failed
2017-03-27 21:51:55 +02:00
Thomas Haller
6e1616ba69 cli: fix completion of setting names for --fields 2017-03-26 19:48:29 +02:00
Thomas Haller
163e193286 libnm: fix type annotation for nm_utils_enum_from_str() 2017-03-25 17:12:27 +01:00
Francesco Giudici
017b7c2bb6 merge: branch 'fg/keep_externally_set_hostname-rh1422610'
https://bugzilla.redhat.com/show_bug.cgi?id=1422610
https://bugzilla.redhat.com/show_bug.cgi?id=1405275
2017-03-24 17:00:48 +01:00
Francesco Giudici
70c768901b man: add description for the 'hostname' config option in the main section 2017-03-24 15:18:09 +01:00
Francesco Giudici
76b2e9542f policy: add some verbose logging for tracking hostname management 2017-03-24 15:18:09 +01:00
Francesco Giudici
8ffc68cc0e policy: allow reset of dhcp hostname in "dhcp" hostname-mode config.
When dhcp hostname-mode is selected, NetworkManager will just update the
hostname with information available from DHCP (if any).
So, when a connection providing a DHCP host-name option is brought up we
update the transient hostname. When it is later teared down, this will
trigger NetworkManager to update the hostname: this time no DHCP host-name
option will be found and so the hostname will not be changed, keeping
the obsoleted one from the disappeared DHCP option.
In order to fix this we have to keep track if the last hostname set was
retrieved from the DHCP host-name option: in this case NetworkManager
will be able to reset it by applying back the previous hostname.
2017-03-24 15:18:09 +01:00
Francesco Giudici
2eba42b4ab policy: add support to configurable hostname mode 2017-03-24 15:18:09 +01:00
Francesco Giudici
e22af1aa9e nm-config: fix comment typo 2017-03-24 15:18:09 +01:00
Francesco Giudici
7c4bd15ec6 policy: skip dns and route updates on ip6 config change signal if the device is not active
This pairs with commit 30a1e17cc0.
2017-03-24 15:18:09 +01:00
Francesco Giudici
d34add6f00 policy: detect if the hostname was changed outside NetworkManager
When updating the hostname we can now detect if someone else changed
the hostname: if so, search for hostname candidates in the dhcp
configuration but avoid to fallback to the hostname saved when NM
started or querying dns for a reverse lookup of the current IP.
2017-03-24 15:18:08 +01:00
Francesco Giudici
b7557fa723 policy: remove redundant check in _set_hostname
This will allow also to remove the hostname_changed var from
NMPolicyPrivate struct.
2017-03-24 15:18:08 +01:00
Francesco Giudici
bdd2e1c2aa policy: try to retrieve hostname from dbus first
As we try to set the hostname through dbus, we should also try to
retrieve current hostname value from dbus first: otherwise we may end
retrieving the "old" hostname via gethostname while the dbus hostnamed
updated is pending.
2017-03-24 15:18:08 +01:00
Beniamino Galvani
f20bdebae9 device: deal with non-existing IP settings in get_ip_config_may_fail()
If the IP setting does not exist, consider the IP method as
may-fail=yes. This simplifies the decision path in check_ip_state(),
where the value of may-fail is used to decide whether we must wait for
the IP method to complete. If there is no IP setting (i.e. the device
is a slave), we don't have to wait for it to be applied.

Fixes the following:

nm_setting_ip_config_get_may_fail: assertion 'NM_IS_SETTING_IP_CONFIG (setting)' failed
Process terminating with default action of signal 5 (SIGTRAP): dumping core
    at 0x6C95643: g_logv (gmessages.c:1086)
    by 0x6C957BE: g_log (gmessages.c:1119)
    by 0x193CB3: nm_setting_ip_config_get_may_fail (nm-setting-ip-config.c:2336)
    by 0x2431D0: check_ip_state (nm-device.c:4643)
    by 0x24770B: nm_device_activate_stage3_ip6_start (nm-device.c:7594)
    by 0x247EC7: nm_device_master_enslave_slave (nm-device.c:1769)
    by 0x8659DCB: ffi_call_unix64 (unix64.S:76)
    by 0x86596F4: ffi_call (ffi64.c:522)
    by 0x6801147: g_cclosure_marshal_generic (gclosure.c:1487)
    by 0x6800907: g_closure_invoke (gclosure.c:801)
    by 0x6812A1C: signal_emit_unlocked_R (gsignal.c:3627)
    by 0x681AAB0: g_signal_emit_valist (gsignal.c:3383)
    by 0x681AD9E: g_signal_emit (gsignal.c:3439)
    by 0x241F04: _set_state_full (nm-device.c:12272)
    by 0x248E86: activate_stage3_ip_config_start (nm-device.c:7626)
    by 0x227D83: activation_source_handle_cb (nm-device.c:4204)
    by 0x227E3D: activation_source_handle_cb4 (nm-device.c:4141)
    by 0x6C8ED79: g_main_dispatch (gmain.c:3152)
    by 0x6C8ED79: g_main_context_dispatch (gmain.c:3767)
    by 0x6C8F0B7: g_main_context_iterate.isra.24 (gmain.c:3838)
    by 0x6C8F389: g_main_loop_run (gmain.c:4032)
    by 0x139A80: main (main.c:425)
2017-03-24 14:14:29 +01:00
Lubomir Rintel
996e081af3 merge: branch 'lr/log-hints-1'
Adds NM_DEVICE and NM_CONNECTION tags to journal in various places.

When we're well covered, we can add hints to inspect relevant logs
to the client (which this merge does not).

https://bugzilla.gnome.org/show_bug.cgi?id=779536
2017-03-24 12:42:37 +01:00
Lubomir Rintel
cbefd39ce1 iface-helper: log the device context 2017-03-24 12:42:09 +01:00
Lubomir Rintel
8813164b24 keyfile: log the connection context 2017-03-24 12:42:09 +01:00
Lubomir Rintel
323bdc26ea vpn/vpn-connection: log the connection context 2017-03-24 12:42:09 +01:00
Lubomir Rintel
eccad6fa90 settings-connection: log the connection context 2017-03-24 12:42:09 +01:00
Lubomir Rintel
35d7c93405 active-connection: log the connection context 2017-03-24 12:42:09 +01:00
Lubomir Rintel
e6a3e4a06d wwan/modem-broadband: log the connection context 2017-03-24 12:42:09 +01:00
Lubomir Rintel
8da65ac5cd supplicant: log the device context 2017-03-24 12:42:09 +01:00
Lubomir Rintel
c307163b77 ndisc: log the device context 2017-03-24 12:42:09 +01:00
Lubomir Rintel
bc8d4c0366 dhcp: log the device context 2017-03-24 12:42:09 +01:00
Lubomir Rintel
096ab79070 devices/lldp: log the device context 2017-03-24 12:42:09 +01:00
Lubomir Rintel
0f5cf595a0 devices/arping-manager: log the device context 2017-03-24 12:42:09 +01:00
Lubomir Rintel
a30f327b74 devices: log the device context 2017-03-24 12:42:09 +01:00
Lubomir Rintel
ed552c732c logging: log device and connection along with the message 2017-03-24 12:42:09 +01:00
Lubomir Rintel
03a3fd9014 logging: respect choice of journal/syslog even with --debug
Previously, the daemon would just use syslog with LOG_PERROR when run with
--debug option, even when actually configured to log into the journal.
Let's respect the configuration, but preserve the logging to stderr.
2017-03-24 12:42:09 +01:00
Thomas Haller
b11b603879 libnm: handle errors gracefully in nm_access_point_connection_valid()
Suppress warnings and avoid assertions in
nm_access_point_connection_valid().

https://bugzilla.gnome.org/show_bug.cgi?id=773675
2017-03-24 12:08:03 +01:00
Lubomir Rintel
7750a384a5 libnm-util/vapi: add missing dependencies
Works by dumb luck for in-tree build, because the .deps files that are
meant for the distribution happen to be the builddir. The out-of-tree
builds would generate an empty file.
2017-03-24 11:38:49 +01:00
Lubomir Rintel
ec17f82960 build: yet another missing dependency 2017-03-24 11:38:49 +01:00
Thomas Haller
0a34ae55a2 core/trivial: rename nm_utils_10pow() to nm_utils_exp10()
nm_utils_exp10() is a better name, because it reminds of the function
exp10() from <math.h> which has a similar purpose (but whose argument
is double, not gint16).
2017-03-24 11:28:57 +01:00
Thomas Haller
29a47f40f8 build: configure explicit paths for dist tarball during "build_clean.sh"
"build_clean.sh" is used to generate a distribution tarball. The tarball
contains pregenerated man pages with default values for paths, which in
turn depend on the configure options when creating the tarball.

Previously, the man page would have paths like "usr/local/etc/NetworkManager/...",
which doesn't seem the best choice for a default man page.

Explicitly set the installation paths.

Also, --disable-dependency-tracking in this mode. It may speed up the
build.
2017-03-24 11:20:00 +01:00
Thomas Haller
8b9dfa013d build: fix building clients/cli/settings-docs.c (4)
We also dist libnm/nm-property-docs.xml, so depending on
whether we build from git or source tarball, the file
is in $(srcdir) or $(builddir).

Fixes: d7ad13591b
2017-03-24 10:48:56 +01:00