Commit Graph

370 Commits

Author SHA1 Message Date
Jiří Klimeš
f52e6bbdda cli: do not stall in 'nmcli connection delete/down' (rh #1168657)
NetworkManager only responds to the last D-Bus call when called delete/down
for the same connection in quick succession. (It should be fixed later).
So do not issue the call multiple times to prevent that. Otherwise nmcli would
stall waiting for the response.

https://bugzilla.redhat.com/show_bug.cgi?id=1168657
2015-03-16 16:58:05 +01:00
Jiří Klimeš
27bd0b7317 cli: only offer active connections in TAB completion for 'nmcli con down' 2015-03-13 10:14:50 +01:00
Thomas Haller
a49680dacd libnm: add define for cert scheme prefix file:// for NMSetting8021x 2015-03-12 18:12:27 +01:00
Jiří Klimeš
ae3f452994 cli: fix memory leaks when asking for arguments 2015-03-12 15:32:40 +01:00
Jiří Klimeš
f8366c8b1c cli: fix TAB completion for multiple connections in 'nmcli con down/delete' 2015-03-12 15:32:40 +01:00
Jiří Klimeš
661ef3cd46 cli: don't return empty strings in nmc_string_to_arg_array()
and unquote strings in the array if required.
2015-03-12 15:32:39 +01:00
Thomas Haller
81c420dc62 cli/completion: add completion for --order option
This does not yet work, because the --order option
contains colons which bash completion considers as
separaters.

For now, implement it and ignore that problem. It
works correctly until you specify more then one
order-columns separated by colon.

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

Fixes: 40e98f5d68
2015-03-02 14:02:58 +01:00
Jiří Klimeš
643291bea5 cli: sort access point list
According to signal strength, frequency and rate.
2015-02-26 11:54:45 +01:00
Jiří Klimeš
591908c8bd nmcli: add support for bridge multicast-snooping property 2015-02-26 09:08:14 +01:00
Jiří Klimeš
8b35b9e061 cli: silently ignore duplicated categories in "--order" option (bgo #738613)
It was considered as a hard error before, but we can actually only ignore it.

Related commit: 40e98f5d68
2015-02-25 14:41:52 +01:00
Dan Williams
7c0b43ded6 trivial: suppress compiler uninitialized usage warning
Suppress a bogus warning on older compilers (gcc 4.7.2)
2015-02-24 19:01:09 -06:00
Jiří Klimeš
fad26c286c cli: color output of 'nmcli device wifi list' 2015-02-24 15:14:13 +01:00
Thomas Haller
d0fbb688f5 cli/completion: add completion for --colors option
https://bugzilla.gnome.org/show_bug.cgi?id=738613

Fixes: 758e488f13
2015-02-23 18:31:01 +01:00
Jiří Klimeš
126bc15f34 nmcli: colorize 'general', 'radio' and 'networking' outputs 2015-02-23 09:24:21 +01:00
Jiří Klimeš
4668f2038e nmcli: show devices list in colors 2015-02-23 09:24:21 +01:00
Jiří Klimeš
a80a1b6b46 nmcli: show connection list in colors
Colorize active connections as follows:
activated - green
activating - yellow
deactivating/deactivated - red
invisible active connections - dimmed
2015-02-23 09:24:21 +01:00
Jiří Klimeš
758e488f13 nmcli: add global '--colors' option for controlling color output
nmcli -c auto  ->  colors will only be used when stdout is a terminal
nmcli -c yes   ->  colors will be enabled unconditionally
nmcli -c no    ->  colors will be disabled unconditionally
2015-02-23 09:24:21 +01:00
Jiří Klimeš
bc265d4372 nmcli: add support for terminal formatting, like bold, dim, underline, etc. 2015-02-23 09:24:21 +01:00
Jiří Klimeš
b77ec93d99 nmcli: add support for printing color strings 2015-02-23 09:24:21 +01:00
Jiří Klimeš
4e0e61f669 nmcli: pay attention to color escape sequencies when counting string length
This is to properly align the columns on screen.
2015-02-23 09:24:21 +01:00
Jiří Klimeš
3e8fc26d25 nmcli: make filtering color sequences a utility function
The code will be used on other places too.
2015-02-23 09:24:21 +01:00
Jiří Klimeš
40e98f5d68 nmcli: add --order option for 'nmcli connection show'
The option allows you to specify custom sorting order.
Default order (when no --order is provided) corresponds to -o "active:name:path"

Examples:
nmcli con show -o name
nmcli con show -o +name
  - sort connections by name alphabetically
nmcli con show -o -name
  - sort connections by name alphabetically in reverse order
mmcli con show -o active:name
  - sort connections first by active status, then by name
mmcli con show -o -path
  - sort connections by D-Bus path in reverse order
2015-02-23 09:24:21 +01:00
Jiří Klimeš
b4d5296782 nmcli: sort connections in 'nmcli connection show' output 2015-02-23 09:24:21 +01:00
Jiří Klimeš
8f60081be9 nmcli: (trivial): use real parameter types in fill_output_connection() prototype
The generic pointers were remnants from the time the function was used as
a callback.
2015-02-23 09:24:21 +01:00
Jiří Klimeš
0ff9b75387 nmcli: allow adding 'generic' connections via nmcli connection add
'nmcli connection edit' already allows adding and editing generic connections
(added by 2a2af5825a).
2015-02-11 10:51:49 +01:00
Thomas Haller
fdd09340ce cli: fix memleak in nmc_setting_get_valid_properties() 2015-02-09 11:51:04 +01:00
Dan Williams
c3e319266c cli: add support for wifi.powersave setting 2015-01-21 14:31:14 -06:00
Jiří Klimeš
8ed0e50ff1 cli: add description for certificate properties in editor (rh #1182575) 2015-01-20 14:27:17 +01:00
Lubomir Rintel
1bc942b142 cli: fix client bond option count
Looks more like 5, not 7, unless a particular mode is selected:

There are 7 optional arguments for 'bond' connection type.
Do you want to provide them? (yes/no) [yes]
Bonding mode [balance-rr]:
Bonding monitoring mode (miimon/arp) [miimon]:
Bonding miimon [100]:
Bonding downdelay [0]:
Bonding updelay [0]:
2015-01-19 12:04:50 +01:00
Thomas Haller
2a3d65f8b2 trivial: whitespace fix 2015-01-11 22:52:50 +01:00
Thomas Haller
3cbce6994a nmcli/bash-completion: don't allow specifying connection by apath for 'connection modify'
The following must not be allowed:

  $ nmcli connection modify apath /org/freedesktop/NetworkManager/ActiveConnection/0
2014-12-22 15:39:48 +01:00
Thomas Haller
5ef233936a nmcli/bash-completion: fix detecting connection for connection modify
Previously we would only complete connections given by ID.
The following would work:
  $ nmcli connection modify id <ID> <TAB>
  $ nmcli connection modify <ID> <TAB>
  $ nmcli connection modify uuid <UUID> <TAB>
but the following would not work:
  $ nmcli connection modify <UUID> <TAB>
2014-12-22 15:28:00 +01:00
Jiří Klimeš
bcd5b2cdc1 cli: fix DEADCODE (CWE-561) found by coverity
Error: DEADCODE (CWE-561): [#def3]
NetworkManager-0.9.11.0/clients/cli/utils.c:488: cond_notnull: Condition "input", taking true branch. Now the value of "input" is not "NULL".
NetworkManager-0.9.11.0/clients/cli/utils.c:517: notnull: At condition "input", the value of "input" cannot be "NULL".
NetworkManager-0.9.11.0/clients/cli/utils.c:517: dead_error_condition: The condition "input" must be true.
NetworkManager-0.9.11.0/clients/cli/utils.c:517: dead_error_line: Execution cannot reach the expression """" inside this statement: "g_set_error(error, 1U, 0, d...".
2014-12-12 22:43:33 +01:00
Jiří Klimeš
ed088b0df7 cli: mute coverity for Error: DEADCODE (CWE-561)
It can't recognize that the variables are set when parsing arguments.
2014-12-12 22:43:33 +01:00
Lubomir Rintel
9a3cc60d9b cli: expose the vpn.persistent property 2014-12-11 11:15:53 +01:00
Jiří Klimeš
0e727062fc cli: g_strdup(NULL) returns NULL; simplify code for that 2014-12-03 16:03:19 +01:00
Jiří Klimeš
1a4259d23a cli: additional fix for nmcli connection down
nmcli crashed when a timeout was hit, because 'info' was used after freeing
in down_timeout_cb().

Fixes 4a7c88621d.
2014-12-03 13:22:29 +01:00
Jiří Klimeš
4a7c88621d cli: fix deactivation for multiple connections (bgo #740775) (rh #1168383)
$ nmcli connection down aa bb cc

It has been broken by commit 20566c76de.

Fixups by dcbw.

https://bugzilla.gnome.org/show_bug.cgi?id=740775
https://bugzilla.redhat.com/show_bug.cgi?id=1168383
2014-12-03 10:54:49 +01:00
Dan Williams
20566c76de cli: wait for "con down" to deactivate the connection (bgo #740775) (rh #1168383)
nmcli currently does not wait for the connection to fully deactivate, which
can take some time due to dispatcher scripts or cleanup operations like
DCB.  Change it to wait until the connection is deactivated, or until
a short timeout has expired.  The user can adjust the timeout with
"--wait" if they want.

https://bugzilla.gnome.org/show_bug.cgi?id=740775
https://bugzilla.redhat.com/show_bug.cgi?id=1168383
2014-12-01 10:04:50 -06:00
Thomas Haller
c3246d962d nmcli/bash-completion: complete [+-] modifier for connection modify property
Fixes
  nmcli connection modify CONNECTION +conn<TAB>
2014-12-01 15:22:10 +01:00
Jiří Klimeš
72156ba1c5 cli: fix setting ethernet.s390-subchannels
It was not properly updated in a7c4d53d03 (when
updating stuff to ne libnm).

And allow 2 subchannels (libnm and ifcfg-rh allow it too).
2014-11-28 14:27:31 +01:00
Jiří Klimeš
fda5a4703d cli: add parent device information for VLAN devices 2014-11-24 10:33:22 +01:00
Dan Winship
71b4c05fca libnm: rename NMSecretAgent to NMSecretAgentOld
As with NMVpnPluginOld, rename NMSecretAgent to NMSecretAgentOld, to
leave the name "NMSecretAgent" open for a new-and-improved version in
NM 1.2.
2014-11-21 12:17:41 -05:00
Dan Williams
88c9c6a6ac clients: merge nm_secret_agent_simple_set_connection_path() into nm_secret_agent_simple_enable()
set_connection_path() is almost always called right before enable(),
and it's unclear why it would be called anywhere else.  So just
merge the two methods.
2014-11-21 12:14:48 -05:00
Dan Winship
a1f746351a clients: NMSecretAgentSimple API fixups
nm_secret_agent_simple_*() functions should take an
NMSecretAgentSimple, not an NMSecretAgent.

The type macros were incorrectly validating against
NM_TYPE_SECRET_AGENT rather than NM_TYPE_SECRET_AGENT_SIMPLE.
2014-11-21 12:08:35 -05:00
Jiří Klimeš
4b799db1d3 cli: add support for secret agent to 'nmcli dev connect' too
And move secrets getting code to common.c (without changes).
2014-11-20 16:36:29 +01:00
Lubomir Rintel
224acba8f6 cli,vpn: merge branch 'lr/nm-1-0-fixes'
Fixes for various issues identified during 1.0 testing.

https://bugzilla.gnome.org/show_bug.cgi?id=740135
2014-11-20 16:12:21 +01:00
Lubomir Rintel
991df80408 cli: Process secret agent request for a connection only if we know its path
If we're activating the device without knowing the connection in advance, defer
servicing the requests for the secrets until we set the path.

[lkundrak@fedora20-2 ~]$ nmcli --ask c ifname wlan0

(process:18405): libnm-CRITICAL **: nm_object_get_path: assertion 'NM_IS_OBJECT (object)' failed
Error: Connection activation failed: The device has no connections available.
[lkundrak@fedora20-2 ~]$
2014-11-20 16:00:58 +01:00
Thomas Haller
943db815ee translations: avoid preprocessor strings inside translation macro
https://bugzilla.gnome.org/show_bug.cgi?id=740381

Reported-by: Yuri Chornoivan <yurchor@ukr.net>
2014-11-20 12:42:15 +01:00
Lubomir Rintel
d4240ad04c cli: Abort when given name of a non-existent connection for nmcli up
Even when ifname is present: nmcli c up name Nonexistent ifname wlan0
2014-11-19 19:51:44 +01:00