Commit Graph

477 Commits

Author SHA1 Message Date
Jiri Pirko
96303bd9da cli: add missed setting name to nmc_team_slave_settings
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-09-04 12:43:11 +02:00
Jiri Pirko
d338b90cfd cli: add config option for team devices
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-09-04 12:43:11 +02:00
Jiri Pirko
97be00f9e0 cli: add team port setting
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-09-04 12:43:11 +02:00
Jiri Pirko
eb05cbeb9c cli: add team and team-slave detail printing
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-09-04 12:43:11 +02:00
Thomas Haller
00e1e20b16 nmcli: special error message for access denied when SetLogging fails
Setting the logging level fails for normal users due to missing dbus
permissions as configured in src/org.freedesktop.NetworkManager.conf.

In that case, nmcli simply fails showing the dbus error. This error
is however not very clear, so this commit shows a different error
text for the particular case of ACCESS_DENIED.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-09-04 11:56:46 +02:00
Jiří Klimeš
2d9366bcee cli: connect IP addresses/method handlers for existing connections (rh #998137)
The handlers detecting changes of IP addresses/method in nmcli interactive
editor were connected only for newly created connection. That's why the
automagic feature of setting 'method' when 'addresses' are changed and vice
versa worked just for new connections, but not while editing existing
connections.
2013-09-02 13:20:04 +02:00
Jiří Klimeš
36465df124 cli: remove 802-11-wireless.security property from nmcli as it is deprecated
If a Wi-Fi connection is secured, it contains 802-11-wireless-security setting.
That's it. There's no need to have this property.
2013-09-02 09:46:31 +02:00
Jiří Klimeš
1be3bf17bc cli: add missing 802-1x setting for Wi-Fi connections in the editor
Without that Enterprise type Wi-Fi could not be edited via the nmcli
interactive editor.
2013-08-29 15:56:48 +02:00
Jiří Klimeš
d7788b0d46 cli: fix TAB-completion for aliases in interactive editor
Before the change if an alias for a setting name existed, it was used instead of
the real name and TAB-completion for the real name didn't work.

before:
nmcli> goto 802<TAB>
no output

now:
nmcli> goto 802<TAB>
nmcli> goto 802-11-wireless
802-11-wireless           802-11-wireless-security

nmcli> goto <TAB>
802-11-wireless-security (wifi-sec)  connection                       ipv6
802-11-wireless (wifi)               ipv4
2013-08-29 15:36:55 +02:00
Jiří Klimeš
d646cf909f cli: disable setting 'rate' and 'tx-power' properties in editor
The properties are not implemented in NM core, nor in ifcfg-rh plugin. Thus
they are not preserved over re-reading from ifcfg-* file. Moreover they are
highly dependent on drivers.
When we allowed editing them, the connection changed after re-reading and
was marked as dirty (and users were puzzled).
2013-08-29 13:43:00 +02:00
Dan Winship
a854a273c9 cli: add connectivity support 2013-08-28 10:54:09 -04:00
Thomas Haller
c3ea945c19 nmcli: fix errors in nmcli help output and man page
Fix some spelling errors and wrong parameter description. Also add the
team connection to the manual page.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-28 15:26:50 +02:00
Thomas Haller
2d2b2a48eb cli: change completion to suggest connection ids
Before, whereever a connection id is accepted, the completion only
offered 'id', 'uuid', 'path', etc. With this change, it will additionally
suggest the id of existing connections.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-28 14:36:49 +02:00
Thomas Haller
ab231cb0d9 cli: improve bash completion by parsing options separately.
To support optimal completion, more context must be considered.
Especially the OPTIONS, which must appear before the OBJECT.
Modify bash completion to try parsing first the options.

Before, whenever you had options, completion did not work
anymore (because the object was expected as first argument).
Moreover, options were also suggested after specifying the
object. This is now mitigated by parsing the command line
in two steps.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-28 14:36:49 +02:00
Jiří Klimeš
3cb0bf6bc0 cli: consider empty value as "*" for "Interface name: " prompt 2013-08-27 10:20:41 +02:00
Thomas Haller
a7588227ed cli: bugfix verification for wifi channel in edit mode
This bug caused the edit mode to refuse most of the valid wifi channels.
The bug was present since the beginning, so all versions before this
commit will have this issue.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-23 17:13:56 +02:00
Dan Winship
bfce3f7dc8 build: switch from $(INCLUDES) to $(AM_CPPFLAGS) to make automake happy
Unfortunately, $(AM_CPPFLAGS) gets overridden by per-target _CPPFLAGS
variables, which $(INCLUDES) did not, so this requires some additional
changes.

In most places, I have just gotten rid of the per-target _CPPFLAGS
variables; in directories with a single target, the per-target
variable is unnecessary, and in directories with multiple targets, the
per-target variable is often undesirable, since it forces some files
to be compiled twice, even though there ends up being no difference
between the two files.
2013-08-22 11:49:16 -04:00
Thomas Haller
76186d652f nmcli: strip whitespace when reading property name in edit mode
When reading the property name in edit mode, any white space should be
striped from the entered value. Especially, because tab completion will
add a trailing whitespace.

Example:

  $ nmcli connection edit
  Enter connection type: ethernet
  nmcli> goto connection
  nmcli connection> describe
  Property name? u<TAB>

The <TAB> will complete 'u' to 'uuid '.
This whitespace should be allowed and striped.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-21 10:54:56 +02:00
Thomas Haller
d6aaa988db cli: highlight 'describe' command for edit mode.
When editing starts, print a info message pointing to the 'describe'
command.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-21 10:38:49 +02:00
Jiri Pirko
a523a431d3 cli: add team driver support
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-15 10:54:15 -05:00
Thomas Haller
e2f77d30b1 cli: make bash-completion for nmcli support more abbreviations.
Also sub commands can be abbreviated. Add some more aliases to the bash
completion.

Also fix the option 'nmcli radio mobile' which is called 'wwan'.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-13 14:17:44 +02:00
Thomas Haller
faa6a12ba3 cli: make bash-completion support abbreviated object names.
nmcli accepts abbreviated versions of object names, e.g. 'con'
instead of 'connection'. Adjust bash completion to also support
this.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-12 13:33:13 -05:00
Pavel Šimerda
320a9d16a3 all: replace struct in_addr with guint32 2013-08-03 00:15:07 -05:00
Jiří Klimeš
de42b9be67 cli: editor: show current configuration for 'nmcli' command without arguments 2013-07-30 14:04:59 +02:00
Jiří Klimeš
18817877ad cli: confirm connection saving when autoconnect=yes (rh #953296)
Ask for confirmation in these cases:
* autoconnect=yes and connection has not been saved yet
* autoconnect=yes, but saved connection had autoconnect=no

The confirmation can be switched off with
nmcli> nmcli save-confirmation no
2013-07-30 14:04:52 +02:00
Jiří Klimeš
6f633a678a cli: editor: automagic changes of IP 'addresses'/'method' if the other is set 2013-07-30 14:04:47 +02:00
Jiří Klimeš
05258cba88 cli: fix reading p-key and parent options for 'con add type infiniband' 2013-07-25 15:01:03 +02:00
Jiří Klimeš
5f0f4b83b1 cli: add support for InfiniBand's 'p-key' and 'parent' to interactive editor 2013-07-22 14:43:39 +02:00
Jiří Klimeš
8bcc68a00b cli: trivial; use mtu variable instead of calling *_get_mtu() again 2013-07-22 14:07:07 +02:00
Jiří Klimeš
ed25c1a443 cli: load/save nmcli editor (readline) history so that it is persistent
The history is saved to ~/.nmcli-history file, separately for each connection.
The file uses glib key-file format. Each group is a connection UUID, keys are
integer numbers (history entry order), and values are the actual commands.

Example ~/.nmcli-history file:
[0bdc9852-2540-4e12-a605-5e65a9483772]
0=help quit
1=print
2=nmcli prompt-color 3
3=help set
4=q

[9142680d-3b87-4feb-ab1e-19e8762329ad]
0=eth
1=set ipv4.addr 1.2.3.4
2=quit
2013-07-22 13:37:17 +02:00
Jiří Klimeš
34ab351284 cli: update bash-completion file for 'connection modify' 2013-07-22 13:37:17 +02:00
Dan Williams
16f5818927 cli: simplify setting creation 2013-07-22 13:37:17 +02:00
Jiří Klimeš
d4c8df4895 cli: 'connection modify' - modify a single property
nmcli connection modify [id | uuid | path] <ID> <setting>.<property> [<value>]

missing value means setting the default value (deleting).

Examples:
nmcli con mod ethernet-2 connection.autoconnect no
nmcli con mod "Home Wi-Fi" wifi.mtu 1350
nmcli con mod "T-Mobile 1" gsm.apn internet
nmcli con mod 91782692-512e-4408-9572-667887319ef4 conn.perm user:cimrman

TODO:
 - allow modifying multiple properties (using single command)
2013-07-22 13:37:17 +02:00
Jiří Klimeš
ead6d31eac cli: update bash-completion file for 'connection edit' 2013-07-22 13:37:16 +02:00
Jiří Klimeš
61d06d5db4 cli: use 'dirty' flag for "Do you really want to quit?" confirmation in editor 2013-07-22 13:37:16 +02:00
Jiří Klimeš
8bdb4f7a09 cli: libreadline (libedit) TAB-completion for 'connection edit'
TODO:
 - test with libedit (it seems to be a bit different, buggy?)
2013-07-22 13:37:16 +02:00
Jiří Klimeš
ca1c0cdaf4 cli: add 'nmcli' command for nmcli connection editor configuration
- show/hide status line:  nmcli> nmcli status-line yes | no
- editor prompt color:    nmcli> nmcli prompt-color <0-8>  (0 = normal/without color)
2013-07-22 13:37:16 +02:00
Jiří Klimeš
6f883c310e cli: fix saving connections in the connection editor
- Main command loop was moved to run in a separate thread (using GThread).
  Otherwise glib main loop would be blocked in processing D-Bus and other
  events.
- Handle creating new vs. updating already saved connection.
2013-07-22 13:37:16 +02:00
Jiří Klimeš
07c92ec6e7 cli: insert text to line so that user can edit it
'change' command puts current value on edit line, so that user can change
it and confirm with <Enter>.

Notes:
* it works for libreadline
* libedit has to be checked
* doesn't work without any edit-line library - how to do that??
2013-07-22 13:37:16 +02:00
Jiří Klimeš
68d69bfce8 cli: add a submenu for connection editor for detail property handling
property_edit_submenu() is the main function. It is entered from main menu by
'goto'
command.

Commands of this menu:
set       - set new value to the property
add       - add a value to the property (for non-container properties it is
            the same as set)
change    - allow editing the current property value
remove    - remove the property value(s)
describe  - show the property description and/or usage
print     - show the property value
back      - return to the setting level (main menu)
help      - show help (command descriptions)
quit      - quit nmcli
2013-07-22 13:37:16 +02:00
Jiří Klimeš
def37e4e0d cli: nmc_property_get_gvalue() nmc_property_set_gvalue()
Functions to
 - get property value and return it in GValue
 - set property value from GValue
2013-07-22 13:37:16 +02:00
Jiří Klimeš
f96cd68d90 cli: allow editing existing connections in interactive editor
So the syntax is now:
nmcli con edit [id | uuid | path ] <ID>
  - for editing an existing connection

nmcli con edit [type <new connection type>] [con-name <new connection name>]
  - for adding a new connection
2013-07-22 13:36:54 +02:00
Jiří Klimeš
da7cd4720c cli: line-editing capability for interactive editor using an edit line library
Supported libraries are:
GNU Readline    (libreadline) http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html
NetBSD Editline (libedit)     http://www.thrysoee.dk/editline/

We load these symbols:
readline() - main function allowing getting user input and aditing that
add_history() - stores strings to history
rl_insert_text() - insert text into the line at the current cursor position
rl_startup_hook - hook to call just before readline prints the first prompt
2013-07-22 13:34:48 +02:00
Jiří Klimeš
937eb48590 cli: 'connection edit' - edit/add connections in an interactive editor
nmcli connection edit [type <type>] [con-name <name>]

Examples:
nmcli c e
nmcli c e type ethernet
nmcli c e type wifi con-name "My home Wi-Fi"
nmcli c e type bond
...
2013-07-22 13:32:32 +02:00
Jiří Klimeš
02ff69100b cli: fix 'arp-interval' and 'arp-ip-target' options in usage help 2013-07-22 09:58:52 +02:00
Jiří Klimeš
f8c8d67e93 cli: fix quitting nmcli on 'nmcli con up'
We should also quit on 'DEACTIVATED' state' when monitoring active connection
state.

Reproducer:
nmcli con add con-name myvlan dev eth1 id 88
nmcli -p con up myvlan
2013-07-03 13:54:06 +02:00
Jiří Klimeš
3eac01256c cli: correct printing success indication on 'nmcli con up' 2013-07-03 13:53:58 +02:00
Jiří Klimeš
4358f5cc39 cli: fix erroneous messages and asserts for activation bond/bridge connections
error messages in bond_bridge_slaves_check():
** (process:11921): CRITICAL **: nm_device_bond_get_slaves: assertion `NM_IS_DEVICE_BOND (device)' failed
** (process:11921): CRITICAL **: nm_device_get_iface: assertion `NM_IS_DEVICE (device)' failed
2013-06-26 13:45:15 +02:00
Jiří Klimeš
5d1a6813d0 cli: print newly added 'gateway-ping-timeout' connection's property 2013-06-24 12:25:12 +02:00
Jiří Klimeš
790b3a753c cli: update bash completion file - 'nmcli connection reload' 2013-06-18 15:45:16 +02:00