summaryrefslogtreecommitdiff
path: root/cli
Commit message (Collapse)AuthorAgeFilesLines
* cli: improve bash completion to complete -h and --help aliasesth/minor-cli-changesThomas Haller2013-11-111-8/+15
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* cli: make command line parsing first check for help optionThomas Haller2013-11-113-17/+17
| | | | | | | | | | | | | Move the ckecks for nmc_arg_is_help to the beginning of the checks for command matches. Up to now, no command begins with 'h', so this has no behavioral change whatsoever. But imagine a command that begins with 'h' (for example `nmcli general hostname`), in that case `nmcli general h` should still show the help, as users might be accustomed to this abbreviation. Signed-off-by: Thomas Haller <thaller@redhat.com>
* cli: fix in matching command line argumentsThomas Haller2013-11-111-2/+2
| | | | | | | | | | | | | Ensure in matches() that a non empty cmd is given, otherwise currently nmcli general - matches to '-h' and is thus treated as nmcli general -h Signed-off-by: Thomas Haller <thaller@redhat.com>
* cli: fix 'nmcli con up bad_name' or 'nmcli con up'Jiří Klimeš2013-11-071-2/+1
| | | | | | | ** (process:25157): CRITICAL **: nmc_activate_connection: assertion `NM_IS_CONNECTION (connection) || ifname' failed Error: unknown error. Regression caused by 42c7ea85a17a7e7459942f356399e36308011c86.
* cli: add support for 'nmcli dev connect ifname XXX'Dan Williams2013-10-312-18/+163
|
* cli: add support for 'nmcli con up ifname XXX'Dan Williams2013-10-312-28/+45
| | | | | Passes a NULL connection to nm_client_activate_connection() allowing NetworkManager to pick the best available connection for the interface.
* cli: TAB-complete devices for 'activate' command in the editorJiří Klimeš2013-10-311-11/+52
|
* cli: add 'activate' menu command for interactive editor (rh #1004883)Jiří Klimeš2013-10-311-35/+218
| | | | | | | | | | This command allows activating the edited connection. Monitoring the progress of the activation is a bit complicated by the fact that the callback activate_connection_editor_cb() is invoked in main loop thread, and not in the editor thread itself. https://bugzilla.redhat.com/show_bug.cgi?id=1004883
* cli: fix VLAN egress priority mapping for 'nmcli connection add'Jiří Klimeš2013-10-301-1/+1
| | | | Found with Coverity.
* cli: fix bash completion for `nmcli connection modify`Thomas Haller2013-10-301-1/+3
| | | | | | | | | | | | Only complete the setting name if it is at the very first position after the connection. e.g. complete the settings name in the case $ nmcli connection modify em1 connec<TAB> but not at $ nmcli connection modify em1 connection.autoconnect <TAB> Signed-off-by: Thomas Haller <thaller@redhat.com>
* cli: fix new connection initialization in the editorJiří Klimeš2013-10-251-19/+27
| | | | | | This fixes a regression caused by ecd49fb435cd15aafb9a46c85ed5c42c525d0c15 In addition, initialize Wi-Fi mode to "infrastructure".
* cli: show property names in bash completion for `nmcli connection modify`Thomas Haller2013-10-241-9/+10
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* cli: do not pass con_type to callbacks, get the type from deviceJiří Klimeš2013-10-231-20/+8
| | | | | | This simplifies the code. Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
* nmcli: fix some leaks found by valgrindDan Winship2013-10-233-17/+19
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=709369
* core: add support for EAP-PWD authenticationjvoisin2013-10-231-1/+1
|
* cli: add IPv{4,6} setting for all new non-slave connections in editorJiří Klimeš2013-10-231-0/+9
|
* cli: copy remote connection to local one on 'save' (rh #997958)Jiří Klimeš2013-10-231-1/+15
| | | | | | | | | | | | | | Plugins may have problems with preserving some properties on write/read cycle, may add ipv{4,6} settings when they are not present in the connection, etc. That makes local and remote connection differ. So we copy remote connection into the local to get rid of such problems. Note: 68f12b4e9c134d41e42cc8a1986cad6bb3c07b7a and f03635e5ac829d4fc896573f2f3c6969b9d5a2e2 commits ensure that all connection (except slaves) have IPv{4,6} settings. https://bugzilla.redhat.com/show_bug.cgi?id=997958
* core: cleanup freeing of glib collections of pointersThomas Haller2013-10-221-2/+2
| | | | | | | | | | | | | | | | When freeing one of the collections such as GArray, GPtrArray, GSList, etc. it is common that the items inside the connections must be freed/unrefed too. The previous code often iterated over the collection first with e.g. g_ptr_array_foreach and passing e.g. g_free as GFunc argument. For one, this has the problem, that g_free has a different signature GDestroyNotify then the expected GFunc. Moreover, this can be simplified either by setting a clear function (g_ptr_array_set_clear_func) or by passing the destroy function to the free function (g_slist_free_full). Signed-off-by: Thomas Haller <thaller@redhat.com>
* cli: properly initialize new team-slave connections in editorJiří Klimeš2013-10-211-6/+5
|
* Fix typosYuri Chornoivan2013-10-192-8/+8
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=710505
* cli: fix a possible crash when casting NULL using NM_CONNECTION (rh #1011942)Jiří Klimeš2013-10-031-2/+7
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=1011942
* cli: enhance TAB-completion in nmcli editorJiří Klimeš2013-10-031-64/+150
| | | | | | | | | | | - completion now works for command shortcuts too nmcli> g ethe<TAB> - completion now allows leading spaces nmcli> desc wifi.ss<TAB> - fix completion of settings when property is already there nmcli> set con<TAB>.id - fix completion of properties in setting.property nmcli> des con.inter<TAB> bla
* cli: fix bash completion to show general optionsThomas Haller2013-10-031-2/+2
| | | | | | | | | | This fixes an error in the following example: $ nmcli con add type bridge con-name test-bridge <TAB> Before, general options such as 'autoconnect' and 'ifname' were wrongly not suggested. Signed-off-by: Thomas Haller <thaller@redhat.com>
* cli: add primary bonding option in bash completionThomas Haller2013-10-021-1/+2
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* trivial: remove stray ')' from nmcli prompts in questionsJiří Klimeš2013-10-021-13/+13
|
* cli: accept 'primary' bonding optionJiří Klimeš2013-10-021-2/+31
|
* cli: enhance questionnaire for bond connections (rh #1007355)Jiří Klimeš2013-10-021-49/+66
| | | | | | | | | | | | | | | | | | The session now looks like this: There are optional arguments for 'bond' connection type. Do you want to provide them? (yes/no) [yes] Bonding mode [balance-rr]: Bonding monitoring mode (miimon or arp) [miimon]: miimon Bonding miimon [100]: Bonding downdelay [0]: Bonding updelay [0]: ...when answered arp... Bonding arp-interval [0]: Bonding arp-ip-target [none]: https://bugzilla.redhat.com/show_bug.cgi?id=1007355
* cli: fix memory leaks on questionnairesJiří Klimeš2013-10-021-63/+158
|
* cli: fix missing type option 'team' in mcli completionThomas Haller2013-09-301-1/+1
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* cli: use a generic function asking for both IPv4/IPv6 in questionnaireJiří Klimeš2013-09-301-39/+33
|
* cli: be more verbose when adding IP addresses in questionnaire (rh #1006450)Jiří Klimeš2013-09-301-8/+22
| | | | | | | | | | | | | | | | | Now the session looks like this: Do you want to add IP addresses? (yes/no) [yes] Press <Enter> to finish adding addresses. IPv4 address (IP[/plen] [gateway]) [none]: 10.0.0.22/24 10.0.0.1 Address successfully added: 10.0.0.22/24 10.0.0.1 IPv4 address (IP[/plen] [gateway]) [none]: 10.0.0.22/24 10.0.0.1 Warning: address already present: 10.0.0.22/24 10.0.0.1 IPv4 address (IP[/plen] [gateway]) [none]: 192.168.1.1 abc Error: invalid gateway 'abc' IPv4 address (IP[/plen] [gateway]) [none]: IPv6 address (IP[/plen] [gateway]) [none]: abcd::1234 ::2 blabla Address successfully added: abcd::1234 ::2 Warning: ignoring garbage at the end: 'blabla' IPv6 address (IP[/plen] [gateway]) [none]:
* cli: recognize InfiniBand partitions as virtualDan Winship2013-09-241-4/+1
| | | | | We don't need to hardcode the kinds of devices that are virtual here; NMConnection already knows.
* cli: fix bond questionnaire to be able to set miimon (rh #1007355)Jiří Klimeš2013-09-191-16/+12
| | | | | | | | | | | | | | Bonding options are related and some combinations don't make sense. Basically, MIIMON and ARP monitoring mode (and related options) are mutually exclusive. When nmcli set arp_interval of "0" (the default value), nm_setting_bond_add_option() cleared the MIIMON options (miimon, updelay and downdelay). This commit works around libnm-util's nm_setting_bond_add_option() that clears miimon options when arp_interval is being set and vice versa, but doesn't take into account the value of "0" that should be regarded as 'disable'. https://bugzilla.redhat.com/show_bug.cgi?id=1007355
* cli: always print success message (not only in --pretty mode) (rh #1006444)Jiří Klimeš2013-09-192-22/+22
| | | | | | | | | The commands performing actions without an output only printed a successfull message for --pretty mode. Some users don't like this silent operation. This commit makes nmcli print operation success unconditionally. I think that doesn't hurt; scripts/users can ignore the message if not interested. https://bugzilla.redhat.com/show_bug.cgi?id=1006444
* cli: fix the error message for valid IPv6 prefix range to <1-128>Jiří Klimeš2013-09-191-1/+1
|
* cli: accept gateway in the IP questionnaire of 'nmcli -a con add' (rh #1007368)Jiří Klimeš2013-09-191-9/+38
| | | | | | | | | | | | Also allow leading/trailing white spaces, and more white spaces between IP and gateway. (Spaces in values and around / are not allowed). All of these are accepted: ' 1.2.3.4/11 1.2.3.254 ' ' 1.2.3.4 ' ' fe80::215:ff:fe93:ffff/128 ::1 ' ... https://bugzilla.redhat.com/show_bug.cgi?id=1007368
* cli: editor 'change' command: output -> input format conversion (rh #998929)Jiří Klimeš2013-09-133-62/+380
| | | | | | | | | | | The format of property values that nmcli prints is not the same (for some properties) as the format nmcli editor accepts as input from user. The reasons are that (a) output format is more descriptive and not much suitable to be typed, (b) it comes in most cases from libnm-util. 'change' command displays current property value and allows users to edit it. So we convert the output into input format, before presenting it to the user. https://bugzilla.redhat.com/show_bug.cgi?id=998929
* cli: clarify 'startup' property when NM is not runningDan Williams2013-09-121-1/+1
| | | | | Wouldn't make a ton of sense to print "started" for the STARTING property if NM wasn't running.
* cli: fix build error due to possibly uninitialized variableDan Williams2013-09-121-1/+1
|
* cli: add STARTUP field for 'nmcli -f all general status'Jiří Klimeš2013-09-121-19/+22
| | | | | It says 'starting' when NM is in the process of startup (still activating connections); 'started' when NM finished the startup.
* nmcli: extend bash completion for 'nmcli networking connectivity'Thomas Haller2013-09-121-1/+7
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* cli: consolidate a code for connectivity check a bitJiří Klimeš2013-09-121-18/+8
|
* cli: don't call g_strstrip() on NULL argumentsJiří Klimeš2013-09-121-1/+1
| | | | | GLib-CRITICAL **: g_strchug: assertion `string != NULL' failed GLib-CRITICAL **: g_strchomp: assertion `string != NULL' failed
* cli: fix an 'nmcli con edit' crashJiří Klimeš2013-09-111-6/+6
| | | | nmcli> desc AAA
* cli: set wep-key-type properly in nmcli con edit (rh #1003945)Jiří Klimeš2013-09-101-10/+27
| | | | | | | Accept both [0,1,2] and [unknown,key,passphrase] as wep-key-type values and set the property value correctly. https://bugzilla.redhat.com/show_bug.cgi?id=1003945
* cli: reset terminal using libreadline when quitting on signal (bgo #706118)Jiří Klimeš2013-09-103-0/+20
| | | | | | | | readline() makes changes to terminal and when it doesn't receive unix signals, it has no chance to perform cleanups on exit. So we have to call its cleanup functions manually on exit. https://bugzilla.gnome.org/show_bug.cgi?id=706118
* cli: handle POSIX signals in a dedicated threadJiří Klimeš2013-09-101-17/+62
| | | | | | | | | | | | | For a multihreaded application the safest way to handle unix signals is using a dedicated thread that processes the signals by sigwait() function. All other threads have these signals (processed by the thread) blocked. A few useful links: http://pubs.opengroup.org/onlinepubs/007904975/functions/sigwait.html http://pic.dhe.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.genprogc%2Fdoc%2Fgenprogc%2Fsignal_mgmt.htm http://www.linuxjournal.com/article/2121?page=0,2 http://www.redwoodsoft.com/~dru/unixbook/book.chinaunix.net/special/ebook/addisonWesley/APUE2/0201433079/ch12lev1sec8.html https://www.securecoding.cert.org/confluence/display/seccode/CON37-C.+Do+not+call+signal%28%29+in+a+multithreaded+program
* nmcli: minor fixes in bash completionThomas Haller2013-09-061-2/+11
| | | | | | | - the ifname argument for "connection add" is not mandatory - support the long names for connection types ("802-*") Signed-off-by: Thomas Haller <thaller@redhat.com>
* cli: forbid removing connection.uuid in editorJiří Klimeš2013-09-061-1/+7
| | | | | We expect that UUID is set, else there are various errors. Anyway, users should not modify connection UUID.
* cli: deny removing values of nmcli-unchangable propertiesJiří Klimeš2013-09-063-4/+47
| | | | | nmc_setting_reset_property() function checks whether we allow changing the property (set_func != NULL) and if so, the property value is reset to default.