Commit Graph

182 Commits

Author SHA1 Message Date
Thomas Haller
41976e3069 clients,cli: for connection-add consider VPNs as loaded from the plugin
Instead of using (only) a hard-coded list of VPN types,
prefer lookup the VPN settings from the .name files.

Still, fallback to a hard-coded list if the plugin cannot
be found, because for connection-add we currently don't
actually need the plugin installed.
2016-05-19 12:52:59 +02:00
Thomas Haller
0225c4567b clients: lookup VPN plugins either by "name" or "service"
... not constructing a "service" by prepending a D-Bus prefix to "name" (urgh).
2016-05-19 12:52:59 +02:00
Beniamino Galvani
dbd0634c84 cli: append newline to failure message
Fixes: a06487a6ae
2016-05-16 17:55:21 +02:00
Thomas Haller
7752f390c2 cli: declare external variable nm_cli in <nmcli.h> header 2016-05-03 11:53:15 +02:00
Beniamino Galvani
a06487a6ae cli: handle device failure when activating
We might receive the update of the device state to FAILED when the
active connection is still in ACTIVATING. Handle this case properly.
2016-04-29 11:16:30 +02:00
Francesco Giudici
3c67a1ec5e cli: remove version check against NM
When performing NM package upgrade the new version of nmcli will be immediately
available while NM daemon will not, as it would not restart in order to avoid
to disrupt connectivity. This could create issues with tools leveraging
on nmcli output (till reboot). As apart from this case it is very unlikely
that a user can have this nmcli / NM daemon version mismatch situation,
the check could cause more harm than benefit in real user case
scenarios.

https://bugzilla.redhat.com/show_bug.cgi?id=1291785
2016-04-28 09:35:20 +02:00
Thomas Haller
03fd18cde0 cli: fix setting 'slave-type' for nmcli connection add type *-slave
$ nmcli connection add type bond-slave ifname eth1 con-name bond0.0 master nm-bond
  Error: Failed to add 'bond0.0' connection: connection.slave-type: Cannot set 'master' without 'slave-type'

Fixes: 8ad218e71c
2016-03-30 18:36:07 +02:00
Thomas Haller
6fa521b384 cli/trivial: fix indention and whitespace 2016-03-30 18:15:03 +02:00
Thomas Haller
31669329bb cli/trivial: fix TABs for indention 2016-03-29 14:59:01 +02:00
Lubomir Rintel
8ad218e71c nmcli: fix slave_type setting 2016-03-29 14:53:45 +02:00
Lubomir Rintel
e691f01e01 cli: make the *-slave type option parsing out of the common path
We actually don't want to understand these options unless the legacy
*-slave types are used. The properties should be used directly instead.

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

This basically undoes most of what has been done in  commit 00e0fffea2.
2016-03-29 14:20:09 +02:00
Beniamino Galvani
ff97494e78 cli: fix memory leak in connection listing 2016-03-14 22:18:17 +01:00
Beniamino Galvani
f0c6a0315d cli: prefer 'modify' over 'monitor' when the command is abbreviated
In previous releases 'nmcli connection m' was interpreted as 'modify',
but recently the monitor command was introduced with a higher
priority, changing the behavior when the abbreviated form is
used.

Restore the old behavior.

https://bugzilla.redhat.com/show_bug.cgi?id=1316120
2016-03-10 11:12:02 +01:00
Francesco Giudici
fb8fe1d8cb nmcli: fix check on allowed parameters for slave connections
When editing a connection, check its slave-type parameter. If not null,
we will not have ip properties but possibly others, slave-type specific.
2016-03-04 19:14:26 +01:00
Dan Winship
6265398b6e all: use g_error_matches()
Use g_error_matches() where we're testing error codes. In particular,
use it rather than looking at only ->code and not also ->domain, which
is just wrong.

[thaller@redhat.com: rebase and modify original patch]
2016-03-03 18:54:20 +01:00
Thomas Haller
01b9b4104c all: clean-up usage of GError
Functions that take a GError** MUST fill it in on error. There is no
need to check whether error is NULL if the function it was passed to
had a failing return value.

Likewise, a proper GError must have a non-NULL message, so there's no
need to double-check that either.

Based-on-patch-by: Dan Winship <danw@gnome.org>
2016-03-03 18:54:20 +01:00
Beniamino Galvani
4ded98dd0f cli: fix use-after-free when adding ADSL connections
check_adsl_protocol() can free and assign a new string to
@protocol_ask, leaving @protocol dangling. Fix this.

Fixes: 290c1626b9
2016-02-29 13:47:47 +01:00
Thomas Haller
8bace23beb all: cleanup includes and let "nm-default.h" include "config.h"
- All internal source files (except "examples", which are not internal)
  should include "config.h" first. As also all internal source
  files should include "nm-default.h", let "config.h" be included
  by "nm-default.h" and include "nm-default.h" as first in every
  source file.
  We already wanted to include "nm-default.h" before other headers
  because it might contains some fixes (like "nm-glib.h" compatibility)
  that is required first.

- After including "nm-default.h", we optinally allow for including the
  corresponding header file for the source file at hand. The idea
  is to ensure that each header file is self contained.

- Don't include "config.h" or "nm-default.h" in any header file
  (except "nm-sd-adapt.h"). Public headers anyway must not include
  these headers, and internal headers are never included after
  "nm-default.h", as of the first previous point.

- Include all internal headers with quotes instead of angle brackets.
  In practice it doesn't matter, because in our public headers we must
  include other headers with angle brackets. As we use our public
  headers also to compile our interal source files, effectively the
  result must be the same. Still do it for consistency.

- Except for <config.h> itself. Include it with angle brackets as suggested by
  https://www.gnu.org/software/autoconf/manual/autoconf.html#Configuration-Headers
2016-02-19 17:53:25 +01:00
Beniamino Galvani
9e5c99465d cli: fix compile error
connections.c: In function ‘sort_connections’:
 connections.c:1536:3: error: ‘return’ with no value, in function returning non-void [-Werror=return-type]
    return;
    ^

Fixes: e8927c14ec
2016-02-11 17:14:35 +01:00
Lubomir Rintel
e8927c14ec client: fix NULL dereference with no connections
Coverity complains:

CID 59386 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking cons suggests that it may be null, but it has
already been dereferenced on all paths leading to the check.
2016-02-11 17:01:03 +01:00
Thomas Haller
7d67c533d1 cli: disallow reserved vlan id 4095 2016-01-22 11:50:52 +01:00
Dan Williams
0a12a1711c libnm-core,core,cli: fix spelling of NM_IP_TUNNEL_MODE_UNKNOWN
Fixes: b614a5ec61
Fixes: ae8c7a8967
Fixes: 570fdce93f
2016-01-20 11:27:22 -06:00
Beniamino Galvani
29b93602fc tun: add support for MTU and cloned-mac-address properties
Make it possible to change ethernet.mtu and
ethernet.cloned-mac-address properties of tun/tap devices
(cloned-mac-address is meaningful only for taps).
2015-12-19 12:06:33 +01:00
Beniamino Galvani
9c837e95a3 vxlan: add support for MTU and cloned-mac-address properties
Make it possible to change ethernet.mtu and
ethernet.cloned-mac-address properties of vxlan devices.
2015-12-19 12:06:33 +01:00
Jiří Klimeš
016db38ce2 cli: use '|' instead of ',' for delimiting the modes
to be consistent with other options
2015-12-17 16:20:10 +01:00
Jiří Klimeš
81dcf9b218 cli: really fix the description this time
Fixes: 3a6cd8204f
2015-12-17 16:10:32 +01:00
Jiří Klimeš
d0d96c1a13 cli: check ip-tunnel mode right after it is read 2015-12-16 16:12:24 +01:00
Jiří Klimeš
f8ed5ed239 cli: enable TAB-completion for "MACVLAN mode: " in nmcli -a con add type macvlan 2015-12-16 16:10:08 +01:00
Jiří Klimeš
9fb2a02b3a cli: enable TAB-completion for "Tunnel mode: " in nmcli -a con add type ip-tun 2015-12-16 14:36:28 +01:00
Jiří Klimeš
ff38790b12 cli: there are 5 optional arguments for vxlan connections 2015-12-16 14:21:15 +01:00
Jiří Klimeš
3a6cd8204f cli: remove stray space from help description 2015-12-16 14:20:05 +01:00
Jiří Klimeš
39f0ecbd36 cli: (trivial) fix a copy-paste error in a comment
Fixes: c3e6e25239
2015-12-16 14:18:47 +01:00
Beniamino Galvani
36f055fad9 cli: document ip-tunnel connection type 2015-12-16 14:03:28 +01:00
Beniamino Galvani
f4dd37fdcb cli: allow specifying a 'dev' option when adding IP tunnels 2015-12-16 14:03:26 +01:00
Beniamino Galvani
e62c0c2547 cli: fix error handling in creation of IP tunnels
Fixes: 7da440b798
2015-12-16 11:42:19 +01:00
Beniamino Galvani
7da440b798 cli: add vxlan support 2015-12-09 16:36:46 +01:00
Beniamino Galvani
c3e6e25239 cli: add macvlan support 2015-12-09 14:30:08 +01:00
Jiří Klimeš
3e5fea9820 cli: TAB-complete yes/no for boolean properties in the editor 2015-12-09 09:31:36 +01:00
Jiří Klimeš
629de4e689 cli: add global --show-secrets option
- it controls echoing passwords input on terminal
- it replaces --show-secrets in 'nmcli connection show', which is deprecated now
- it replaces --show-password in 'nmcli device wifi hotspot', which is deprecated now
2015-12-07 14:14:58 +01:00
Jiří Klimeš
23aff47826 cli: use nmc_readline_echo() for asking password in 'nmcli con add' 2015-12-07 14:14:58 +01:00
Lubomir Rintel
da528b5ccd cli: drop an extra newline 2015-12-07 11:23:39 +01:00
Lubomir Rintel
b38a5f4cb4 cli: avoid using tmp template after it goes out of scope
Fixes: 3892b839af
2015-12-07 11:05:52 +01:00
Lubomir Rintel
4ffed27959 cli: improve the error reporting a bit 2015-12-07 10:51:49 +01:00
Jiří Klimeš
3892b839af cli: add 'nmcli connection export' (rh #1034105)
Synopsis:
  nmcli connection export [ id | uuid | path] <ID> [<output file>]

for exporting VPN connections.

https://bugzilla.redhat.com/show_bug.cgi?id=1034105
2015-12-07 09:11:20 +01:00
Jiří Klimeš
9a0e4bae47 cli: add 'nmcli connection import' (rh #1034105)
Synopsis:
  nmcli connection import [--temporary] type <type> file <file to import>

Only VPN configurations can be imported at the moment.

https://bugzilla.redhat.com/show_bug.cgi?id=1034105
2015-12-07 09:11:06 +01:00
Lubomir Rintel
d03f347b9d cli: add nmcli monitor
https://bugzilla.redhat.com/show_bug.cgi?id=1034158
2015-12-05 12:16:23 +01:00
Lubomir Rintel
e92e06bdc7 cli,connections: add connection monitor 2015-12-05 12:16:06 +01:00
Lubomir Rintel
88ae8d2b13 cli: turn should_wait into a semaphore
Count the exit blockers. We'll want to terminate the device monitor in case all
monitored devices vanish.
2015-12-05 12:05:17 +01:00
Lubomir Rintel
67caad44c3 cli: move the decision whether to use colors to nmc_colorize()
This allows us to use a conditionally colorized output outside
print_required_fields().
2015-12-05 12:05:17 +01:00
Jiří Klimeš
4c437863fa cli: remove duplicated checks for running Networkmanager
It is already performed in do_connections().
2015-12-03 16:12:26 +01:00