Commit Graph

327 Commits

Author SHA1 Message Date
Thomas Haller
c72a07a604 clients: implement wifi-sec.wep-key-type as enum property
This way, we get tab completion for the enum values, and
can reuse existing code.

This requires a pre-set-notify hook, that is invoked before
setting the property.
2017-05-23 13:37:10 +02:00
Thomas Haller
d6bdf6d9dc clients: fix error message for setting flags enums
The min/max for flags must be unsigned. We need to keep track of
whether we have flags or an enum, and adjust min/max.
2017-05-23 13:37:10 +02:00
Thomas Haller
cfc9f5a9fd clients: implement team.config as string property
... with separate validation function.
2017-05-23 13:37:10 +02:00
Thomas Haller
9a68123827 clients: implement serial.parity as enum property
Previously we would only consider the first character of
value. For example, "Nonsense" was also allowed. Don't do
that anymore.
2017-05-23 13:37:10 +02:00
Thomas Haller
6c4428324e clients: implement proxy.pac-script as string property
... with separate validation function.
2017-05-23 13:37:10 +02:00
Thomas Haller
df388ea7d5 clients/trivial: rename nmc_vlan_parse_priority_maps function 2017-05-23 13:37:10 +02:00
Thomas Haller
14aefa1d7f clients: implement dcb priorities as int property 2017-05-23 13:37:10 +02:00
Thomas Haller
e086cf1887 clients: add value_infos for int getter
This allows to implement a pretty alias for numbers,
like "default" for 0.
2017-05-23 13:37:10 +02:00
Thomas Haller
b6d9bdcee8 clients: combine int property setters
Instead of having 3 implementations for setting an int (int, uint, int64), combine
them. Also, make them more configurable by allowing to specify min/max/base, outside
of GParamSpec.
2017-05-23 13:37:10 +02:00
Thomas Haller
35d6802724 clients: add validate_fcn for string property 2017-05-23 13:37:10 +02:00
Thomas Haller
6c4b12418b clients: implement macsec.mode property as enum 2017-05-23 13:37:10 +02:00
Thomas Haller
bd180e489d clients: implement macsec.validation property as enum 2017-05-23 13:37:10 +02:00
Thomas Haller
ebdc7a6ce7 clients: implement proxy.method property as enum 2017-05-23 13:37:10 +02:00
Thomas Haller
772225f8cf clients: implement ip-tunnel.mode property as enum 2017-05-23 13:37:10 +02:00
Thomas Haller
c55561d303 clients: implement connection.autoconnect-slaves property as enum 2017-05-23 13:37:10 +02:00
Thomas Haller
8c87a4b8a8 clients: replace nmc_string_to_int() by _nm_utils_ascii_str_to_int64() 2017-05-23 13:37:10 +02:00
Thomas Haller
1e5c5bd4a6 clients: cleanup parse_ip_route 2017-05-23 13:37:10 +02:00
Thomas Haller
5183399744 clients: cleanup parse_ip_address 2017-05-23 13:37:10 +02:00
Thomas Haller
9a3e35cc0e clients: don't use nmc_string_to_int_base() and nmc_string_to_uint_base() util
They are redundant.
2017-05-23 13:37:10 +02:00
Thomas Haller
1371116ea2 clients: implement wireless.mac-address-randomization property as enum 2017-05-23 13:37:10 +02:00
Thomas Haller
cc79b1a554 clients: implement wired.wake-on-lan property as enum 2017-05-23 13:37:10 +02:00
Thomas Haller
d48998b4e8 clients: implement tun.mode property as enum 2017-05-23 13:37:10 +02:00
Thomas Haller
3341e89e7c clients: implement macvlan.mode property as enum 2017-05-23 13:37:10 +02:00
Thomas Haller
5a98837b23 clients/trivial: whitespace 2017-05-23 13:37:10 +02:00
Thomas Haller
d76c190dc7 clients: fix appending integer to result in nmc_property_set_bytes() 2017-05-23 13:27:24 +02:00
Beniamino Galvani
30393ee236 clients: fix setter for 802-1x.password-raw
The property is a GBytes, not a GByteArray.

https://bugzilla.gnome.org/show_bug.cgi?id=782836
2017-05-23 13:27:24 +02:00
Thomas Haller
234bc0adcf cli: fix use-after-free in _get_fcn_gobject_enum()
Fixes: ddfff04a45
2017-05-15 15:16:22 +02:00
Lubomir Rintel
2899bb3429 cli: add support for the WPS property 2017-05-15 12:59:55 +02:00
Beniamino Galvani
00df57a066 clients: print expected route syntax on parsing failure
Now that routes can include optional attributes, print the expected
syntax in case of parsing failure.

 $ nmcli connection modify dummy ipv4.routes a
 Error: failed to modify ipv4.routes: invalid route: Invalid IPv4
 address 'a'. The valid syntax is: 'ip[/prefix] [next-hop] [metric]
 [attribute=val]... [,ip[/prefix] ...]'.
2017-05-08 10:09:30 +02:00
Beniamino Galvani
6181f41d8d cli: support for wifi-sec.pmf property 2017-04-28 09:46:06 +02:00
Thomas Haller
da5a6534bc cli: fix _values_fcn_gobject_enum() for flag types
For flags, the integer is cast to "unsigned", hence, the min/max
range must be different.

Fixes: f53218ed7c
2017-04-27 17:59:51 +02:00
Thomas Haller
83a6f36207 cli: don't mark field names for translation
Before refactoring nmcli recently, field names were marked for translation.
Note that for the property names, marking them had no effect as only
plain strings can be marked with N_().

Note how --fields are also an input argument. The input should be
independent of the locale and not translated. Likewise, when printing
the header names, they should not be translated to match the --fields
option.

    $ LANG=de_DE.utf8 nmcli --fields GENERAL.DEVICE device show enp0s25
    GENERAL.GERÄT:                          enp0s25

Drop the translation marks.
2017-04-23 23:45:02 +02:00
Thomas Haller
7aab314cef cli: fix marking settings docs for translation
Text for translation cannot contain defines (or variables). We must
generate the description docs with plain N_() values.
2017-04-23 23:45:02 +02:00
Thomas Haller
b20092b51e cli: fix marking setting pretty name for translation 2017-04-23 23:45:02 +02:00
Thomas Haller
9fcbe4ff71 cli: don't use #define for translation texts
Text for translation cannot contain defines (or variables).
2017-04-23 23:45:02 +02:00
Thomas Haller
6dfb3e9ffb cli/trivial: remove whitespace between N_ macro and parenthesis
For _() and N_() we don't have a space before the parenthesis.
Be consistent about that.
2017-04-19 18:27:19 +02:00
Beniamino Galvani
afca8a4c0f clients: fix setting of enum properties
Ensure we call G_IS_ENUM_CLASS() or G_IS_FLAGS_CLASS() only on classed
types.

 $ nmcli connection modify foobar wifi.powersave 1
 Thread 1 "nmcli" received signal SIGSEGV, Segmentation fault.
 0x0000000000440a4d in _set_fcn_gobject_enum at
 clients/common/nm-meta-setting-desc.c:985
 985                 || G_IS_ENUM_CLASS (gtype_prop)) {

Fixes: f53218ed7c
2017-04-18 13:40:02 +02:00
Lubomir Rintel
738c2fcefc clients/meta-setting-desc: fix an unintentional fallthrough
Fixes: ddfff04a45
2017-04-15 12:30:02 +02:00
Thomas Haller
275ab5fb8f cli: make properties list a list of pointers
That allows for the property list to contain derived
property types. Also, the list can be directly passed
off as a "const NMMetaAbstractInfo *const*" list.
2017-04-13 10:10:12 +02:00
Thomas Haller
f2b5a42c7c cli: let NMMetaNestedPropertyInfo derive NMMetaPropertyInfo 2017-04-13 10:10:12 +02:00
Thomas Haller
6d12d2f3a0 cli: move setting creation to meta data 2017-04-12 14:12:20 +02:00
Thomas Haller
b629b98687 cli: move completion for connection type to meta data 2017-04-12 14:12:20 +02:00
Thomas Haller
2a760897f2 cli: move completion for master connections to meta data
This change (improves) behavior.

Before, we would only complete
  if (g_strcmp0 (con_type, nmc_tab_completion.con_type) != 0)
which doesn't really make sense as it depends on the slave-type,
not nmc_tab_completion.con_type.
2017-04-12 14:12:20 +02:00
Thomas Haller
1e4bc51a4a cli: move completion for devices names to meta data 2017-04-12 14:12:20 +02:00
Thomas Haller
d32817999c cli: move information about valid connection settings to common 2017-04-12 14:12:20 +02:00
Thomas Haller
3ed0fc1b45 cli: move setting alias to meta data 2017-04-12 14:12:20 +02:00
Thomas Haller
6c2727af14 cli: add meta data for NMSettingGeneric 2017-04-12 14:12:20 +02:00
Thomas Haller
0fa5fc3f51 cli: move completing VPN service types to meta data 2017-04-12 14:12:19 +02:00
Thomas Haller
0b7e9c3bef cli: move prompting for boolean values to meta data
This changes behavior, in that yes|no prompt and answer is no longer
localized.

For command line arguments, I think it is always wrong for nmcli to
behave differently based on the localization. That is, input properties
on command line should not be translated.

One could make an argument, that in interactive mode that is different
and the user can be prompted in the his language.

But I think for consistency, it is wrong to ask for localized nmcli input.
2017-04-12 14:12:19 +02:00
Thomas Haller
cfd9f66ae9 cli: add property completion to meta-data
(not used yet).
2017-04-12 14:12:19 +02:00