Commit Graph

377 Commits

Author SHA1 Message Date
Thomas Haller
e1d60712d9 cli: add property-info for the rest 2017-03-30 13:09:57 +02:00
Thomas Haller
10fca1ae3a cli: add property-info for NMSettingWireless 2017-03-30 13:09:57 +02:00
Thomas Haller
84aa6bad89 cli: add property-info for NMSettingWired 2017-03-30 13:09:57 +02:00
Thomas Haller
486dc1e596 cli: add property-info for NMSettingWimax 2017-03-30 13:09:57 +02:00
Thomas Haller
9c6f70f9e0 cli: add property-info for NMSettingAdsl 2017-03-30 13:09:56 +02:00
Thomas Haller
f34ef5d1fe cli: add property-info for NMSettingPpp 2017-03-30 13:09:56 +02:00
Thomas Haller
6bf1d6fc16 cli: add property-info for NMSetting8021x 2017-03-30 13:09:56 +02:00
Thomas Haller
d530bffb6c cli: add property-info for NMSettingWirelessSecurity 2017-03-30 13:09:56 +02:00
Thomas Haller
09d127b473 cli: add property-info for NMSettingPppoe 2017-03-30 13:09:56 +02:00
Thomas Haller
a89e9a0a6f cli: add property-info for NMSettingDcb 2017-03-30 13:09:56 +02:00
Thomas Haller
89b5685695 cli: add property-info for NMSettingProxy 2017-03-30 13:09:56 +02:00
Thomas Haller
40f47dbb06 cli: add property-info for NMSettingIP4Config and NMSettingIP6Config 2017-03-30 13:09:56 +02:00
Thomas Haller
cb66cf96d7 cli: add values_func() to NmcPropertyInfo and use for "connection" setting 2017-03-30 13:09:55 +02:00
Thomas Haller
4e91492b76 cli: rework property handling via NmcPropertyInfo for NMSettingConnection
Add an improved way of tracking meta data about settings.

E.g. it is wrong to generate for each property a nmc_property_*_get_*()
function. Instead, there should be a meta data about the property
itself, and a mechanism to retrieve the property.

For now, only do this for NMSettingConnection and keep all the existing
infrastructure in place. Later on all settings shall be moved.

Especially to accomodate NmcOutputField mangles the concept of
setting-meta data, formatting options, and collecting output results.
It's a total hack, that will be need fixing later.
2017-03-30 13:09:55 +02:00
Francesco Giudici
ef0d0d08eb nmcli: fix nmcli parsing
Fixes the parsing for correct and incorrect commands.
e.g.:
nmcli connection down id <conn>
nmcli -t
...

Fixes: 16902a2be6
2017-03-29 13:02:39 +02:00
Lubomir Rintel
cd2a5c5800 cli/connections: drop the redundant parsing of --show-secrets
This is no longer needed now that --show-secrets is a global option.
2017-03-28 15:32:06 +02:00
Lubomir Rintel
5a71bc8022 cli: add NmCli argument to next_arg()
Will be useful in next commit.
2017-03-28 15:32:05 +02:00
Lubomir Rintel
16902a2be6 cli: use next_arg() on argument boundary
Shift argc and argc manually between argument ant its value and use
next_arg() between arguments everywhere. Whill be useful to parse global
arguments.
2017-03-28 15:32:05 +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
Lubomir Rintel
57a26fd2aa cli/connections: decide about activation success and failure in single place
Track both device and active connections at the same time and decide
whether activation finished (either successfully or not) in a single
place, check_activated().

This makes the already too complex code path a bit more straightforward
and also makes it possible to be more reasonable about the diagnostics.

Now that the active connection signals the reason, we include it; but if
the failure is due to the device disconnection while we're activating,
include a device reason instead, since it's often more useful. Like:

Before:
  Error: Connection activation failed.

Without considering the device:
  Error: Connection activation failed: the base network connection was interrupted

After:
  Error: Connection activation failed: The Wi-Fi network could not be found
2017-03-17 10:21:19 +01:00
Thomas Haller
22b7282d84 all: use "unsigned" instead of "unsigned int" 2017-03-14 11:26:29 +01:00
Beniamino Galvani
4db7890fae cli: support dummy connections 2017-02-22 21:05:04 +01:00
Lubomir Rintel
84c484ed5b cli: make match() return boolean
Coccinelle semantic patch:

  @@
  @@
  -int
  +gboolean
          matches (...);

  @@
  expression pattern, cmd, len;
  @@
  -int
  +gboolean
          matches (...)
          {
                  ...
  -               return memcmp (pattern, cmd, len);
  +               return memcmp (pattern, cmd, len) == 0;
          }

  @@
  expression prefix, str;
  @@
  (
  -matches (prefix, str) != 0
  +!matches (prefix, str)
  |
  -matches (prefix, str) == 0
  +matches (prefix, str)
  )

  @@
  expression prefix, str;
  @@
  -(matches (prefix, str))
  +matches (prefix, str)

  @@
  expression prefix, str;
  @@
  -(!matches (prefix, str))
  +!matches (prefix, str)

spatch --smpl-spacing --sp-file match.cocci --dir clients/cli/ \
  --include-headers --macro-file shared/nm-utils/gsystem-local-alloc.h
2017-02-15 13:04:07 +01:00
Lubomir Rintel
8bd7bbba02 cli: add completion for "nmcli c edit" 2017-02-15 11:16:19 +01:00
Lubomir Rintel
1a0c779214 cli: complete VPN types 2017-02-15 11:16:19 +01:00
Lubomir Rintel
7399cf3b16 cli: add missing NULL-check
Only the connection down operation is cancellable, the other actions are not.

Fixes: 73b560c215
2017-01-29 12:56:31 +01:00
Lubomir Rintel
73b560c215 cli: avoid use-after free on connection deletion
If the connection spontaneously disappears (perhaps along with the whole
daemon on crash) while we're deleting it, then the removal callback
would free up the context structure the delete operation is using.

Let's cancel the in-flight delete operations so that they won't touch
the structure after it's gone.
2017-01-27 13:33:28 +01:00
Jiří Klimeš
283758dab3 cli: fix some TAB completions for nmcli -a con add
(cherry picked from commit 1cee85f556)
2017-01-21 21:32:31 +01:00
Jiří Klimeš
6397ce1fac cli: enable TAB-completion for proxy properties in interactive editor 2017-01-17 14:27:31 +01:00
Beniamino Galvani
d197c0626a cli: macsec support 2017-01-16 17:47:10 +01:00
Lubomir Rintel
260563a7d9 all: use nm_utils_is_valid_iface_name() 2017-01-06 15:11:56 +01:00
Jiří Klimeš
9a1a03b08c cli: (trivial) fix a typo 2016-12-15 15:31:51 +01:00
Jiří Klimeš
58a328aafc cli: add SLAVE field for 'nmcli con show' output
It helps listing or searching for slave connections. For example, one can do
$ nmcli -f name,uuid,type,slave connection show | awk '$NF == "bridge"'
to show all bridge slave connections.
2016-12-15 15:03:41 +01:00
Lubomir Rintel
01a20015e0 cli: use nmc_do_cmd to get the client and check if the daemon is running
The makes use of asynchronous client initialization, making things a bit
faster and reduces code duplication too.
2016-11-11 16:18:03 +01:00
Lubomir Rintel
3ee03afecc cli: make it possible to call sub-commands with client obtained asynchronously 2016-11-11 16:18:03 +01:00
Lubomir Rintel
6499bb893f cli: get rid of client-global connections list
Caching it in the NmCli object is unnecessary, ugly and would be cumbersome in
future when we'll be creating the client object only when needed.
2016-11-11 16:18:03 +01:00
Beniamino Galvani
984d4f0684 cli: properly set multiple addresses in questionnaire mode
Pass the '+' modifier to set_property() for IPv4 and IPv6 addresses to
append the new address to existing ones instead of overwriting them.

Fixes: 2f45665559

https://bugzilla.redhat.com/show_bug.cgi?id=1380165
2016-10-04 14:18:27 +02:00
Atul Anand
812b8774f6 proxy: remove unnecessary APIs
Unnecessary APIs have been removed from nm-setting-proxy, client like
nm-connection-editor are expected to create a PAC script snippet the load
the location of file in NM.
2016-10-04 11:44:44 +02:00
Atul Anand
2cb75e08d6 nmcli: Add Proxy support to nmcli
nmcli fixed to allow users edit proxy properties.
2016-10-04 11:44:44 +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
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š
4b90b7b774 cli: (trivial): remove stray %s 2016-09-19 16:55:37 +02:00
Beniamino Galvani
b28b2ba8a9 clients: add define for NMSecretAgentSimple signal name 2016-09-14 23:32:52 +02:00
Beniamino Galvani
79a357b07a cli: connections: fail the activation if the ac deactivates
Since commit ac888de151 ("cli/connections: fail the activation when
the active connection disappears") we rely only on the disappearing of
the active-connection to determine the failure of an activation.

libnm can collapse a 'added' and a 'removed' signal if they are
received closer enough and thus we may miss the removal of the active
connection. Restore the detection of failure based on
active-connection state.
2016-09-09 16:40:53 +02:00
Lubomir Rintel
afab2b8112 cli: only connect handlers for property changes in interactive edit
Fixes: c5324ed285
(cherry picked from commit 79c81bbb8c)
2016-08-24 17:27:55 +02:00