Commit graph

15245 commits

Author SHA1 Message Date
Beniamino Galvani
88637dee66 vpn,dns: merge branch 'bg/vpn-dns-rh1348901' 2016-06-28 16:39:17 +02:00
Beniamino Galvani
df48628a48 vpn: don't merge DNS properties into parent device's configuration
DNS properties should not be copied to parent device's configuration
otherwise they will be applied twice, possibly with two different DNS
priorities.
2016-06-28 16:24:28 +02:00
Beniamino Galvani
a5d1db08f8 dns: log DNS servers at TRACE level
Be more verbose at TRACE level and log the DNS servers associated to
configurations. This will help to debug issues like [0].

[0] https://bugzilla.redhat.com/show_bug.cgi?id=1348887
2016-06-28 16:24:28 +02:00
Beniamino Galvani
641e8b00fe vpn: reuse existing ip_config objects when config gets updated
Previously we created a new NMIP[46]Config object to replace the
previous one every time the plugin reported a new IP configuration
through the Ip[46]Config signal, but the old configuration was not
removed from the DNS manager and would become stale.

The interaction with DNS manager is handled by NMPolicy, which only
reacts to changes in connection status, so it's not easy to have the
configuration removed from DNS while keeping the connection state
ACTIVATED.

A cleaner solutions is to avoid creating a new IP configuration object
and reuse the existing one if possible. The side effect is that the
D-Bus path of the object will not change, which seems also positive.

https://bugzilla.redhat.com/show_bug.cgi?id=1348901
2016-06-28 16:24:16 +02:00
Beniamino Galvani
19133b08da vpn: dispatch pre-up scripts only once
If the plugin sends a new configuration when the connection is already
activated the state should not go back to PRE_UP since this causes
dispatcher scripts to run again.
2016-06-28 16:24:16 +02:00
Francesco Giudici
fdecb6b669 cli: option autocompletion should not match words without trailing '-'
This would fix for example:
nmcli e <TAB>
(e interpreted as --escape, would allow autocompletion to work... but
when the command is executed an error is reported)

Moreover, we will now have:
nmcli c <TAB>
autocompletion work correctly, i.e., c is correctly interpreted  as
"connection" instead of "--colors"
2016-06-28 12:12:39 +02:00
Francesco Giudici
fd4a8a202e bond/trivial: fix typo 2016-06-28 11:47:50 +02:00
Beniamino Galvani
bf7b9c60b6 cli: initialize connection list in do_device_connect()
The connection list may be required in nmc_secrets_requested() if
secrets are needed.

Fixes: 45fc268890

https://bugzilla.gnome.org/show_bug.cgi?id=767987
2016-06-27 13:09:20 +02:00
Beniamino Galvani
f2d5c8d7f8 tun,vxlan: add the CAP_IS_SOFTWARE capability
Software devices must report the NM_DEVICE_CAP_IS_SOFTWARE capability
in order to be properly activated. Add the flag to NMDeviceTun and
NMDeviceVxlan.

https://bugzilla.gnome.org/show_bug.cgi?id=767846
2016-06-27 13:08:57 +02:00
Francesco Giudici
18cd265b2d nmcli: when adding a vpn store the full service name in vpn-type
When NM looks for vpn plugins, it would expect the full service name
otherwise it will not be able to retrieve the correct plugin.
Fixes VPN configurations generated with "nmcli connection add".
2016-06-27 12:13:46 +02:00
Beniamino Galvani
4c7f609d51 cli: autocompletion: add missing log level and domains
Add KEEP level and DHCP, IP, AUDIT, SYSTEMD, VPN_PLUGIN domains.
2016-06-27 11:40:39 +02:00
Thomas Haller
8e07ea351d wifi: fix stalls in scanning
https://mail.gnome.org/archives/networkmanager-list/2016-June/msg00055.html
2016-06-25 10:33:28 +02:00
Tony Espy
899d7e5cb1 wifi: clear WiFi requested_scan if suppl exits
It's possible for wpa_supplicant to exit with an
outstanding requested_scan pending.  This can lead
to a stall condition where scanning no longer occurs.

https://mail.gnome.org/archives/networkmanager-list/2016-June/msg00117.html
2016-06-25 10:32:24 +02:00
Tony Espy
eed8fd2e43 wifi: clear WiFi requested_scan if suppl goes INACTIVE
It's possible for wpa_supplicant to transition to INACTIVE
state with an outstanding requested_scan pending.  This can
lead to a stall condition where scanning no longer occurs.

[thaller@redhat.com: added break statement to avoid fall-through]

https://mail.gnome.org/archives/networkmanager-list/2016-June/msg00116.html
2016-06-25 10:31:38 +02:00
Thomas Haller
66715515dc platform: avoid crash after calling nl_recv() for old libnl3 version
nl_recv() in libnl3 before version 3.2.15 would return dangling pointers
if nl_recv() fails or has nothing to read [1].

Workaround that by explicitly clearing @buf and @creds.

https://bugzilla.gnome.org/show_bug.cgi?id=767986

[1] 69468517d0
2016-06-24 19:10:03 +02:00
Francesco Giudici
aed19ff12a nmcli: fix ambiguous properties check for autocompletion
Re-enable the check on ambiguos properties but this time manage perfect
matches (i.e., the full property name has been typed) that are prefix
of other properties.

Test case:
nmcli --complete-args connection add type wifi wifi.

Here "wifi" is a property alias that is also prefix of the property
alias "wifi-sec".
2016-06-23 17:37:37 +02:00
Francesco Giudici
ea9dcd08fa nmcli: manage autocompletion of "nmcli connection add" when no args are passed
This enables back "help" "--help" "-help" in autocompletion.
2016-06-23 17:35:08 +02:00
Lubomir Rintel
1f6d060008 po: sync translations from Zanata 2016-06-22 15:03:22 +02:00
Thomas Haller
171554d073 device: clearify behavior of NM_UNMANAGED_USER_SETTINGS in comment 2016-06-22 14:07:24 +02:00
Francesco Giudici
93e1e65467 nmcli: manage "--ask connection add" with no args
When parsing arguments of "connection add" we first read the available
property-value pairs and then check if the --ask option was passed in
order to aid in the fill process of a new connection.
Anyway, if there are no property-value tuples at all, we don't even
check the --ask option, returning with error.
Fix this just checking if any arg is there (argc) before invoking
read_connection_properties().
2016-06-22 12:34:01 +02:00
Lubomir Rintel
0172c1ed2d cli: don't free the completion string when a setting name is unambiguous
If we found that setting name prefix is in fact unambiguous and return
the completion string for that setting we were freeing the string upon
the return. That looks like a typo.

Fixes "nmcli --complete-args add type wifi wifi."
                                           ^^^^ not ambiguous
2016-06-22 09:29:03 +02:00
Lubomir Rintel
67905347b2 merge: branch 'lr/connection-add'
https://bugzilla.gnome.org/show_bug.cgi?id=766427
2016-06-21 19:05:28 +02:00
Lubomir Rintel
8b39090597 cli: use --complete-args for connection add completion
And make it incredibly slow at the same time.
2016-06-21 18:40:22 +02:00
Lubomir Rintel
c3422e917d man: update the nmcli manual for new connection add syntax
It allows us to clean up the nmcli "c add" section considerably.

We list the old-fashioned aliases in a separate section that applies to both
"nmcli c add" and "nmcli c modify".

The section is now nicely cross-linked with nm-settings in HTML
rendering.
2016-06-21 18:40:22 +02:00
Lubomir Rintel
c5324ed285 nmcli: streamline connection addition
This is a huge refactoring in attempt to 1.) reduce the horrible redundancy in
the connection addition path and 2.) reduce confusion between various sources
of property value (command line, properties, interactive mode).

* The conversions from the strings was done all over the place:
  settings.c already does for all sensible properties.
  The rest is removed.

* The validations are done randomly and redundantly:
  server does some validation, and per-property client validations
  useful for interactive mode are done in settings.c
  The rest is removed.

* The information about defaults and required options was redundantly
  scattered in per-type completion functions and interactive mode
  questionnaries. This is now driven by the option_info[] table.

In general, we do our best to just map the command line options to
properties and allow mixing them. For the rest there's the
check_and_set() callbacks (basically to keep compatibility with previous
nmcli versions). This this is now all possible:

$ nmcli c add type ethernet ifname '*'
  This always worked

$ nmcli c add type bond-slave save no -- connection.autoconnect no
  The "save" and "--" still work

$ nmcli c add connection.type ethernet ifname eth0
  Properties can now be used

$ nmcli c add type ethernet ip4 1.2.3.4 mac 80:86:66:77:88:99 con-name whatever
  There's no implementation mandated order of the properties (the type
  still must be known to determine which properties make sense)

$ nmcli --ask c add type ethernet ip4 1.2.3.4 mac 80:86:66:77:88:99 con-name whatever
  The interactive mode asks only for properties that weren't specified
  on command line
2016-06-21 18:40:13 +02:00
Lubomir Rintel
057d477b2a man: turn the manual page cross-references into links
This improves the HTML rendering.

But it also causes a lot of non-resolvable linkends warning when rendering a
separate manual pages into roff/mman. The messages are harmless, but still
a bit ugly.
2016-06-21 18:40:13 +02:00
Dan Williams
fdf5b6941a libnm/libnm-glib: use Bluetooth device name as description (bgo #592819)
Abuse the 'name' property for this, for now, so we don't have to grab
a free slot from NMDeviceClass.

https://bugzilla.gnome.org/show_bug.cgi?id=592819
2016-06-21 10:35:53 -05:00
Francesco Giudici
68d48fa507 nmlci merge branch 'fg/autocomplete_fix_rh1301226_with_LR_patches'
https://bugzilla.gnome.org/show_bug.cgi?id=724860
https://bugzilla.redhat.com/show_bug.cgi?id=1301226
2016-06-21 16:30:07 +02:00
Francesco Giudici
00b362bcf2 nmcli: add support to shortnames for connection properties autocompletion 2016-06-21 16:28:48 +02:00
Lubomir Rintel
3aff650e22 nmcli: improve connection autocompletion (2/2)
Complete the property as we parse the list of properties. This makes it
possible to actually complete an unfinished property.  E.g:

  $ nmcli --complete c modify enp0s25 +ipv6.addr
  +ipv6.addresses +ipv6.addr-gen-mode
2016-06-21 16:28:48 +02:00
Lubomir Rintel
5aec1a3928 nmcli: improve connection autocompletion (1/2)
Make property autocompletion take a prefix and modifier flags.

This will make it easier to complete an unfinished property name
(possibly accompanied by a modifier) without shell trickery.
2016-06-21 16:28:48 +02:00
Lubomir Rintel
7046e806d1 cli: streamline complete_connection_by_type() arguments
Will be useful to pass around the complete flag.
2016-06-21 16:28:48 +02:00
Francesco Giudici
cd4395a261 nmcli: enable connection autocompletion for 802.1x properties
nmcli bash autocompletion leveraged on "nmcli connection edit", "print"
to retrieve the specific properties of a connection. Anyway, the
interactive editor is smart and just prints the used components, so in a
connection where 802.1x is not enabled we had no autocompletion.
Solved adding an "hidden" command "nmcli --complete connection modify"
as suggested in bgo #724860 in order to retrieve ALL the available
properties for use in autocompletion.
Here patch from L.Rintel has been merged to make che --complete option
global to nmcli (first version was local to "connection modify").

https://bugzilla.gnome.org/show_bug.cgi?id=724860
https://bugzilla.redhat.com/show_bug.cgi?id=1301226
2016-06-21 16:28:48 +02:00
Francesco Giudici
fbaaf51f52 nmcli autocompletion cleanups
* no need to check HELP_ONLY_AS_FIRST var as when --help option is passed
  _nmcli_compl_OPTIONS will return 0, falling in the general case that
  will trigger end of autocompletion

* clanup local var declaration in _nmcli func:
  - remove dupliated OPTIONS_MANDATORY declaration
  - init HELP_ONLY_AS_FIRST on declaration
  - order vars for common prefix
2016-06-21 16:28:39 +02:00
Beniamino Galvani
072358dad0 team: check return value of g_dbus_connection_call_sync()
The call can fail; in such case assume that an existing teamd died and
our instance will be able to continue.

https://bugzilla.redhat.com/show_bug.cgi?id=1347015
2016-06-21 14:58:55 +02:00
Thomas Haller
3b155d3cee clients,vpn/trivial: rename argument of nm_vpn_get_secret_names() 2016-06-20 19:04:34 +02:00
Thomas Haller
7e0660bf07 clients,vpn: only accept full service-types in nm_vpn_get_secret_names()
nm_vpn_get_secret_names() has only one caller, which passes
nm_setting_vpn_get_service_type() as @vpn_type argument. That
argument is not a short-name or abbreviation, it must be the
full service-type.

For our well-known, hard-coded list of service-types, all must
start with the same prefix.
2016-06-20 19:02:40 +02:00
Thomas Haller
59269b6925 clients: fix wrong assertion _assert_format_int()
Fixes: 2822f92434
2016-06-18 18:15:41 +02:00
Thomas Haller
062fccf46f all: merge branch 'th/g_strv_contrains' 2016-06-17 12:26:57 +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
caeaa78918 nm-glib: implement compatibility macro for g_strv_contains() differently
Otherwise, deprecation warnings are not properly suppressed for

  g_return_if_fail (g_strv_contains (strv, str));
2016-06-17 12:25:33 +02:00
Thomas Haller
1b9d60f985 nm-glib: remove G_GNUC_EXTENSION
We use statement expressions all over the place without explicitly
marking them. If that would be a problem, we'd have to change a
*lot* of code. We simply require that as a mandatory feature from
our compiler.
2016-06-17 12:25:15 +02:00
Lubomir Rintel
45d6baac4d shared: backport g_strv_contains() 2016-06-17 12:22:37 +02:00
Didier Raboud
f90abce4d5 wwan: check at runtime whether to start ModemManager
This makes NetworkManager use runtime detection to manage the
ModemManager lifecycle when not run by systemd. Under systemd, we expect
the ModemManager service to be started by systemd, under non-systemd, we
use the dbus activation feature to start ModemManager.

[thaller@redhat.com: original patch heavily modified to check for available
 libsystemd library]

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=770871
https://mail.gnome.org/archives/networkmanager-list/2016-June/msg00086.html
2016-06-17 12:21:20 +02:00
Dan Williams
16c368b8eb platform: recognize rmnet and ccmni interfaces as WWAN network devices
https://mail.gnome.org/archives/networkmanager-list/2016-June/msg00087.html
2016-06-17 11:08:51 +02:00
Dan Williams
f969193db4 platform/trivial: rename NM_LINK_TYPE_WWAN_ETHERNET to NM_LINK_TYPE_WWAN_NET
Some newer WWAN netdev types are "rawip" which don't bother with
ethernet framing.
2016-06-17 11:00:10 +02:00
Thomas Haller
4143fbde17 logging: enable logging domain VPN_PLUGIN up to level <info>
The logging domain VPN_PLUGIN controlls logging of the VPN plugins.
Especially at verbose levels <debug> and <trace>, the plugins might
reveal sensitive information in the logging.

Thus, this level should not be enabled by a

  $ nmcli logging general level DEBUG domains ALL

It should only be enabled when requested explicitly.

  $ nmcli logging general level DEBUG domains ALL,VPN_PLUGIN:DEBUG

Previously, the special level VPN_PLUGIN was entirely excluded from
ALL and DEFAULT domains and it was entirely disabled by default. That
is however to strict, as it completely silences the VPN plugins by
defult. Now, enable them by default up to level INFO.

VPN plugins should take care that they don't reveal sensitive
information at levels <info> (LOG_NOTICE) and higher (less verbose).
For more verbose levels they may print passwords, but that should
still be avoided as far as possible.
2016-06-17 08:19:44 +02:00
Thomas Haller
af507cd089 shared: add also "shared/nm-utils/nm-vpn-plugin-macros.h"
It has the very similar purpose as "nm-utils/nm-vpn-plugin-utils.[ch]", except
that is is header-only.
2016-06-16 18:06:16 +02:00
Thomas Haller
89d32944af tests: fix checking NM_ASSERT_NO_MSG define in "nm-test-utils.h"
"nm-test-utils.h" may also be used by the VPN plugins, there
we have no NM_ASSERT_NO_MSG define.
2016-06-16 11:04:51 +02:00
Thomas Haller
6dd2b316b5 shared: merge branch 'th/shared-bgo767697'
https://bugzilla.gnome.org/show_bug.cgi?id=767697
2016-06-16 10:52:00 +02:00