Commit Graph

182 Commits

Author SHA1 Message Date
Beniamino Galvani
b614a5ec61 cli: add support for IP tunnel settings 2015-12-01 17:39:41 +01:00
Jiří Klimeš
d374352b99 cli: allow TAB-completion of "Mode:" in 'nmcli -a con add type tun'
Fixes: 64c6b124d2
2015-11-28 19:48:02 +01:00
Jiří Klimeš
18b7a9a42f cli: ask user before requiring optional parameters for 'nmcli -a con add type tun'
Fixes: 64c6b124d2
2015-11-28 19:48:02 +01:00
Jiří Klimeš
1b0be2bab0 cli: fix a crash in 'nmcli -a con clone'
when providing empty arguments.

Fixes: 0c65b28960
2015-11-28 19:48:02 +01:00
Jiří Klimeš
4a06701e88 cli: add 'strongswan' and 'fortisslvpn' to known VPN types 2015-11-25 17:14:02 +01:00
Beniamino Galvani
64c6b124d2 cli: add support for tun settings
Add nmcli support for adding and modifying TUN/TAP connections.
2015-11-25 11:39:57 +01:00
Jiří Klimeš
847f3b646b cli: make a prompt a translatable string in do_connection_clone()
Fixes: 0c65b28960
2015-11-24 15:22:06 +01:00
Jiří Klimeš
0c65b28960 cli: add 'nmcli connection clone' for cloning connections (bgo #757627)
Synopsis:
nmcli connection clone [--temporary] [id|uuid|path] <ID> <new name>

It copies the <ID> connection as <new name>. The command is very useful
if there is a connection, but another one is needed for a related
configuration. One can copy the existing profile and modify it for the
new situation.

For example:
$ nmcli con clone main-eth second-eth
$ nmcli con modify second-eth connection.interface-name em4

https://bugzilla.gnome.org/show_bug.cgi?id=757627
2015-11-18 09:37:44 +01:00
Jiří Klimeš
cd217db21c cli: move unique_connection_name() to common.c as nmc_unique_connection_name() 2015-11-09 16:17:39 +01:00
Jiří Klimeš
696a443e98 cli: improve error reporting of missing 'ifname' parameter
Example:
before:
$ nmcli c add type gsm con-nameX aaa ifname fsd
Error: 'ifname' argument is required.

now:
$ nmcli c add type gsm con-nameX aaa ifname fsd
Error: mandatory 'ifname' not seen before 'con-nameX'.
2015-10-23 12:28:29 +02:00
Beniamino Galvani
e9c9d02452 cli: fix creation of VLANs with a given MAC address
When a VLAN connection was added with command:

  nmcli c add type vlan ifname v10 id 10 dev 00:11:22:33:44:55

nmcli tried to assign a byte-array value to the ethernet.mac-address
string property, resulting in a invalid connection which failed to
verify. Fix this and set the value as plain string.
2015-10-15 14:30:24 +02:00
Jiří Klimeš
ecf0849355 cli: allow 'ipv6' and 'ppp' settings for GSM and CDMA connections (rh #1265993)
Otherwise the settings cannot be changed.

https://bugzilla.redhat.com/show_bug.cgi?id=1265993
2015-09-25 15:50:22 +02:00
Jiří Klimeš
0c1124b903 cli: fix error string format
clients/cli/.libs/nmcli con mod profile con.zone
Error: Error: value for 'con.zone' is missing..

Fixes: 15149d915f
2015-09-25 15:50:22 +02:00
Jiří Klimeš
9294962cc4 cli: remove static width parameter from fields definition
The width is no longer needed because the actual field's width is computed
dynamically just before printing.
(as of commit e6870789b5)
2015-09-25 12:09:51 +02:00
Jiří Klimeš
290c1626b9 cli: allow creating ADSL connections with 'nmcli connection add' (rh #1264089)
https://bugzilla.redhat.com/show_bug.cgi?id=1264089
2015-09-21 15:21:51 +02:00
Jiří Klimeš
5502d8691a cli: initialize adsl.protocol in editor when creating a new connection
The protocol is required and it is nice to have a valid initial value for
the property.
2015-09-21 15:21:51 +02:00
Dan Winship
22e1a97e12 all: drop includes to <glib/gi18n.h> for "nm-default.h"
The localization headers are now included via "nm-default.h".

Also fixes several places, where we wrongly included <glib/gi18n-lib.h>
instead of <glib/gi18n.h>. For example under "clients/" directory.
2015-08-05 15:35:51 +02:00
Thomas Haller
19c3ea948a all: make use of new header file "nm-default.h" 2015-08-05 15:32:40 +02:00
Dan Winship
3452ee2a0e all: rename nm-glib-compat.h to nm-glib.h, use everywhere
Rather than randomly including one or more of <glib.h>,
<glib-object.h>, and <gio/gio.h> everywhere (and forgetting to include
"nm-glib-compat.h" most of the time), rename nm-glib-compat.h to
nm-glib.h, include <gio/gio.h> from there, and then change all .c
files in NM to include "nm-glib.h" rather than including the glib
headers directly.

(Public headers files still have to include the real glib headers,
since nm-glib.h isn't installed...)

Also, remove glib includes from header files that are already
including a base object header file (which must itself already include
the glib headers).
2015-07-24 13:25:47 -04:00
Jiří Klimeš
7b6299d8dd cli: fix a crash adding a slave connection with 'nmcli -a con add'
Valid types: [generic, 802-3-ethernet (ethernet), pppoe, 802-11-wireless (wifi), wimax, gsm, cdma, infiniband, adsl, bluetooth, vpn, 802-11-olpc-mesh (olpc-mesh), vlan, bond, team, bridge, bond-slave, team-slave, bridge-slave]
Connection type: team-slave
Interface name [*]: eth5
Master: nm-team

Program received signal SIGSEGV, Segmentation fault.
0x000000000041ae6d in normalized_master_for_slave (connections=connections@entry=0x7fffec0019a0, master=<optimized out>, master@entry=0x73b470 "nm-team",
    type=type@entry=0x72f7c0 "team", out_type=out_type@entry=0x0) at connections.c:3218
3218					*out_type = con_type;

Fixes: aa12bb353b
2015-07-15 17:16:11 +02:00
Jiří Klimeš
9856ca6058 cli: fix formating of "nmcli con add help" output 2015-07-15 16:08:31 +02:00
Thomas Haller
09d5fa0392 cli: fix usage output for nmcli connection add removing duplicate "save"
Fixes: 1375d9c13a
2015-07-13 12:16:43 +02:00
Lubomir Rintel
1375d9c13a cli: add master option to "nmcli c add" 2015-07-12 15:46:37 +02:00
Lubomir Rintel
aa12bb353b cli: discover slave type for a connection with a master
Rename verify_master_for_slave(), since it does a lot more than just verifying
the master setting.

Make the type check optional and return the type of the connection that
matched. This makes it possible to omit setting the slave type on a command
line and still get the slave type right.
2015-07-12 15:45:23 +02:00
Lubomir Rintel
07912b6e79 cli: remove an extraneous _strip_master_prefix() call
verify_master_for_slave() already ensures the returned string has no prefix.
2015-07-12 15:45:23 +02:00
Lubomir Rintel
00e0fffea2 cli: process slave parameters after the rest of the settings are set up
This separates setup of the master & slave type and addition of the wired
settings for "bond-slave", "bridge-slave" and "team-slave" connection types
from processing of slave type specific options.

A follow-up commit will make it possible to specify master (and slave type) for
any connection, not relying on "-slave" types.
2015-07-12 15:45:23 +02:00
Lubomir Rintel
b3e57cf3ca cli: allow specifying arbitrary properties on "nmcli c add"
Syntax: nmcli c add ... -- [+|-]<setting>.<property> <value> ...
2015-07-02 09:33:58 +02:00
Lubomir Rintel
15149d915f cli: refactor: split connection property reader from do_connection_modify()
No functional change.

We'll need it for specifying the properties on connection addition.
2015-07-02 09:33:58 +02:00
Lubomir Rintel
df69bd1625 cli: trivial: move is_property_valid()
This removes one extra forward definition and saves one in future.
2015-07-02 09:33:58 +02:00
Lubomir Rintel
2e958baceb nmcli: don't hang activation of masters that progress beyond ip-config
Some master connetions are able to progress beyond activating/ip-config -- the
slaves might have appeared during the activation, or the connection doesn't
need slaves to obtain the configuration (it could be method=manual or shared).
2015-06-23 12:44:49 +02:00
Jiří Klimeš
631f5b1e5c cli: use color names when TAB-completing "nmcli prompt-color" 2015-06-11 10:01:47 +02:00
Jiří Klimeš
3641ddb00a cli: take color name arguments for "nmcli prompt-color" in editor (bgo #744936)
Adjust nmcli prompt-color description and make it more friendly for
translators.

nmcli> nmcli prompt-color green

https://bugzilla.gnome.org/show_bug.cgi?id=744936
2015-06-11 10:00:54 +02:00
Thomas Haller
8a14851f93 cli: refactor property to string conversion
Instead of having a get_func() and out2in_func(), have only one
get_func() that accepts an argument of the output format.

This way, a conversion to parsable input format, doesn't have to go
first thourgh get_func() and mangle the pretty string in out2in_func().

This fixes conversions via nmc_property_out2in_cut_paren().
For example, nmc_property_802_1X_get_private_key_password_flags()
would return a localized string _("0 (none)"). There is no guarantee
that out2in_func() would find the expected output format after
localizing.

This also fixes nmc_property_out2in_routes() which expected
a format "dst =" (would be "ip =") and expects mandatory
'nh' and 'mt' arguments. In fact, the regex didn't match and
nmc_property_out2in_routes() always failed.

While at it, also combine the implementation of
nmc_property_ipv4_get_routes() and nmc_property_ipv6_get_routes().
2015-06-05 12:26:48 +02:00
Jiří Klimeš
79bc271685 cli: TAB-completion for enum-style property values (rh #1034126)
Valid values for enumeration-style properties are offered in TAB-completion in
the editor. Thus the user has a quick overview of the possible values and can
edit properties more easily.

Example:
$ nmcli con edit type wifi
nmcli> set wifi-sec.group <TAB>
ccmp    tkip    wep104  wep40
nmcli> ...

https://bugzilla.redhat.com/show_bug.cgi?id=1034126
2015-05-28 10:13:52 +02:00
Jiří Klimeš
188d6cbaf3 cli: change function for allowed values to return array of strings 2015-05-28 10:13:51 +02:00
Jiří Klimeš
5e1a7ffb39 cli: add @brackets parameter to nmc_util_strv_for_display 2015-05-28 10:13:51 +02:00
Jiří Klimeš
db0f5b3b4c cli: print valid-values hint in property menu for empty "set" command
nmcli 802-11-wireless.mode> set
Allowed values for 'mode' property: infrastructure, adhoc, ap
Enter 'mode' value:
2015-05-28 10:13:51 +02:00
Dan Winship
721e917cb6 wimax: drop WiMAX support (bgo #747846)
Even Fedora is no longer shipping the WiMAX SDK, so it's likely we'll
eventually accidentally break some of the code in src/devices/wimax/
(if we haven't already). Discussion on the list showed a consensus for
dropping support for WiMAX.

So, remove the SDK checks from configure.ac, remove the WiMAX device
plugin and associated manager support, and deprecate all the APIs.

For compatibility reasons, it is still possible to create and save
WiMAX connections, to toggle the software WiMAX rfkill state, and to
change the "WIMAX" log level, although none of these have any effect,
since no NMDeviceWimax will ever be created.

nmcli was only compiling in support for most WiMAX operations when NM
as a whole was built with WiMAX support, so that code has been removed
now as well. (It is still possible to use nmcli to create and edit
WiMAX connections, but those connections will never be activatable.)
2015-04-17 12:42:23 -04:00
Lubomir Rintel
0e8a14cc5f cli: don't look up a device for activation request unless we have to
Let the server decide which device to use if the user didn't explicitly
specify the interface, wireless access point or a wimax nsp.

The server will just reuse the device for an already active connection
or potentially do a better guess.

https://bugzilla.gnome.org/show_bug.cgi?id=730492
2015-04-03 18:59:33 +02:00
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
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
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š
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š
bc265d4372 nmcli: add support for terminal formatting, like bold, dim, underline, etc. 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