Commit graph

234 commits

Author SHA1 Message Date
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
Jiří Klimeš
86f1645d88 clients: fix bad array loop in nm-secret-agent-simple.c:strv_has (bgo #752137)
https://bugzilla.gnome.org/show_bug.cgi?id=752137

(cherry picked from commit 55c3f70ec8)
2015-07-10 12:43:45 +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
Lubomir Rintel
994136e142 device,libnm,cli: add "new-activation" reason for device state change
It will be used when the device is disconnected for new connection activation.

(cherry picked from commit 1ad193a017)
2015-04-14 17:04:31 +02:00
Beniamino Galvani
d2e5e648d4 wifi: indicate 2ghz and 5ghz wifi device capabilities
Add new capabilities CAP_FREQ_2GHZ and CAP_FREQ_5GHZ to indicate the
frequency bands supported by a Wifi device.

Add also CAP_FREQ_VALID, which is set when the values of the other 2
capabilities are available.

Original patch by Dan Williams <dcbw@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=723295
(cherry picked from commit aabc6fc57b)
2015-04-09 09:20:48 -05:00
Thomas Haller
ce7bdc0ac5 cli: fix memleak in nmc_setting_get_valid_properties()
(cherry picked from commit fdd09340ce)
2015-03-13 11:50:03 +01:00
Jiří Klimeš
2da6daea17 cli: fix memory leaks when asking for arguments
(cherry picked from commit ae3f452994)

Conflicts:
	clients/cli/connections.c
2015-03-12 16:59:46 +01:00
Jiří Klimeš
2a72527c44 tui: fix a crash when connection list for activation is empty (rh #1119663)
When there are no connections for a device, do not add the header.

https://bugzilla.redhat.com/show_bug.cgi?id=1119663
(cherry picked from commit 5aa204edec)
2015-03-05 07:44:08 -06:00
Jiří Klimeš
192b25e283 cli: add description for certificate properties in editor (rh #1182575)
(cherry picked from commit 8ed0e50ff1)
2015-01-20 14:37:39 +01:00
Jiří Klimeš
1ea95cd374 tui: fix crash when editing DSL connection
Program received signal SIGSEGV, Segmentation fault.
 0x000000000041b3e5 in nmt_page_dsl_constructed (object=0x7fffec0228c0 [NmtPageDsl]) at nmt-page-dsl.c:109
 109		priv->ethernet_page = nmt_page_ethernet_new (conn, nmt_editor_page_device_get_device_entry (NMT_EDITOR_PAGE_DEVICE (dsl)));
 Missing separate debuginfos, use: debuginfo-install libffi-3.0.10-3.fc18.x86_64 newt-0.52.15-1.fc19.x86_64
 (gdb) bt
 #0  0x000000000041b3e5 in nmt_page_dsl_constructed (object=0x7fffec0228c0 [NmtPageDsl]) at nmt-page-dsl.c:109
 #1  0x0000003e9ac161e3 in g_object_newv (object_type=1, object_type@entry=16203872, n_parameters=n_parameters@entry=2, parameters=parameters@entry=0xf74350)
    at gobject.c:1741
 #2  0x0000003e9ac16560 in g_object_new_valist (object_type=object_type@entry=16203872, first_property_name=first_property_name@entry=0x42e524 "connection",
    var_args=var_args@entry=0x7fffffffcef8) at gobject.c:1830
 #3  0x0000003e9ac16894 in g_object_new (object_type=16203872, first_property_name=first_property_name@entry=0x42e524 "connection") at gobject.c:1545
 #4  0x000000000041b504 in nmt_page_dsl_new (conn=<optimized out>, deventry=deventry@entry=0x974690 [NmtDeviceEntry]) at nmt-page-dsl.c:47
 #5  0x000000000041808e in nmt_editor_constructed (object=<optimized out>) at nmt-editor.c:355
 #6  0x0000003e9ac161e3 in g_object_newv (object_type=1, object_type@entry=16174256, n_parameters=n_parameters@entry=4, parameters=parameters@entry=0xf6cec0)
     at gobject.c:1741
 ...
 (gdb) p priv
 $1 = (NmtPageDslPrivate *) 0x0
(cherry picked from commit cf0a87c5e4)
2015-01-07 19:35:22 +01:00
Jiří Klimeš
aee82153fc tui: fix saving "Available to all users" (rh #1176042)
(cherry picked from commit 675d545bcc)
2015-01-07 18:33:00 +01:00
Thomas Haller
eb7eafd424 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

(cherry picked from commit 3cbce6994a)
2014-12-22 15:41:49 +01:00
Thomas Haller
4fb85b57b8 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>

(cherry picked from commit 5ef233936a)
2014-12-22 15:41:49 +01:00
Jiří Klimeš
3034fe9f4d 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...".

(cherry picked from commit bcd5b2cdc1)
2014-12-16 21:47:01 +01:00
Jiří Klimeš
932f1ca63e cli: mute coverity for Error: DEADCODE (CWE-561)
It can't recognize that the variables are set when parsing arguments.

(cherry picked from commit ed088b0df7)
2014-12-16 21:47:01 +01:00
Lubomir Rintel
9a3cc60d9b cli: expose the vpn.persistent property 2014-12-11 11:15:53 +01:00
Dan Winship
5bfb4c8c23 tui: fix deletion of slaves with master (rh #1131574)
We wait for each deletion to complete, so the connections were getting
removed from the connections array as we edited it (unlike with the
old transfer-container GSList-based code). Fix this by copying the
slaves out into their own list first.
2014-12-05 16:16:53 +01:00
Jiří Klimeš
d80bb52872 tui: width and height parameters was swapped, but they are ignored anyway
Coverity: Defect type: SWAPPED_ARGUMENTS
clients/tui/newt/nmt-newt-section.c:328: swapped_arguments: The positions of arguments in the call to "nmt_newt_widget_size_request" do not match the ordering of the parameters: * "&border_height" is passed to "width" * "&border_width" is passed to "height"
2014-12-05 09:38:40 +01:00
Jiří Klimeš
f93128194e tui: set GError so that it is not NULL later
Coverity:
Defect type: FORWARD_NULL
clients/tui/nmtui-edit.c:467: var_deref_op: Dereferencing null pointer "error".
2014-12-05 09:38:40 +01:00
Jiří Klimeš
0e727062fc cli: g_strdup(NULL) returns NULL; simplify code for that 2014-12-03 16:03:19 +01:00