Commit graph

195 commits

Author SHA1 Message Date
Jiří Klimeš
77c7292fc6 cli: remove duplicated checks for running Networkmanager
It is already performed in do_connections().

(cherry picked from commit 4c437863fa)
2015-12-03 16:15:29 +01:00
Jiří Klimeš
717b494a00 cli: fix an error in setting s390-options in nmcli editor
nmcli> set eth.s390-options portno=
(process:4711): libnm-CRITICAL **: nm_setting_wired_add_s390_option: assertion 'value_len > 0 && value_len < 200' failed

(cherry picked from commit 6ffe4b61f7)
2015-11-28 19:56:27 +01:00
Jiří Klimeš
00bfaa4ed7 cli: fix an error in nmcli editor when setting vpn.data/vpn.secrets
nmcli> set vpn.data haha=
(process:3951): libnm-CRITICAL **: nm_setting_vpn_add_data_item: assertion 'strlen (item) > 0' failed
nmcli> set vpn.secrets haha=
(process:3951): libnm-CRITICAL **: nm_setting_vpn_add_secret: assertion 'strlen (secret) > 0' failed

(cherry picked from commit 5f9b8b887d)
2015-11-28 19:56:20 +01:00
Jiří Klimeš
85a52fc1b1 all: fix typos in the code and update translations for that (bgo #758102)
Found by Anders Jonsson <anders.jonsson@norsjovallen.se>

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

(cherry picked from commit b92397f925)
2015-11-16 14:42:30 +01:00
Jiří Klimeš
84d741f106 cli: print a warning if BSSID is given instead of SSID for hidden AP
$ nmcli dev wifi connect 00:22:6B:EB:1D:CA hidden yes
Warning: '00:22:6B:EB:1D:CA' should be SSID for hidden APs; but it looks like a BSSID.
Error: Failed to add/activate new connection: 802-11-wireless.ssid: connection does not match access point

(cherry picked from commit 0dc48370b4)
2015-11-11 09:58:14 +01:00
Jiří Klimeš
b25880533e 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'.

(cherry picked from commit 696a443e98)
2015-10-23 12:32:00 +02:00
Jiří Klimeš
02ad858a6d cli: trivial: correct argument description for nmc_parse_args()
(cherry picked from commit b45bd96d89)
2015-10-23 12:31:55 +02:00
Beniamino Galvani
7cf30fe47e wake-on-lan: add option to keep existing settings
Add a new 'ignore' option to NMSettingWired.wake-on-lan which disables
management of wake-on-lan by NetworkManager (i.e. the pre-existing
option will not be touched). Also, change the default behavior to be
'ignore' instead of 'disabled'.

https://bugzilla.gnome.org/show_bug.cgi?id=755182
(cherry picked from commit e587dcb16e)
2015-10-20 17:13:21 +02:00
Jiří Klimeš
ca599fad70 nmcli: fix bash completion of words containing colon (rh #1271271)
Test:
$ sudo ip link add a🅱️c type dummy
$ nmcli device delete<Tab><Tab>
$ nmcli device delete a<Tab>

See also:
http://stackoverflow.com/questions/28479216/how-to-give-correct-suggestions-to-tab-complete-when-my-words-contains-colons
http://stackoverflow.com/questions/2805412/bash-completion-for-maven-escapes-colon/12495727

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

https://bugzilla.redhat.com/show_bug.cgi?id=1271271

(cherry picked from commit 91dde2c865)
2015-10-20 12:05:58 +02:00
Thomas Haller
e0ca2bdb63 build: extract version macros from "nm-version.h" to new header file "nm-version-macros.h"
For libnm library, "nm-dbus-interface.h" contains defines like the D-Bus
paths of NetworkManager. It is desirable to have this header usable without
having a dependency on "glib.h", for example for a QT application. For that,
commit c0852964a8 removed that dependancy.

For libnm-glib library, the analog to "nm-dbus-interface.h" is
"NetworkManager.h", and the same applies there. Commit
159e827a72 removed that include.
However, that broke build on PackageKit [1] which expected to get the
version macros by including "NetworkManager.h". So at least for libnm-glib,
we need to preserve old behavior so that a user including
"NetworkManager.h" gets the version macros, but not "glib.h".

Extract the version macros to a new header file "nm-version-macros.h".
This header doesn't include "glib.h" and can be included from
"NetworkManager.h". This gives as previous behavior and a glib-free
include.

For libnm we still don't include "nm-version-macros.h" to "nm-dbus-interface.h".
Very few users will actually need the version macros, but not using
libnm.
Users that use libnm, should just include (libnm's) "NetworkManager.h" to
get all headers.
As a special case, a user who doesn't want to use glib/libnm, but still
needs both "nm-dbus-interface.h" and "nm-version-macros.h", can include
them both separately.

[1] https://github.com/hughsie/PackageKit/issues/85

Fixes: 4545a7fe96
(cherry picked from commit 7bf10a75db)
2015-09-30 23:35:52 +02:00
Jiří Klimeš
1b253ee722 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

(cherry picked from commit ecf0849355)
2015-09-25 16:15:29 +02:00
Jiří Klimeš
b590a31839 cli: allow creating ADSL connections with 'nmcli connection add' (rh #1264089)
https://bugzilla.redhat.com/show_bug.cgi?id=1264089

(cherry picked from commit 290c1626b9)
2015-09-21 15:49:38 +02:00
Jiří Klimeš
9bca3b7a37 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.

(cherry picked from commit 5502d8691a)
2015-09-21 15:49:20 +02:00
Jiří Klimeš
b46ed87919 nmcli: allow adding 'generic' connections via nmcli connection add
'nmcli connection edit' already allows adding and editing generic connections
(added by 2a2af5825a).

(cherry picked from commit 0ff9b75387)
2015-09-15 14:48:28 +02:00
Jiří Klimeš
c0c1cb1dc8 nmcli: wake-on-lan property set/get fixes
- accept a numeric value (decimal or hex (0x prefix))
- display a numeric value of the property in addition to the strings
- add/accept spaces between string names

to behave similar to other flags' properties.

(cherry picked from commit 4485b4ec2f)
2015-09-15 12:18:18 +02:00
Jiří Klimeš
65f6bb0b7b nmcli: allow "none" value for ethernet.wake-on-lan property (rh #1260584)
Aliases "disable" and "disabled" are accepted too.

nmcli> set 802-3-ethernet.wake-on-lan none

It was possible to remove flags by setting a string containing just white
spaces, but it was user unfriendly and non-intuitive.

https://bugzilla.redhat.com/show_bug.cgi?id=1260584

(cherry picked from commit f88ce92b25)
2015-09-15 12:17:26 +02:00
Beniamino Galvani
5ec73e70bb cli: describe usage of the 'connection.metered' property
(cherry picked from commit 04e29df47d)
2015-09-04 11:00:10 +02:00
Beniamino Galvani
f7811e87b8 cli: add support for Wake-on-LAN settings
(cherry picked from commit de92df6c9f)
2015-08-21 18:12:36 +02:00
Jiří Klimeš
e0762f4f22 cli: fix connecting to a hidden SSID with 'nmcli dev wifi connect' (bgo #752173)
We have to set 802-11-wireless.hidden=true to be able to connect to hidden SSIDs.
nmcli user indicates hidden SSID with 'hidden yes' parameter.

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

(cherry picked from commit 5955a66e09)
2015-08-14 13:32:10 +02:00
Jiří Klimeš
b1f62ce2cd cli: add 'ssid' parameter for 'nmcli device wifi rescan'
'ssid' can repeat when more SSIDs should be scanned, e.g.
$ nmcli dev wifi rescan ssid "hidden cafe" ssid AP12 ssid "my home Wi-Fi"

Bash completion fixed by thaller@redhat.com

(cherry picked from commit e247567d87)
2015-08-14 13:30:17 +02:00
Jiří Klimeš
677ba11a0f cli: fix an bug when reporting an error
$ nmcli dev wifi rescan ifname eteee

(process:21211): libnm-CRITICAL **: nm_device_get_device_type: assertion 'NM_IS_DEVICE (self)' failed
Error: Device 'eteee' is not a Wi-Fi device.

Fixes: 823df334ed
(cherry picked from commit bccc1af51b)
2015-08-13 09:56:19 +02:00
Thomas Haller
1615d8c975 cli: fix metered to string property
nmc_property_connection_get_metered() must return non-localized strings
that can be parsed by nmc_property_connection_set_metered().

Fixes: f0aebfd746
(cherry picked from commit 5eba53cd53)
2015-07-22 13:54:32 +02:00
Beniamino Galvani
83aba66a85 cli: fix error message localization
Valid values must not be translated in error messages generated in
nmc_string_to_bool() and nmc_string_to_tristate().

(cherry picked from commit bd4e1f37f8)
2015-07-22 13:52:46 +02:00
Beniamino Galvani
a4cdf4a63c cli: add support for 'metered' connection property
(cherry picked from commit f0aebfd746)
2015-07-22 13:52:46 +02:00
Beniamino Galvani
5496a91575 cli: add nmc_string_to_tristate()
(cherry picked from commit 609f4f37c0)
2015-07-22 13:52:45 +02:00
Beniamino Galvani
e16c068289 cli: add 'metered' property to device
(cherry picked from commit f208e7030f)
2015-07-22 13:52:45 +02:00
Jiří Klimeš
439ff3841d cli: fix verifying flag-based properties (rh #1244048)
Some of the properties changed from GParamSpecUInt to GParamSpecFlags, namely
NM_SETTING_VLAN_FLAGS
NM_SETTING_DCB_APP_FCOE_FLAGS
NM_SETTING_DCB_APP_ISCSI_FLAGS
NM_SETTING_DCB_APP_FIP_FLAGS
NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS
NM_SETTING_DCB_PRIORITY_GROUP_FLAGS

(commit fcfb4b40ba)

https://bugzilla.redhat.com/show_bug.cgi?id=1244048

(cherry picked from commit 94b1b53a91)
2015-07-17 11:51:20 +02:00
Thomas Haller
46ebed64f4 libnm: add define for cert scheme prefix file:// for NMSetting8021x
(cherry picked from commit a49680dacd)
2015-07-03 09:24:01 +02:00
Jiří Klimeš
0e00801196 cli: allow multiple devices for 'nmcli device disconnect/delete' (bgo #746097)
Allow disconnecting and deleting multiple interfaces at a time. It is much
more user friendly. TAB and bash completions are supported as well.

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

(cherry picked from commit b8a2f42a38)
2015-06-25 16:16:07 +02:00
Jiří Klimeš
a932c75015 cli: fix TAB completion for multiple connections in 'nmcli con down/delete'
(cherry picked from commit f8366c8b1c)
2015-06-25 16:16:07 +02:00
Jiří Klimeš
12a68a523b cli: don't return empty strings in nmc_string_to_arg_array()
and unquote strings in the array if required.

(cherry picked from commit 661ef3cd46)
2015-06-25 16:16:07 +02:00
Lubomir Rintel
649f88de67 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).

(cherry picked from commit 2e958baceb)
2015-06-23 13:04:44 +02:00
Jiří Klimeš
0380c53c39 core/cli: add missing device state-reason to string conversions
for NM_DEVICE_STATE_REASON_PARENT_CHANGED
and NM_DEVICE_STATE_REASON_PARENT_MANAGED_CHANGED

Fixes: cd3df12c8f
(cherry picked from commit bfd502a9b1)
2015-06-20 11:38:35 +02:00
Thomas Haller
c741edaf76 cli: stack allocate search string in nmc_properties_find()
(cherry picked from commit 350900d0a5)
2015-06-19 13:23:29 +02:00
Thomas Haller
77fa56a5e7 cli: refactor nmc_add_prop_funcs() to use variadic macro
The advantage of this is that if we later add another function
pointer we don't have to touch any existing calls which would
only pass NULL to that argument.

Using a variadic argument and partial initialization of an
auto variable gives us that flexibility.

(cherry picked from commit 035e31327b)
2015-06-19 13:23:29 +02:00
Thomas Haller
8d6cced2c5 cli: do not create a copy of static strings for nmc_properties hash
The keys of the hash are static strings. No need to make a copy of it.
If we ever need dynamics properties, we should intern those strings.

(cherry picked from commit 16f089ce64)
2015-06-19 13:19:26 +02:00
Thomas Haller
b81bbc134c 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().

(cherry picked from commit 8a14851f93)
2015-06-19 13:18:16 +02:00
Jiří Klimeš
c8826630a3 cli: add support for connection.autoconnect-slaves property
(cherry picked from commit c3093d9391)
2015-06-19 12:18:52 +02:00
Jiří Klimeš
759918585e 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
(cherry picked from commit 79bc271685)
2015-06-15 10:32:45 +02:00
Jiří Klimeš
a9c9d6b915 cli: add missing nmc_property_802_1X_allowed_eap() function
(cherry picked from commit bf01da1a08)
2015-06-15 10:31:33 +02:00
Jiří Klimeš
bef07bc62d cli: change function for allowed values to return array of strings
(cherry picked from commit 188d6cbaf3)
2015-06-15 10:31:26 +02:00
Jiří Klimeš
561f9b7203 cli: add @brackets parameter to nmc_util_strv_for_display
(cherry picked from commit 5e1a7ffb39)
2015-06-15 10:31:20 +02:00
Jiří Klimeš
9e65dbd711 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:

(cherry picked from commit db0f5b3b4c)
2015-06-15 10:31:14 +02:00
Jiří Klimeš
1203f224f9 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
(cherry picked from commit f52e6bbdda)
2015-06-15 10:28:27 +02:00
Lubomir Rintel
1bf060bf93 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
(cherry picked from commit 0e8a14cc5f)
2015-06-09 18:57:25 +02:00
Yuri Chornoivan
1588a14a8b fix typo and do not translate an empty string
https://bugzilla.gnome.org/show_bug.cgi?id=748906
(cherry picked from commit f851a741a6)

Conflicts:
	libnm-core/nm-keyfile-reader.c
2015-05-04 18:39:50 +02:00
Lubomir Rintel
b05c9d67e7 cli: stop waiting for deactivation if device reaches unmanaged state
default-unmanaged devices enter unmanaged state right after they're
disconnected.

(cherry picked from commit 29fe1abf0d)
2015-04-23 10:24:25 -04:00
Jiří Klimeš
d727e25663 cli: fix allowed slave-types
(cherry picked from commit 7271e168b0)
2015-04-22 09:01:13 +02:00
Jiří Klimeš
70f375b532 cli: better indicate when a Wi-Fi plugin might not be available (rh #1168573)
* print an error message indicating NM Wi-Fi plugin may be missing, for
  nmcli device wifi ifname <dev-name>
  nmcli device wifi connect ifname <dev-name>

* add NM-TYPE to 'nmcli device show' command displaying internal NM device type
  (like NMDeviceWifi, NMDeviceGeneric, ...)

https://bugzilla.redhat.com/show_bug.cgi?id=1168573
(cherry picked from commit 823df334ed)
2015-04-20 10:29:42 +02:00
Jiří Klimeš
dd0dde169f cli: add PHYS_PORT_ID property to devices
The physical-port-id property was added to libnm (libnm-glib) in commit
47cc8b25f2.

(cherry picked from commit 8252553615)
2015-04-20 10:29:35 +02:00