* remove "Encrypted" tag
The "Encrypted: " stuff was initially copied from nm-tool, but it doesn't help
here much. See also http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=a734c836a56f3170202f0555f1a03c9b2835775c
for APs with WPA & RSN IEs, but no privacy flag.
* remove a space from "WPA ", etc. strings. Translators often leave it out
and thus break output.
* change "WPA" to "WPA1" to make it clearer
* use "802.1X" instead of "Enterprise" to save some characters
The data are added to output_data at first, and then they are printed all at
once using print_data(), that takes care of proper alignment and display.
The static 'width' values defined in NmcOutputField columns are not used now,
but dynamically computed maximal widths override them.
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
--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
That way it is not displayed by default:
$ nmcli general status
But can be explicitly requested:
$ nmcli -t -f running,version general status
$ nmcli -f all general status
E.g. Fedora initscripts do this in
/etc/sysconfig/network-scripts/network-functions
is_nm_running ()
{
[ "$(LANG=C nmcli -t --fields running nm status 2>/dev/null)" = "running" ]
}
A few examples:
nmcli --ask connection add
nmcli connection add type ethernet
nmcli -p connection add type ethernet con-name "my ethernet connection 1"
nmcli connection add type ethernet ip4 192.168.100.5/24
nmcli connection add type ethernet ip4 192.168.100.100/24 gw4 192.168.100.1 ip4 1.2.3.4 ip6 abbe::cafe
nmcli connection add type ethernet ifname eth0
nmcli connection add type ethernet autoconnect no ifname eth0
nmcli connection add type wifi con-name Rakosnicek ssid Brcalnik
nmcli --ask connection add type wifi con-name My_WiFi
nmcli c a type infiniband con-name Infi1 transport-mode connected
nmcli c a type bluetooth addr 12:54:00:fd:db:26
nmcli c a type bluetooth addr 12:54:00:fd:db:26 bt-type dun-cdma
nmcli c a type gsm apn internet
nmcli c a type cdma
nmcli c a type bond
nmcli c a type bond ifname mybond0 mode active-backup
nmcli c a ifname maxipes-fik type vlan dev eth0 id 55
nmcli c a con-name VLAN1 type vlan dev eth0 id 44 ingress "2:4,3:55" egress "1:3" flags 6
nmcli c a type bridge ifname br0 stp on ip4 10.0.0.25
nmcli c a ifname eth0 type bridge-slave master 30fc816a-e7dd-4ae7-a86e-ab0c9cee51c2 hairpin no path-cost 333 priority 20
nmcli c a type bridge-slave master br2
nmc_string_to_int() - converts string to signed long int (decimal)
nmc_string_to_uint() - converts string to unsigned long int (decimal)
nmc_string_to_int_base() - converts string to signed long int with given base
nmc_string_to_uint_base() - converts string to unsigned long int with given base
This function checks whether a string is contained among allowed strings. It
performs case-insensitive comparison and supports shortcuts if they are unique.
It returns a pointer to the found string in allowed array, or NULL.
Add a new libnm-glib method to get the type description for a device,
and use it in nmcli. For most types, the type description is based on
the class name, but for NMDeviceGeneric, it comes from the
:type-description property.
If there are no slaves after the timeout, exit nmcli with an error, assuming
that NM is waiting for slaves to finish activation:
"(bondx) "IPv4 config waiting until slaves are ready"
"(bondx) "IPv6 config waiting until slaves are ready"
nmcli general logging [level <log level>] [domains <log domains>]
Examples:
nmcli general logging - print current level and domains values
nmcli general logging level ERR - change logging level to ERR
nmcli general logging level DEBUG domains DNS - change logging level to DEBUG and domains to DNS
nmcli g l domains DEFAULT - set default log domains (the ones active when NM)
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
Examples:
nmcli device show - shows details for all available devices
nmcli device show eth0 - shows details for eth0
nmcli device show em1.25 - shows details for em1.25 VLAN device