summaryrefslogtreecommitdiff
path: root/cli/src/nmcli.c
Commit message (Collapse)AuthorAgeFilesLines
* nmcli: fix some leaks found by valgrindDan Winship2013-10-231-2/+0
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=709369
* cli: reset terminal using libreadline when quitting on signal (bgo #706118)Jiří Klimeš2013-09-101-0/+1
| | | | | | | | 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
* cli: confirm connection saving when autoconnect=yes (rh #953296)Jiří Klimeš2013-07-301-0/+1
| | | | | | | | | 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
* cli: add 'nmcli' command for nmcli connection editor configurationJiří Klimeš2013-07-221-0/+2
| | | | | - show/hide status line: nmcli> nmcli status-line yes | no - editor prompt color: nmcli> nmcli prompt-color <0-8> (0 = normal/without color)
* cli: enhance printing to align tabular output properly and not to waste spaceJiří Klimeš2013-05-311-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now we have used a static width defined for each column for tabular output. Even if this worked in most cases, it was not optimal, because by using too wide columns we wasted space, and in case of a too narrow column the alignment broke. So, we need to know the longest string in a column to be able to align columns in the tabular output. Thus, the printing has to be postponed till we have all data available, and can find the widest column. This value is then used for aligning while printing the data. Arrays of NmcOutputField (rows) are inserted into output_data array. When all data have been added, print_data() can be used to print the whole output_data array with proper alignment. A single row can be printed using print_required_fields(). Also, output flags are redone to better match the new output_data array. The flags are needed for every row (in tabular output); they are stored in the first field (NmcOutputField) for the whole row. Addapted set_val_str() and set_val_arr() to set value type (char * x char **). Added set_val_strc(), set_val_arrc() for const values that should not be freed. output_data takes ownership of the data added to it and takes care of freeing the memory. See e.g. https://bugzilla.gnome.org/show_bug.cgi?id=699503
* cli: add global '--wait <seconds>' option - timeout waiting for operationsJiří Klimeš2013-05-161-1/+17
| | | | | | | --wait <0-maxint> 0 : means "do not wait". nmcli exits immediatelly with success. 1... : if operation doesn't finish within the timeout, nmcli exits with an error
* cli: remove obsolete 'nmcli nm'Jiří Klimeš2013-04-241-2/+0
| | | | | The functionality is present in 'general', 'networking' and 'radio'. We changed syntax anyway, so it doesn't make much sense to keep 'nm'.
* cli: accept shortcuts for --mode and --escape argumentsJiří Klimeš2013-04-241-4/+4
| | | | | --mode tabular | multiline --> --mode t | m --escape yes | no --> --escape y | n
* cli: split 'nmcli switch' --> 'nmcli networking' and 'nmcli radio'Jiří Klimeš2013-04-081-2/+4
|
* cli: split 'general' into 'nmcli switch' and 'nmcli general' commandsJiří Klimeš2013-04-081-1/+3
| | | | | | | | | | | | | | | | They basically contain operations previously available via 'nmcli nm'. 'nmcli nm' is still kept for backward compatibility. Usage: nmcli switch [all|networking|wifi|wwan|wimax [on/off]] nmcli general [status|permissions] Examples: nmcli switch all - show all switches nmcli switch wifi off - switch Wi-Fi off nmcli g s - show NM status nmcli g p - show NM permissions
* cli: add '--ask' global optionJiří Klimeš2013-04-081-0/+4
| | | | It will be used to ask user for required but missing data/parameters.
* cli: rename 'nm' object to 'general'Jiří Klimeš2013-04-081-2/+4
| | | | | | nmcli general 'nm' is kept for backward compatibility.
* cli: replace 'dev' and 'con' OBJECTs by 'device', resp. 'connection'Jiří Klimeš2012-11-131-8/+11
| | | | | | Shorter forms work as previously. Thus, all of these commands are valid: nmcli device, nmcli devic, nmcli devi, nmcli dev, nmcli de, nmcli d nmcli connection, nmcli connectio, ..., nmcli conn, nmcli con, ..., nmcli c
* cli: use an error quark for domain in g_set_error() instead of 0 (rh #842975)Jiří Klimeš2012-07-251-0/+12
| | | | | glib 2.32 makes a runtime check that domain is not NULL: GLib-WARNING **: (gerror.c:390):g_error_new_valist: runtime check failed: (domain != 0)
* cli: compare nmcli and NM versionsJiří Klimeš2011-02-161-0/+4
| | | | | | nmcli gets NM version and compares it with its own and complains when they differ. This is to indicate that the results are not reliable, because the API could differ. '--nocheck' switches the checks off.
* Merge remote-tracking branch 'origin/rm-userset'Dan Williams2011-02-121-11/+0
|\ | | | | | | There; it's merged. Yay!
| * remove nm-settings-connection-interfaceDaniel Gnoutcheff2010-08-061-1/+0
| | | | | | | | | | | | | | | | | | NMSettingsConnectionInterface was created to allow the daemon and NM clients to have common code that handled both system and user connections. It's no longer needed now that user settings services are gone. This concludes the flattening of libnm-glib.
| * libnm-glib: remove NMSettingsInterfaceDaniel Gnoutcheff2010-08-061-1/+0
| | | | | | | | | | | | | | | | | | NMSettingsInterface was created to allow code to operate on a settings service without caring about what kind of settings service it was. Now that we have just one settings service, this is no longer needed. More work needs to be done in order to handle errors and permission settings in an appropriate manner.
| * libnm-glib: merge nm-remote-settings{,-system}Daniel Gnoutcheff2010-08-061-1/+0
| | | | | | | | | | | | | | | | Originally, nm-remote-settings was used by the daemon to monitor the user settings service, and its subclass nm-remote-settings-system was used by NM clients to monitor the system settings service. With user settings services gone, this distinction is no longer needed. Simplify things a bit and merge the classes.
| * nmcli: remove user settings supportDaniel Gnoutcheff2010-08-061-8/+0
| | | | | | | | | | | | | | | | Remove all support for user settings services from nmcli. Update its manpage to reflect this. Manpage edits also anticipate changes to be made in regards to how secrets are managed.
* | cli: don't poke NetworkManager D-Bus service names when it's not runningJiří Klimeš2011-02-101-5/+3
|/ | | | | | When getting status of NetworkManager via 'nmcli nm ...' and NetworkManager is not running, do not call its D-Bus methods. It prevents NM to be implicitly executed when configured as D-Bus activated service.
* cli: wait a bit even when '--nowait' is specified; for permissions check (rh ↵Jiří Klimeš2010-07-291-0/+1
| | | | | | | #614866) NetworkManager checks clients' permissions on requests, so nmcli mustn't quit too early to give NM a chance to reach it on D-Bus.
* cli: use the same version string as NetworkManager daemonJiří Klimeš2010-04-261-1/+5
|
* cli: multiline mode is default for 'dev list' and 'con list id|uuid'Jiří Klimeš2010-04-061-3/+19
| | | | | | | | Option '--multiline' was replaced with '--mode tabular|multiline'. It was neccessary to be able to switch to tabular output mode for 'dev list' and 'con list id|uuid' commands as they now print out in multiline mode by default. All other commands are in tabular mode by default.
* cli: add NMC_RESULT_ERROR_USER_INPUT code for bad invocation of nmcliJiří Klimeš2010-03-241-15/+15
|
* cli: convert 'dev list' to new format; checking options validity for terseJiří Klimeš2010-03-221-14/+0
|
* cli: changing nmcli output to better fit both computer and human needsJiří Klimeš2010-03-181-7/+81
| | | | | | | | | | | | | The output is basically tabular with fields (columns) presenting specific pieces of info. Each line represents a single object. It's possible to switch to multiline output using '--multiline' option. In that mode single object is presented on more lines - each field on its line. Terse mode now uses ':' as field separator. It also escapes all occurences of ':' and '\' inside field values to ease parsing. The escaping behaviour can be controlled through '--escape' option. By default, escaping is switched on in tabular mode. When using terse mode ('--terse'), '--fields' option is mandatory for specifying required fields. That helps for flexibility and backwards compatibility. Not all output is converted yet.
* cli: add initial pieces of nmcliJirka Klimes2010-02-251-0/+283