Commit Graph

370 Commits

Author SHA1 Message Date
Jiří Klimeš
94b1b53a91 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
2015-07-17 11:36:03 +02: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
Jiří Klimeš
133996acbb cli: add 'slave-type' parameter for "nmcli con add" to bash completion
Fixes: 1375d9c13a
2015-07-15 16:00:18 +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
1ff98fca40 cli: add "nmcli c add master" to bash-completion
Remove the discouraged forms.
2015-07-12 15:46:37 +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
Thomas Haller
904e961464 all: remove #if GLIB_CHECK_VERSION conditionals around g_type_init()
g_type_init() is now provided by nm-glib-compat.h as nm_g_type_init().
2015-07-12 13:56:52 +02:00
Lubomir Rintel
81f1e3da4f cli: add bash completion for 'nmcli c add -- <property list>'
Use the editor to obtain a list of possible properties for a type of
connection. Let 'nmcli c modify' completion reuse it as well, to avoid code
duplication.
2015-07-02 09:33:58 +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š
c3093d9391 cli: add support for connection.autoconnect-slaves property 2015-06-19 09:32:58 +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
5eba53cd53 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
2015-06-10 11:49:46 +02:00
Beniamino Galvani
bd4e1f37f8 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().
2015-06-09 18:23:12 +02:00
Beniamino Galvani
f0aebfd746 cli: add support for 'metered' connection property 2015-06-09 18:15:20 +02:00
Beniamino Galvani
609f4f37c0 cli: add nmc_string_to_tristate() 2015-06-09 18:11:25 +02:00
Beniamino Galvani
f208e7030f cli: add 'metered' property to device 2015-06-09 18:11:25 +02:00
Thomas Haller
230099aa52 cli: show dns-options default value
You can reset the default value via

  $ nmcli connection modify id CON ipv4.dns-options ""

and set an empty value with

  $ nmcli connection modify id CON ipv4.dns-options " "
2015-06-05 12:26:48 +02:00
Thomas Haller
f81d7242c3 cli: add DEFINE_GETTER_WITH_DEFAULT() macro 2015-06-05 12:26:48 +02:00
Thomas Haller
350900d0a5 cli: stack allocate search string in nmc_properties_find() 2015-06-05 12:26:48 +02:00
Thomas Haller
035e31327b 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.
2015-06-05 12:26:48 +02:00
Thomas Haller
16f089ce64 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.
2015-06-05 12:26:48 +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
Thomas Haller
b8b1a01d96 build: rename file "include/nm-utils-internal.h" to "nm-macros-internal.h"
We already have "nm-utils*.h" and "NetworkManagerUtils.h" headers. Rename
"include/nm-utils-internal.h" to "nm-macros-internal.h". I think that
name is better, because this file is header-only, internal, and
repository-wide.

Also, it will never contain non-header-only declarations because
there is no backing object file under "include/".
It will only contain macros and inline functions.
2015-06-01 14:47:08 +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š
bf01da1a08 cli: add missing nmc_property_802_1X_allowed_eap() function 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
Jiří Klimeš
bfd502a9b1 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
2015-05-27 11:11:47 +02:00
Beniamino Galvani
7467e25593 cli: add support for DNS options 2015-05-13 17:15:34 +02:00
Jiří Klimeš
85afd9a69d cli: (trivial) move DEFINE_SETTER_STR_LIST_MULTI to the right place 2015-05-05 10:08:09 +02:00
Yuri Chornoivan
f851a741a6 fix typo and do not translate an empty string
https://bugzilla.gnome.org/show_bug.cgi?id=748906
2015-05-04 18:36:54 +02:00
Lubomir Rintel
29fe1abf0d cli: stop waiting for deactivation if device reaches unmanaged state
default-unmanaged devices enter unmanaged state right after they're
disconnected.
2015-04-23 10:22:26 -04:00
Jiří Klimeš
7271e168b0 cli: fix allowed slave-types 2015-04-22 08:51:29 +02:00
Jiří Klimeš
1b9c1ed6d3 cli: add NM-PLUGIN-MISSING to devices 2015-04-20 10:04:26 +02:00
Jiří Klimeš
823df334ed 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
2015-04-20 09:52:31 +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
Jiří Klimeš
8252553615 cli: add PHYS_PORT_ID property to devices
The physical-port-id property was added to libnm (libnm-glib) in commit
47cc8b25f2.
2015-04-14 12:18:00 +02:00
Beniamino Galvani
aabc6fc57b 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
2015-04-08 10:48:38 +02:00
Lubomir Rintel
1ad193a017 device,libnm,cli: add "new-activation" reason for device state change
It will be used when the device is disconnected for new connection activation.
2015-04-08 10:00:11 +02: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š
b8a2f42a38 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
2015-03-20 11:03:44 +01:00