Commit Graph

442 Commits

Author SHA1 Message Date
Jiří Klimeš
d7216505bb cli: do not restrict VPN type of created connections (rh #1100750)
There may be third-party VPN plugins nmcli is not aware of.
We still print a warning if nmcli doesn't know the type. It helps to catch up
typos.

https://bugzilla.redhat.com/show_bug.cgi?id=1100750
2014-05-28 09:37:15 +02:00
Jiří Klimeš
649e4be103 cli: extract username and gateway for some more VPN types 2014-05-28 09:37:15 +02:00
Jiří Klimeš
98ae6e06d2 all: g_type_init() has been deprecated in GLib 2.35.0
g_type_init() deprecation:
https://bugzilla.gnome.org/show_bug.cgi?id=686161
2014-05-27 16:58:21 +02:00
Jiří Klimeš
6f9601030a cli: add missing reason-to-string mappings for NMDeviceStateReason 2014-05-26 14:07:01 +02:00
Jiří Klimeš
e6f1c8329f cli: TAB completion for connection.secondaries
We complete UUIDs, because that's easier (no spaces or special characters).
Readline display hook allows to display profile name too, though.
2014-05-23 12:19:29 +02:00
Jiří Klimeš
7696238e84 cli: only allow setting VPN connection as secondaries in editor 2014-05-23 12:19:29 +02:00
Jiří Klimeš
2b37ee2b7a cli: fix completion of interfaces in editor for "activate" command 2014-05-15 13:43:02 +02:00
Jiří Klimeš
e8f5a82e22 cli: fix ambiguity of "o" (on vs off) in nmc_string_to_bool() 2014-05-15 09:50:52 +02:00
Thomas Haller
3a19de80f7 nmcli/completion: fix logging domain "OLPC" for nmcli bash completion
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-12 19:00:00 +02:00
Thomas Haller
9ef23947cc all: fix various warnings detected with coverity
https://bugzilla.gnome.org/show_bug.cgi?id=728320

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-02 15:20:30 +02:00
Thomas Haller
9305c5bbf7 man/cli: add missing log domains to manual page and nmcli bash completion
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-24 17:27:47 +02:00
Dan Winship
bea82ca98b all: set G_LOG_DOMAIN appropriately, for better g_log() messages 2014-04-23 10:19:17 -04:00
Jiří Klimeš
645f0204f9 nmcli: improve setting connection.secondaries property
- check if the values being set are existing connections
- also allow specifying connections by names, translating them transparently
   to UUIDs.
- nmcli-specific section for 'describe' command added

(We use a global nm_cli variable in nmc_property_connection_set_secondaries())
2014-04-22 12:40:40 +02:00
Jiří Klimeš
b911d663d8 cli/bash-completion: escape spaces in profile names (rh #1041901) (bgo #709426)
We need to escape spaces and quotes in connection names, so that a connection
name containing spaces (quotes) is regarded as a single argument by bash.
See e.g. http://stackoverflow.com/questions/1146098/properly-handling-spaces-and-quotes-in-bash-completion

https://bugzilla.redhat.com/show_bug.cgi?id=1041901
https://bugzilla.gnome.org/show_bug.cgi?id=709426
2014-04-15 16:32:02 +02:00
Yuri Chornoivan
b25c227e07 fix typos in documentation and messages
https://bugzilla.gnome.org/show_bug.cgi?id=727031

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-03 17:12:31 +02:00
Dan Williams
408ecd6b5f cli: fix setting DCB application priority (rh #1080510)
Priority was originally a 'guint' but then got changed to 'gint' and
apparently we forgot to fix one place up.
2014-04-02 12:06:14 -05:00
Jiří Klimeš
c1e5493117 nmcli: use correct Mbit/s units for maximal bitrate (rh #1080474)
https://bugzilla.redhat.com/show_bug.cgi?id=1080474
2014-04-01 15:15:17 +02:00
Jiří Klimeš
4209f170da nmcli: fix an error when showing progress of activation in editor
(process:7213): CRITICAL **: nm_active_connectiuon_get_state: assertion `NM_IS_ACTIVE_CONNECTION (connection)' failed
2014-03-31 18:10:55 +02:00
Jiří Klimeš
a1e89b4d29 cli: fix bridge priority default value (rh #1073664)
It is 32768 (0x8000) instead of 128 (0x80). 13c348d fixes that in the setting.

https://bugzilla.redhat.com/show_bug.cgi?id=1073664
2014-03-17 09:08:23 +01:00
Jiří Klimeš
08ed6c5be2 cli: sanitize team config before setting it into property
Replace '\r' and '\n' chareacter with a space in the configuration.
libteamdctl sends the config to team daemon using its usock interface that
separates parameters with '\n'.

Related: rh #1051517
2014-03-12 10:44:29 +01:00
Jiří Klimeš
d7e1ec9183 cli: accept prefix "ifname/", "uuid/" or "id/" for 'master' argument
nmcli con add type team-slave ifname em2 master team-master0
nmcli con add type team-slave ifname em2 master id/team-master0

It helps to disambiguate values for cases where they may overlap,
e.g. "team0" -> "ifname/team0" or "id/team0"
2014-03-12 10:32:37 +01:00
Jiří Klimeš
90c02cafdc cli: allow specifying 'master' for slaves as connection ID (rh #1057494)
nmcli con add type *-slave ifname em1 master <ifname|UUID|name>

'master' property of 'connection' setting has to be either interface name or
connection UUID of master connection. However, to make nmcli more convenient
for users, we also allow specifying connection name and translating it to UUID
automatically.

https://bugzilla.redhat.com/show_bug.cgi?id=1057494
2014-03-12 10:32:11 +01:00
Jiří Klimeš
296d7f6ec7 cli: fix a crash when trying to set a white-space string as IP (rh #1071394)
nmcli con modify my-profile ipv4.addr "   "
nmcli con modify my-profile ipv6.addr "   "

Note:
Empty string should be used to remove IPs, and 'method' might be needed to set
to 'auto' simultaneously, as well.
$ nmcli con modify profile1 ipv4.addr "" ipv4.method auto

https://bugzilla.redhat.com/show_bug.cgi?id=1071394
2014-03-03 12:50:02 +01:00
Thomas Haller
90ff0786cc cli/bash-completion: fix nmcli connection CMD completion for --help option
The --help option (or its aliases -help/help) is only allowed at as
first argument. Fix completion to account for this.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-02 17:55:14 +01:00
Thomas Haller
74b3c22e2f cli/bash-completion: only allow --help as first argument for nmcli connection modify
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-01 02:07:53 +01:00
Thomas Haller
9d7a1d4253 cli/bash-completion: use printf instead of echo (because echo inteprets some --options)
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-01 02:07:53 +01:00
Thomas Haller
39dc39ec0a cli/bash-completion: simplify code by passing arrays by indirection to functions
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-01 02:07:53 +01:00
Thomas Haller
62cf1d85ff cli/bash-completion: complete more then one connections for nmcli connection delete
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-28 14:14:32 +01:00
Thomas Haller
4196cc1179 cli/bash-completion: complete more then one properties for nmcli connection modify
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-28 14:14:32 +01:00
Thomas Haller
280881f552 cli/bash-completion: complet nmcli connection modify --temporary
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-28 14:14:32 +01:00
Thomas Haller
07cdf56a67 cli/bash-completion: support abbreviated options for commands
Add support for abbreviated options as first argument:

nmcli connection show --act <TAB>

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-28 14:14:32 +01:00
Thomas Haller
7423bc4460 cli/bash-completion: support abbreviations for options
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-28 14:14:32 +01:00
Jiří Klimeš
ebb601302a cli: update 'nmcli con modify' help 2014-02-28 11:44:34 +01:00
Jiří Klimeš
a5673d113c cli: update 'remove' command description for 'nmcli con edit'
to reflect that user can specify a value or index to remove values.
2014-02-28 11:17:49 +01:00
Jiří Klimeš
f29ad0bd52 cli: allow removing properties by-value (in addition to by-index)
It works both in 'nmcli con modify' and 'nmcli con edit'.

The following properties are supported (all container-type properties except
properties with option names):
ipv4.dns
ipv4.dns-searches
ipv4.addresses
ipv4.routes

ipv6.dns
ipv6.dns-searches
ipv6.addresses
ipv6.routes

802-1x.eap
802-1x.altsubject-matches
802-1x.phase2-altsubject-matches

connection.permissions
connection.secondary

802-3-ethernet.mac-address-blacklist

802-11-wireless.mac-address-blacklist

802-11-wireless-security.proto
802-11-wireless-security.pairwise
802-11-wireless-security.group

vlan.ingress-priority-map
vlan.egress-priority-map
2014-02-28 11:17:17 +01:00
Jiří Klimeš
c1ace1b5b2 cli: support removing items from container-type properties in 'nmcli con modify'
Synopsis:
nmcli con modify -<property>.<setting> <value>

'value' can be empty ("") to remove the whole property value value (in this
case the behaviour is the same as without '-').
Or the 'value' is an index of the item to remove, or an option name (for a few
properties that have option names, like bond.options or ethernet.s390-options).

$ nmcli con mod myeth ipv4.dns "10.0.0.55 10.0.0.66 8.8.8.8 8.8.4.4"
---> ipv4.dns: 10.0.0.55, 10.0.0.66, 8.8.8.8, 8.8.4.4
$ nmcli con mod myeth -ipv4.dns 1
---> ipv4.dns: 10.0.0.55, 8.8.8.8, 8.8.4.4

---> bond.options: mode=balance-rr
$ nmcli con mod bond0 +bond.options "mii=500, downdelay=800"
---> bond.options: downdelay=800,miimon=500,mode=balance-rr
$ nmcli con mod bond0 -bond.options downdelay
---> bond.options: miimon=500,mode=balance-rr
2014-02-28 10:31:41 +01:00
Jiří Klimeš
a1c3021aa9 cli: allow modifying multiple properties by 'nmcli con modify'
This is necessary especially for cases where properties depend on each other.
So you need to set them in one command, else the profile won't validate.

Examples:
nmcli con mod em1-1 ipv4.method manual ipv4.addr "192.168.1.2/24,10.10.1.5/8"
nmcli con mod profile ipv4.method link-local ipv4.addr ""
2014-02-28 10:31:41 +01:00
Jiří Klimeš
431b75824b cli: set vs. append property value by 'nmcli con modify' (rh #1044027)
Previously 'nmcli con modify' appended values for multi-value properties.
This commit makes 'nmcli con modify' overwrite the whole value. You can
choose appending values by prefixing the setting.property with '+' sign.
For simple (not container) properties the behaviour is the same both with
and without the '+', of course.

Synopsis:
  nmcli connection modify [+]<setting>.<property <value>

Example:
---> ipv4.dns = 1.2.3.4
$ nmcli connection modify my-em1 ipv4.dns 8.8.8.8
---> ipv4.dns = 8.8.8.8
$ nmcli connection modify my-em1 +ipv4.dns 8.8.4.4
---> ipv4.dns = 8.8.8.8 8.8.4.4

https://bugzilla.redhat.com/show_bug.cgi?id=1044027
2014-02-28 10:31:40 +01:00
Jiří Klimeš
a8e6094e40 cli: allow temporary connection modification by 'nmcli con modify'
nmcli connection modify [--temporary] ...
2014-02-28 10:31:40 +01:00
Thomas Haller
7d73ee75df trivial: more wrong compiler warnings
connection_parser.c: In function 'make_ip4_setting':
  connection_parser.c:660:33: error: 'method' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    if (!is_static_block && strstr (method, "dhcp")) {

  connections.c: In function ‘load_cmd_line_edit_lib’:
  connections.c:5744:17: error: ‘module’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
    g_module_close (module);

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-27 18:31:07 +01:00
Thomas Haller
d3a2219cee replace snprintf by g_snprintf
Use the glib wrapper for snprintf.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-24 21:35:33 +01:00
Thomas Haller
8a67713e9e cli: allow resetting the connection.master to NULL
Without this patch, the following two commands fail:
  nmcli connection modify em1 connection.master
  nmcli connection modify em1 connection.master ""

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-24 09:44:29 +01:00
Jiří Klimeš
a493cda8d6 cli: better checking of WEP key types in nmcli interactive editor (rh #1040964)
https://bugzilla.redhat.com/show_bug.cgi?id=1040964
2014-02-17 15:22:35 +01:00
Dan Winship
9c4d86ee80 libnm-util, libnm-glib: add versioned deprecation/availability macros
Add versioned NM_DEPRECATED_IN_* and NM_AVAILABLE_IN_* macros, and tag
new/deprecated functions accordingly. (All currently-deprecated
functions are assumed to have been deprecated in 0.9.10.)

Add NM_VERSION_MIN_REQUIRED and NM_VERSION_MAX_ALLOWED macros which
can be set to determine which versions will cause warnings.

With the current settings, external consumers of the
libnm-util/libnm-glib APIs will have MIN_REQUIRED and MAX_ALLOWED both
set to NM_VERSION_0_9_8 by default, meaning they will get warnings
about functions added in 0.9.10. NM internally sets
NM_VERSION_MAX_ALLOWED to NM_VERSION_NEXT_STABLE to ensure that it is
always allowed to use all APIs.
2014-02-13 11:24:37 -05:00
Thomas Haller
c52decbfcb cli: show warning when setting band/channel for infra mode (rh #1000096)
The band/channel property is not considered when connecting to an
access point. Print a warning, when setting one of these values in edit
mode.

For now, don't forbid the user to make such setting. Also, because in
the future, wpa_supplicant might support this.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-13 12:22:52 +01:00
Jiří Klimeš
84721804cd cli: fix crash if active connection doesn't have a device (rh #1064333)
$ nmcli dev connect wlan0

This can happen for example when some other process disconnects
the connection being connected.
Also fix printing a message on success.

https://bugzilla.redhat.com/show_bug.cgi?id=1064333
2014-02-12 16:31:39 +01:00
Thomas Haller
c960d474fb cli/bash-completion: make 'ifname' a mandatory parameter for nmcli connection add
For some connection types (bond, bridge, team and vlan), 'ifname' is
optional.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-30 15:44:16 +01:00
Thomas Haller
6d25080e6a cli/bash-completion: complete 'save' option for nmcli connection add
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-30 10:49:51 +01:00
Jiří Klimeš
ec0f629ed2 cli: persistent vs. temporary save for 'nmcli con edit' 2014-01-30 10:49:51 +01:00
Jiří Klimeš
2d523bd800 cli: allow creating temporary (unsaved) connection with 'nmcli con add' 2014-01-30 10:49:51 +01:00