Commit Graph

94 Commits

Author SHA1 Message Date
Francesco Giudici
e04c9af5fd nmcli: allow to set dhcp-timeout as "infinity"
DHCP timeout may now be explicitly disabled by setting the
ipv[4,6].dhcp-timeout options to "infinity".
This will set the DHCP timeout value to MAXINT32.
2017-09-18 18:44:43 +02:00
Thomas Haller
6ece7d6dd3 cli: cleanup _get_fcn_gobject_int() and _set_fcn_gobject_int() 2017-09-12 16:52:49 +02:00
Thomas Haller
a8d2a4ebaf cli: implement dcb priority as plain int property
There are basically three options:

1)  use a separate _get_fcn_gobject_dcb_priority() getter and
    implement them as a new type _pt_gobject_dcb_priority.
2a) implement them as _pt_gobject_int and set nicks as value_infos,
    repeating the nicks 3 times.
2b) like 2a, but use a macro to define how the DCB priority shall
    behave at one place.

I think 1) is ugly. In the previous form, it also does not support
setting the property to "unset". We should implement properties as
types, and modify their behavior (by setting value_infos), instead
of implementing multiple, different types.

I slightly prefer 2b) over 2a) because it defines the behavior once,
but it's a bit harder to follow.
2017-09-12 16:34:17 +02:00
Thomas Haller
4c8673d978 cli: refactor connection.autoconnect-retires to use int-getter 2017-09-12 16:34:17 +02:00
Thomas Haller
e36ed195ba cli: refactor ipv4.dad-timeout to use int-getter
- Reduce duplicated code and implement the property according to
  best-practice for integer types.

- Do not translate the output

- This way, the setter also supprts the nick names
2017-09-12 16:03:05 +02:00
Thomas Haller
6ad53975b3 cli: fix _set_fcn_gobject_int_impl() to accept nick for setting int property
Fixes: e086cf1887
2017-09-12 16:02:39 +02:00
Lubomir Rintel
9481bda939 clients: don't default Bluetooth to the PANU profile
No reason to, the other types are no less likely. Quite the contrary, if
the user specifies a GSM APN we're sure to use a DUN profile.

  $ ./clients/cli/nmcli c add type bluetooth ifname '*' bluetooth.bdaddr 1C:E2:CC:56:6C:45 apn internet
  $ nmcli c show bluetooth-1 |grep bluetooth.type
  bluetooth.type:                         panu
                                          ^^^^ not cool
2017-08-23 16:19:32 +02:00
Lubomir Rintel
0718b25508 clients: allow GSM and CDMA for Bluetooth connections
Unbreaks Bluetooth DUN. Probably broken with the nm-meta-setting-desc
refactor, hence the Fixes tag. I didn't actually check.

  $ nmcli c add type bluetooth ifname '*' bluetooth.bdaddr 1C:E2:CC:56:6C:45 connection.id bt bt-type dun-gsm
  Error: 'apn' argument is required.
  $ nmcli c add type bluetooth ifname '*' bluetooth.bdaddr 1C:E2:CC:56:6C:45 connection.id bt bt-type dun-gsm apn internet
  Error: invalid <setting>.<property> 'apn'.
  $

This is where it starts to get sad ^

  $ nmcli c add type bluetooth ifname '*' bluetooth.bdaddr 1C:E2:CC:56:6C:45 connection.id bt bt-type dun-gsm gsm.apn internet
  Error: invalid or not allowed setting 'gsm': 'gsm' not among [connection, bluetooth, bridge, ipv4, ipv6, proxy].
  $

This is where it gets obvious what went wrong ^

Fixes: b5c8622ad3
2017-08-23 16:08:42 +02:00
Beniamino Galvani
f83e56ec6d libnm,clients: add 'parent' property to PPPoE setting
When the property is set, it specifies the device on which PPPoE is to
be started. The ppp interface will be named as the
connection.interface-name property.

When the property is not set the previous behavior will be retained,
i.e. the PPPoE connection will be started on connection.interface-name
and the PPP interface will have a random name.
2017-08-05 08:03:15 +02:00
Beniamino Galvani
17ec3aef2f bridge: introduce a bridge.group-forward-mask connection property
https://bugzilla.redhat.com/show_bug.cgi?id=1358615
2017-07-27 09:35:11 +02:00
Beniamino Galvani
46d2168393 clients: reorder properties of connection setting
The order matters for the 'nmcli connection show' output and for the
interactive mode of nmcli. Users should not rely on the order in both
cases, but since we have an extensive test suite for the interactive
mode, restore the order as it was in 1.8.
2017-06-22 15:01:15 +02:00
Beniamino Galvani
afac7621ae clients: return NULL array on auto-completion failure
readline crashes if we return an empty completion list; return NULL
instead.

This is reproducible, for example, with:

 $ nmcli --ask connection add
 Interface name [*]: doesnotexist<TAB>
 Segmentation fault (core dumped)

 $ nmcli --ask connection add
 Interface name [*]:
 Connection type: avian-carr<TAB>
 Segmentation fault (core dumped)
2017-06-22 15:01:15 +02:00
Lubomir Rintel
aedeb3cbf4 clients: add support for Bluetooth NAP type 2017-05-31 20:17:42 +02:00
Lubomir Rintel
ab46c9c70c clients: allow bridge settings for Bluetooth devices
Will be useful for Bluetooth NAP.
2017-05-31 20:17:39 +02:00
Beniamino Galvani
ce956a240b clients: fix MTU setter function
Don't reuse _set_fcn_gobject_int_impl() because it requires
gobject_int subtype data in the property info, while MTU properties
have mtu subtype data.
2017-05-26 18:16:19 +02:00
Beniamino Galvani
c73b39c3a6 clients: fix typo 2017-05-24 10:42:33 +02:00
Beniamino Galvani
f15fd1e504 clients: fix meta setting descriptor for connection.autoconnect-slaves
Don't specify .get_gtype for properties of enum type.

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

Fixes: c55561d303
2017-05-24 10:41:37 +02:00
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